DNSSEC is a system to verify the authenticity of DNS data using public key signatures. With increasing deployment of DNSSEC comes the possibility of applications using the DNS to store and retrieve TLS/SSL certificates in an authenticated manner. And possibly obviating the need for public/global certification authorities (CA), and empowering domain owners to issue their own certificates instead.
For those of you who know me a little better, you’re probably aware that I’ve been griping about the inherent deficiencies of the public CA model for years. Certainly my colleagues at Penn have been subjected to many a diatribe on this topic, and occasionally I’ve done so more publicly (no pun intended).
In brief, the problems are that applications (such as web browsers) are pre-configured to trust a very large number of global CAs. These CAs have absolutely no constraints on the namespace for which they can issue certificates. Any of them can issue a certificate for any of your services (whether you have a business relationship with them or not). And thus, we have what is tantamount to least common denominator security - the collective security of the system is equivalent to the CA with the weakest security and laxest policies. It gets worse - many of these CAs in turn issue subordinate CA certificates for their customers, again with no namespace constraints.
Another issue is that most of these CAs are capable only of issuing certificates with the most basic capabilities. If you need to deploy a certificate with some more exotic feature (eg. an alternate name form or extension), you’re basically out of luck.
Incidentally the PKIX specifications do have the capability of constraining the namespace (see RFC 5280 Section 184.108.40.206: Name Constraints extension), but deploying it in the existing public CA model will require a huge amount of work (both technical and political), including deployment of a hierarchical global CA architecture, as well as enhancing client software to validate name constraints (which practically none do today).
Introducing DANE and TLSA
Recent work in the IETF holds some promise to improve things. RFC 6698 (DANE) defines the new DNS record type TLSA, which holds what is called Certificate Association data. In conjunction with DNSSEC signatures, this will permit better and more secure ways for applications to authenticate certificates. The record can be used in 4 different ways (defined by a “Usage” field):
- (Usage 0) Specify authorized public CAs - this can prevent certificates signed by CAs that you didn’t explicitly specify from being trusted by client software.
- (Usage 1) Specify which specific server certificate can be trusted. The public CA certificate validation chain all the way to the server certificate must still be validated.
- (Usage 2) Authorize a new non-public CA (eg. a CA that the domain owner operates itself)
- (Usage 3) Directly specify the server certificate in the DNS - no certificate chain from a public CA needs to be used. This is called a “Domain issued certificate”
If you’re looking for a way to not use public CAs, Usage 3 is probably the one for you.
The owner name of the TLSA record defines the port, transport protocol, and server host name. Here’s an example for the HTTPS service (port 443, TCP) at www.example.com:
_443._tcp.www.example.com. IN TLSA ( 0 0 1 d2abde240d7cd3ee6b4b28c54df034b9 7983a1d16e8a410e4561cb106618e971 )
The right hand side (“rdata” or resource data) of the TLSA record contains 3 numbers and the raw certificate data in hexadecimal. The 3 numbers are the usage field (previously described), the selector field (which says whether the certificate data takes into account the full certificate or only the subject’s public key), and the matching-type field (which says whether the certificate data is the full content that the selector field specifies, or whether it is a cryptographic hash of it). See RFC 6698 for a more detailed description.
Deploying a TLSA record for my website
After seeing several prominent mentions of DANE at this week’s ICANN’45 DNSSEC workshop, (see Dan York and Paul Wouters’ presentations for example) I felt motivated to install a TLSA record for my website.
Now billions of users with TLSA capable web browsers and DNSSEC validating resolvers will be able to securely reach my website! Okay, that’s a slight exaggeration, but perhaps one day, in the not too distant future!
I wanted to see if I could do this using standard tools already available on most UNIX systems. It wasn’t too hard. My site already has an SSL certificate issued by StartCom Ltd, but I want to specify that the server certificate can also be authenticated directly without a CA (TLSA Usage type 3). I’ll also use a SHA256 hash (match-type 1) of the full certificate (selector 0) as the certificate association data (so the 3 numbers in the rdata will be 3 0 1).
OpenSSL can be used to easily generate the certificate association data portion. We first convert my PEM encoded certificate (in file huque.crt) into the binary DER encoding (openssl x509 -outform DER) and then pipe the output to “openssl sha256”. This generates the 256-bit SHA hash represented as a string of 64 hex digits (each hex digit is 4 bits):
$ openssl x509 -in huque.crt -outform DER | openssl sha256 (stdin)= 8cb0fc6c527506a053f4f14c8464bebbd6dede2738d11468dd953d7d6a3021f1
The resulting TLSA DNS record will thus look like:
_443._tcp.www.huque.com. IN TLSA 3 0 1 ( 8cb0fc6c527506a053f4f14c8464bebbd6dede2738d11468dd953d7d6a3021f1 )
One quick nsupdate command (details omitted) and the record was installed in my DNSSEC signed zone. We can check that the record (and its signature) is present with dig:
$ dig +dnssec +noall +answer +multi _443._tcp.www.huque.com. TLSA _443._tcp.www.huque.com. 893 IN TLSA 3 0 1 ( 8CB0FC6C527506A053F4F14C8464BEBBD6DEDE2738D1 1468DD953D7D6A3021F1 ) _443._tcp.www.huque.com. 893 IN RRSIG TLSA 8 5 900 ( 20121117202722 20121018192722 14703 huque.com. OJ4b/O7J+Fh3KVDGG8nH9X5dRSXgl3j7/S/PbB1RczcY fYxdu5C9xZSALCz0MgVFW6Kcne74ou5R/Wd+CDKm7mYY Ga28MrtE1boNLuOTa6kOpFcNjW+UYnMFQuc6S8zhU1G7 LH0n3TbM3rJS0wH0u6J4NgtiowZS2VlkwPez3D8= )
(If you’re using an older version of BIND/dig that doesn’t understand the TLSA record type, you can replace TLSA in the command line above with TYPE52.)
Note: the huque.com zone does not currently have a secure delegation from the .COM TLD. This is mainly because my current DNS registrar (Network Solutions) is incapable of processing DS records, sigh, and I’ve been too lazy to switch. In the meantime, it has a DLV record published in the DLV registry operated by ISC, so any validating resolver configured to use that registry (and many are) should be able to authenticate records in huque.com.
Not surprisingly, there are already tools out there that make it easy to generate TLSA records. Paul Wouter’s hash-slinger package can do it (supposedly integrated into newer Fedora Linux releases). With the “tlsa” program included in that package, we can do this via:
$ tlsa --create --output rfc --usage 3 --certificate huque.crt www.huque.com _443._tcp.www.huque.com. IN TLSA 3 0 1 8cb0fc6c527506a053f4f14c8464bebbd6dede2738d11468dd953d7d6a3021f1
Obviously DANE needs to be widely adopted by the Internet community for it to be successful, and it’s not yet clear how long that will take. And obviously browsers and other application sofware will have to evolve to make use of TLSA records. But preliminary work appears to already be in progress - there are a few browser extensions that try to validate TLSA records for HTTPS websites. I plan to look into those next ..
(June 2013) I thought I’d mention I have a small program that generates the resource data for a TLSA record from a certificate file and given parameters. You can find it on github: tlsa_rdata ]
(September 2013) Randy Bush pointed out to me that OpenSSL versions on a number of operating systems like current versions of Mac OS X and FreeBSD are too old to support sha256. It appears that the sha256 digest command in OpenSSL is fairly new, appearing in version 1.0.1, which is newer than many current operating system distributions provide. So I’ll provide a few alternatives to “openssl 256” for them:
On Mac OS X, you can use shasum (/usr/sbin/shasum): openssl x509 -in certfile.crt -outform DER | shasum -a 256 On FreeBSD, you can use sha256 (/sbin/sha256): openssl x509 -in certfile.crt -outform DER | sha256 On Redhat Linux, you can use sha256sum (/usr/sbin/sha256sum): openssl x509 -in certfile.crt -outform DER | sha256sum
Or you can use Python’s hashlib module (going back as far as Python 2.5). I’ve put up a small program on github called dgst that provides a simple command line utility to generate various cryptographic hashes of files or whatever is fed on standard input: