4 ms·
TLS certificates specifying hosts via the CommonName field is more or less gone
- cameronh90 6y agoAt this point, X.509 certificate information fields mostly seem to be an anachronism. When was the last time anyone looked at the OU of your certificate?
- bawolff 6y agoWell back when EV certs were a thing...
- hedora 6y agoIn fairness, X.509 seemed like an anachronism by the time SSL was standardized. SGML would have been a less insane choice. XML came out a year after SSL 2.0, so the timing wouldn’t have worked for it.
- ape4 6y agoMakes it seem more official.
- JoshTriplett 6y agoOmitting the CN would make the certificate a little smaller, which might make a difference over many requests.
- koolba 6y agoNot if they still fit within one TCP packet per side of the handshake.
- toast0 6y agoMost physical transports don't pad packets to the maximum size. Ethernet only pads if you're below 46 bytes of payload, which is smaller than TCP packets with TCP timestamps; so if you're on Ethernet and have TCP timestamps enabled (which is very common), you'll certainly see the savings from any bytes removed from your certificate; unless your TLS layer is padding out to (path) MTU. Assuming that's in the neighborhood of a 20 byte savings, it's not very significant. Using EC keys rather than RSA keys if possible is a bigger savings. And disabling TCP Timestamps, which add 12 bytes per packet (including ACKs) would be bigger still[1]. That said, shaving off bytes wherever possible adds up. [1] I've heard that disabling TCP Timestamps may disable receive window scaling on iOS (and maybe macos), see [2] for a report. It's also very useful to avoid problems with wrapped sequence numbers if your (bytes/time * assumed maximum segment lifetime) is anywhere near 32-bits; this usually requires around a gigabit on a single TCP connection. As the link mentions, tcp timestamps do make retransmits have different content than the original send, which can incidentally help if you have broken networking equipment on your path, depending on the details of the brokenness. [2] https://www.snellman.net/blog/archive/2017-07-20-s3-mystery/ https://www.snellman.net/blog/archive/2017-07-20-s3-mystery/
- tialaramex 6y ago> unless your TLS layer is padding out to (path) MTU I'd actually like to see more servers doing this. In TLS 1.3 it's actually free (in earlier versions signalling the intention to pad costs some space so it's possible you've got some free space but not enough to add padding without using a whole extra packet), but in TLS 1.3 as a side effect of other changes needed you can add any number of empty padding bytes to a record). This means an adversary loses some precision in estimates of your payload size from size of TLS transfer, which may reduce their ability to fingerprint these payloads. > That said, shaving off bytes wherever possible adds up. If this matters (and I'm not convinced it does when you aren't shaving off whole packets or making space for something else) other tricks you can do: * Arrange to obtain unlogged certificates from your issuer. To be trusted by browsers and perhaps in future other clients, your certificates must have proof they were logged in the Certificate Transparency system, most issuers will sort this out for you, log certificates and bake the resulting proofs inside your certificate. But this makes the certificate bigger, you can legitimately obtain certificates which aren't logged, log them yourself, and hand over the resulting proof only to clients that insist on seeing it, thus saving bytes * Implement the certificate compression feature RFC 8879. Many clients today don't do this, but more will over time, this TLS 1.3 feature lets you compress the certificate before sending it to a client that understands how to decompress it. * Use smaller keys (2048-bit RSA but more importantly if possible a smaller elliptic curve key) * Get short names for things, only use those names. A certificate for some.short.example and longer-name.our-company-is-famous.example is worse, because that has both names in it, but if you can get OK to just use some.short.example that's saving a few bytes even if you only have SANs and no Common Name at all. * Get issuer to disable unnecessary verbiage. Many certificates are full of disclaimer text and needless baggage. Does your issuer realise those cost you money? Does this site need to say YCombinator is in San Francisco which is in California? Does anybody who cares check the certificate? This sort of thinking is why Let's Encrypt's replacement for "Let's Encrypt X3" is just named "R3". We know which CA made it, so why waste bytes saying so twice?
- toast0 6y ago>> unless your TLS layer is padding out to (path) MTU > I'd actually like to see more servers doing this. In TLS 1.3 it's actually free (in earlier versions signalling the intention to pad costs some space so it's possible you've got some free space but not enough to add padding without using a whole extra packet), but in TLS 1.3 as a side effect of other changes needed you can add any number of empty padding bytes to a record). This means an adversary loses some precision in estimates of your payload size from size of TLS transfer, which may reduce their ability to fingerprint these payloads. Yeah, I think this is a good use of not entirely needed bytes. Even though it's way more bytes than repeating one of the hostnames. Of course, it puts more emphasis on path MTU working, especially if the client does it too. It seems very likely the server side of the handshake will easily fill at least one whole packet, unless you've got jumbo packets or terrible packetization.
- dilyevsky 6y agoYou’ll get a lot more benefit by using Ed25519 (or ECDSA if browser support is required)
- deathanatos 6y ago… if I may be very pedantic for a moment. > Having a Subject Name in general is common (although apparently not actually required) It depends on what you mean by "required". A name (which a subjectName is) is a list of sets of key/value attributes; that list will always be present, but it might not have anything in it. (It might be the empty list.) (Whether you count a present, but empty, list as fulfilling the word "required", I leave up to you.) > See also, which pointed me to no-subject.labs.vu.nl, which has a currently valid TLS certificate with no Subject Name at all. It's there, and it's empty. The structure is: (read "SEQUENCE" here like "struct"; a list is closer to a "SEQUENCE OF") TBSCertificate ::= SEQUENCE { version [0] EXPLICIT Version DEFAULT v1, serialNumber CertificateSerialNumber, signature AlgorithmIdentifier, issuer Name, validity Validity, subject Name, subjectPublicKeyInfo SubjectPublicKeyInfo, If you use openssl to dump the ASN: 117:d=2 hl=2 l= 30 cons: SEQUENCE # validity 119:d=3 hl=2 l= 13 prim: UTCTIME :201017024909Z # start 134:d=3 hl=2 l= 13 prim: UTCTIME :210415215900Z # end 149:d=2 hl=2 l= 0 cons: SEQUENCE # subject 151:d=2 hl=4 l= 290 cons: SEQUENCE # subjectPublicKeyInfo So, it's "there", and we even spend a whole 2 bytes on it. I believe there's also some requirements on it being non-empty. The article's author is looking at it mostly from the point of view of leaf certs, and there, it can be empty. On CA certs, however, it can't be empty. (Because "Issuer" can't be empty on certs issued by the CA, and it must match the Subject of the CA cert, ergo, Subject must be non-empty there. Doesn't have to have a CN, though.) (All of this is in https://tools.ietf.org/html/rfc5280 https://tools.ietf.org/html/rfc5280) (But, yeah, like the article says, using CN for checking the domain is dead.)
- 1vuio0pswjnm7 6y agoIt is not as if no one ever generated a cert with an empty CN. This is from mkcert.sh in the OpenSSL distribution: req_nocn() { local key=$1; shift key "$key" stderr_onerror \ openssl req -new -"${OPENSSL_SIGALG}" -subj / -key "${key}.pem" \ -config <(printf "[req]\n%s\n[dn]\nCN_default =\n" \ "distinguished_name = dn") }
- deleted 6y ago[deleted]
- tialaramex 6y ago> Hopefully they are all following the 2011 requirement to check only SANs when SANs are present (which they should always be in public certificates). Alas last time I paid attention Python's code was pretty bad. They got themselves into a mess by trying to think about the DNS name as text, and thus Unicode, and so they persuaded themselves they care about Ulabels, which are intended as a presentation system (ie they're about what we show in a user interface so that a random Cambodian peasant and a Russian oligarch both get squiggles that they recognise even though DNS was invented by Americans) rather than only the Alabels (a restricted subset of ASCII used by the DNS backend). So whereas the correct way to check if this site's certificate is for the right name is to compare the bytes that make up the DNS name to the bytes in the SAN dnsName of the certificate, which is trivial, they ended up needing to do a bunch of Unicode conversion work, pulling in libraries of other code, which was obsolete and... it becomes a huge mess. The end result is Python worked fine for some.name.example but might break for say кц.рф (the Registry for public Russian TLD рф) because, even though it doesn't matter at all, they're trying to turn it into a Unicode string. Maybe somebody who focuses on this can say if this was fixed? I stopped caring in 2018 after I had explained all this twice to relevant people. Banging your head against a wall is bad for you and the wall doesn't care.
- keeperofdakeys 6y agoYou still have bugs like this when you generate certs with an empty CommonName field, https://github.com/nodejs/node/issues/11771 https://github.com/nodejs/node/issues/11771. I have an app which has certificate checking turned off due to this bug, I hope they'll update the packaged nodejs sometime in the future.
- tialaramex 6y agoThe current situation, where certificates have SANs in them resembles what PKIX (RFC 2459 etc.) expected from the outset many years ago What actually resulted in this finally happening was not the change in the browsers, in fact the browser changes were permitted by the reality that there aren't certificates without SANs any more. Though I agree the browser change does prevent backsliding. Nor was it the change in the Baseline Requirements which spell out that CAs must use SANs. No, what mattered was Certificate Transparency. Especially mandatory CT, but even just voluntary compliance by CAs eager to show willing before that. The problem we've most consistently had with CAs isn't that they're deliberately breaking the rules, but that they're incompetent. Which makes sense, humans aren't mostly bad but they are mostly incompetent. So they might intend to comply, but they screw up. CT allows independent researchers to check stuff. For example after certificates for "private names" (e.g. "hplaserjet" or "myrouter.home") were banned, there was a period when CAs mustn't issue more but had time to revoke any that still existed. After that time limit expired I ran a script to pull out any certificates from CT which (in the script's opinion) seemed to be for private names, yet (again in its opinion) had not been revoked. There shouldn't have been any. But of course there were and the CAs had to clean up their mess. This allowed us to really clean up several problems with certificates, where a practice was banned, everybody agreed it was banned, but it kept happening anyway. Today if you issue a certificate that shouldn't exist (as we saw recently with that 1024-bit RSA certificate) it's likely to get noticed fairly quickly and you'll have to explain yourself.
- cookiengineer 6y ago> hplaserjet Came here to say this. Many old printers from HP don't work anymore not due to planned obelescence (which is another problem) but due to sheer incompetence. Their web interface allows setting "important" details only via SSL even though their firmware doesn't even have a password or login access feature. The web app will redirect constantly using location headers if you try to use some settings views in the web app via http. Nowadays you cannot use those printers anymore because all Browsers mark them as an insecure context, and therefore are blocking POST XHR requests to manually allowed and installed certificates. So, we now have a generation of tech that made itself useless due to Browser behavior changes and there's no way to fix it without going back to a Windows XP-state operating system that is insecure. I am so annoyed by this. We need open source printing firmwares, because I think it's only gonna get worse in future.
- pimlottc 6y agoWhat’s the recommended practice for CN on a certificate with multiple SANs? I imagine many tools and org process still require at least some value to be present.
- tialaramex 6y agoThe issuing CA is required to pick one of the SANs to encode as CN if it is to be present at all in a leaf certificate. You may be able to choose (so long as you obey this constraint) by setting your desired CN in the Certificate Signing Request. If you meant how should you pick? Well that's up to you. From a presentation point of view, the CN may be used to display the certificate's subject in some summary views so you might want a short but sufficient name to describe what it's for, if it also includes aliases that are more confusing or less specific. From a compatibility point of view, older software might (erroneously as this article points out, PKIX introduced SANs over twenty years ago, time to upgrade) only check CN and so you might want to reserve the CN to be for a name used by the oldest crumbliest clients. If you've got archaic.mycorp.example and modern.mycorp.example and experimental.mycorp.example with archaic still offering TLS 1.0 and 3DES to that valuable yet tragically slow to upgrade customer who insists on it, well I'd put archaic.mycorp.example in the CN field because if there's a client that'll expect it there it'd be the one that's still needing TLS 1.0 or 3DES not the one built last week. Another compatibility idea, don't put the obvious name in the CN for the test servers, use some other name you own that's harmless - this way people integrating your system will run into the "It doesn't work because our crappy library doesn't do SANs" problem during early testing not when it goes to production or some day when your production certificates change the value of CN.