Build a tiny certificate authority for your homelab
smallstep.com
smallstep.com
As it is Linux already has completely acceptable source of entropy. The most significant drawbacks are that it could potentially be observed by somebody else with access to the machine and that it provides only very limited amount of entropy. Both are not a problem when you use private RPi to generate a dozen keys for your home lab.
I was not arguing that a hardware RNG was needed or not, just questioning if adding a second one to a Pi made sense.
And if you're into kubernetes and/or run your own little kubernetes cluster at home, cert-manager can issue certificates off vault too.
It's a downgrade in security compared to pressing a physical button a YubiKey every so often... but I am OK with things being automatically renewed. (It basically means, if you own the apiserver, you own the network, which is a tradeoff I can live with. Compare this to "if you can intercept any packet, you own the network", which is what non-mTLS is.)
There are many CAs out there and in the event of China or Russia hacking into one of them, it would enable them to perform man-in-the-middle attacks. I'd like to eliminate such a possibility, but the TLS protocol requires me to trust a certificate authority. I might just be a conspiracy theorist, but I am suspecting why it's impossible to use TLS without trusting a third-party called certifcate authority is exactly because someone needed to leave a way to do MITM attacks.
Edit: Also, I recently learned about DNS Certification Authority Authorization (CAA) records. You can specify which of the public certificate authorities a browser is allowed to respect, for your domain. I don't think it's verified by all browsers yet, but it's a step.
Their counterpart for browsers are TLSA records, which associate specific keys or certificates with a domain name. This is the part that actually prevents MITM attacks on the client side (assuming the client's getting a complete and accurate DNS response, which is a whole other issue), since it'll cause a compliant client to reject any other keys or certificates. (No idea how widespread the implementation of this is on the client side, though.)
I’ll also add that certificate transparency (CT) is another mechanism designed to mitigate malicious cert issuance by a CA. A CT log is an public, append-only data structure. It doesn’t actively prevent anything, but it does ensure that a malicious issuance is easily detectable. In practice it seems to be a pretty effective deterrent against nation-state attacks: they won’t go undetected for long.
But let's talk about PSKs (pre-shared keys).
TLS 1.3 itself doesn't care why this PSK is used. It's true that today your Web Browser will only use it for resumption, because it offers a significant speed-up in some scenarios on second and subsequent visits.
But for IoT applications it is envisioned that a group of devices might share one or more PSKs out of band. Maybe they're a factory setup thing, maybe the devices are to be set up in close physical proximity using low bandwidth Bluetooth, then they'll build themselves a WiFi network when deployed using PSKs to secure TLS.
Browsers could do that, but all the vendors are clear there's no way they'd actually want to do that. What would the UX look like? "Please enter the hexadecimal PSK for the site in this box?". So today they only use PSKs for resumption.
The reason this one feature (PSKs) has two very different purposes is to narrow the security proof work. Mathematicians worked really hard to prove some important things about TLS 1.3 and the more extra different features it has, the less focus can be put on any particular feature.
Even as it is they missed the fact that PSKs are symmetric. If Alice and Bob have a single PSK to "authenticate" them and are both capable of serving, then Mallory can trick Alice into thinking she's talking to Bob when she's actually talking to herself. It's a small problem, but the proofs didn't cover it, and so it was not spelled out in the TLS 1.3 document that you should worry about this.
The big three root store programs are run by Apple, Microsoft, and Mozilla/NSS. Most (all?) Linux distros are based on the Mozilla store. Until recently, Google also used Mozilla’s store for things like ChromeOS and Android. They just recently announced that they’re gonna start running their own program though.
FWIW the browsers seem to do a pretty good job of policing CAs. Probably better than most end-users would do.
I’m on iOS and don’t have an Android or ChromeOS device handy. I don’t see a way to remove a cert from Apple’s iOS trust store (settings just tells me what store version I’m running). There may be a way to do it using mobile device management (MDM) tools.
Obviously this is all addressable in theory, but now you’d need some kinda policy system baked in pretty much everywhere.
The CAA record is useful only at the time a certificate is issued (signed) by a CA.
A client has no way to know what the CAA record was at the time the certificate was issued -- a browser cannot ("at acceptance-time") use the current value of the CAA record to determine whether a certificate was properly issued or not.
Your website hands me a cert. I have never seen it before so I make sure CA says it's legit. From then on I keep using that same cert to connect to you, and CA no longer matters.
If you say the self-signed certificate is the authority, that's no problem.
In my private lab environment I have one certificate (for everything).
The certificate is installed on all servers, and even the clients use the same certificate to authenticate, and everyone trusts the cert as an authority.
You'd never run a production setup like this, but there is nothing stopping you.
But because ACME has been so successful (good!) lots of newer or updated software incorporates ACME support out of the box, and so it is attractive to be able to interface to that support.
We could have had a situation where most server software did SCEP and you needed an adaptor to reflect the SCEP requests into a system that would use ACME to get them a certificate if they face the public Internet. But that isn't what we got, so, fine, this works, I'll take it.
See also: https://twitter.com/smallsteplabs/status/1341800787291168768
It works fine for mailservers. No on expects a mailserver cert to be from an authority, you can self sign and it works fine.
Like, just last week the browsers had to remove a certificate authority from their root cert programs because Kazakhstan was issuing certificates to MiTM traffic. A TOFU model would make it a lot harder to detect and remediate this sort of attack and lots of other relevant attack vectors.
We'd also need to re-solve a bunch of adjacent problems like revocation, renewal/rotation, and transparency, which would probably mean re-introducing the sorts of centralized architectural components and processes that I'm assuming you're trying to eliminate with TOFU.
Then however, we get to the political question who exactly that central authority should be and why.
> Like, just last week the browsers had to remove a certificate authority from their root cert programs because Kazakhstan was issuing certificates to MiTM traffic.
I may have misunderstood the incident, but wasn't it such that the CA was not even one of the built-ins, but a "custom" root CA that all users were required to install on their systems? As such, the block was more equivalent to block a specific to TOFU key.
Of course, blocking the MITM CA won't magically turn off the ISP's MITM proxy. It will simply make it so that kazhakh citizens can't access any web sites at all until the government hopefully caves and turns off the proxy.
I wouldn’t say the centralization of Web PKI is by design so much as it is (was?) by necessity. There’s a crypto conjecture called Zooko’s Triangle that says there are three desirable properties for a naming system: human-meaningful, secure, and decentralized. Zooko’s conjecture is that you can only have two. Web PKI picks secure & human-meaningful. Simple PKI (like TOFU) picks secure & decentralized (the names aren’t actually human-meaningful since you’re really trusting a public key which is a big random number, not a domain name). DNS picks human-meaningful and decentralized.
More recently, Aaron Schwartz realized you can “square the triangle” using blockchain. So it appears to be technically possible to have all three now, but there are other hurdles. In any case, simple public keys aren’t a silver bullet. Just a different set of compromises.
So most SSH users (who, on average, are way more technically competent than browser users) will automatically 1) panic and think they're being hacked, or 2) blindly trust the new key when a key change occurs with SSH. Both of these responses are dangerous. The result is that, unless you have fancy stuff for managing known hosts for all of your users on all of your endpoints, you're probably just avoiding this scenario by not rotating host keys at all for SSH. Which is also problematic.
By using a CA you're delegating the key binding to a trusted piece of infrastructure that can be locked down and monitored by experts. You can't do that easily with key-bindings written to files on a bunch of different endpoints. With a CA, end users shouldn't need to care about key changes. The fact that the CA can issue a new certificate for some entity is a benefit: it makes credential rotation easier. If you do want to know when credentials rotate there are ways to monitor that yourself (and Web PKI has ways like key pinning and cert transparency).
In my homelab? I guess I should also kerberize my NFS mounts, after I solve the SPOF problem for kerberos's dependent pieces. I might have a little time after doing all this for working on my homelab projects. How much time could this configuration, maintenance and monitoring possibly take? (Just between you and me I resolve that on January 1st I will again start reading all daily/weekly/monthly logs, and this year I WILL NOT FAIL. It's only dozen give or take few boxen.)
If the security infrastructure needs to designed, configured, monitored, and maintained by "experts" in an unfunded environment, the security infrastructure is doomed to fail. IOW, it's security theatre.
Yes, but that's A Bad Thing(TM) -- it means that MITM'ing a mail server also "works fine"!
Now, personally, I'm not a big fan of DNSSEC (especially considering how widespread 512- and 1024-bit keys were!) but I was hopeful that "DNS-based Authentication of Named Entities" (DANE) [0] would become widely supported once it was fully standardized. Unfortunately, that didn't happen -- especially in the browsers!
After the explosion in growth of "HTTPS everywhere", transport security for e-mail was the next big (unencrypted) problem that needed to be addressed in my opinion. Luckily, both Exim and Postfix (my MTA of choice) gained support for DANE so while progress was technically made, widespread adoption never really happened there either (mostly due to the dependency on DNSSEC, AFAICT).
In the meantime, though, "SMTP MTA Strict Transport Security (MTA-STS)" appeared on the scene and has since been formalized as RFC8461 [1]. In many ways, it's technically superior to DANE and, importantly, does not rely on DNSSEC. It does have the same reliance on the "WebPKI" as the browsers so it's certainly not perfect; it's still a huge improvement, though, and it's certainly better than opportunistic encryption which is trivial to MITM.
Anyways, as MTA-STS was designed by folks at Google, Microsoft, Comcast, and Oath, I'm hopeful, once again, that we'll eventually get to the point where (at least) the overwhelming majority of e-mail is encrypted in transit as it passes from MTA to MTA on its way to the recipient's mailbox.
One of the few good things about so much of the e-mail nowadays being handled by Google and Microsoft is the huge volume of mail that will suddenly just start being encrypted in transit, overnight, when just those two enable MTA-STS in their mail infrastructure.
I haven't kept up with progress on MTA-STS since leaving my previous job (which included responsibility for the mail infrastructure) about two years ago -- shortly after it became a standard -- but I'd love to find out that it's already been widely rolled out by the big players in the meantime! I suppose it's about time to catch up on the last two year's worth of messages sitting unread in the "mailops" folder in my mailbox!
--
[0]: https://en.wikipedia.org/wiki/DNS-based_Authentication_of_Na...
TLA cert authorities are bad enough. MTA-STS is would make running your own mailsever harder and leash you to one of a dozen cert authorities. If you don't think that's a problem then remember what happened to dot org, and think what will happen to these cert authorities given enough money and time.
I've run my own mailserver for a decade now and I am strongly against everything you suggest. But it doesn't matter what I care about. If everyone uses only one of a handful of email providers then they'll just slowly close off their walled gardens anyway. It's already happening no matter how many superfluous cargo-cult standards independent mailserver operators implement.
Also had my old workplace on .dev until those bastards at Google stole it and added the entire tld to the hsts preload list!!
I imagine you are confused because the proposal above sounds like "just get *.example.com, then copy that cert to everything that will ever serve traffic for example.com", which doesn't sound like a great idea to me.
Can you recommend a good book or blog series that covers this topic in depth?
They didn't steal it. You'd hijacked it, and your hijacking failed. Go big or go home. The IETF hijacked the OID arc 1.3.6.1 and they succeeded because everybody accepted their control of that arc and it's now used everywhere, but if you hijack some namespace and then only use it on a few dozen machines nobody has heard of, that's not going to stick.
More seriously, what you've done is probably a bad idea. https://myprinter.lan/ seems unique to you, and then your new partner moves in, why doesn't the printer work? Oh right, his printer is also named myprinter.lan because you don't have globally unique namespaces.
This happens on a bigger scale at a business or other organisations of course, but it's annoying even in one household. Here's a metaphorical nickel kid, get yourself a domain in the public DNS hierarchy.
Jokes aside, isn't this what .local and .localdomain are specified for?
Why not use nickname.local as your namespace?... it's probably unique enough at least on this planet.
Of course another way would be to register one gTLD for each person on the planet, which seems to be the trend as of late /s
It's completely acceptable to use .local. in such a manner, however.
The "conflict resolution" process is outlined in the RFC [0] and is, well, pretty simple:
> ... the computer (or its human user) MUST cease using the name, and SHOULD attempt to allocate a new unique name for use on that link.
You can even set up your own DNS servers to be authoritative for the ".local." domain (zone), if you really want to.
RFC6762 states that "any DNS query for a name ending with '.local.' MUST be sent to" 224.0.0.251 (or ff02::fb) -- but it also explicitly allows sending them to your regular ol' (unicast) DNS servers, too. It's up to you to figure out how to manage that, of course.
Now, that said... to avoid any potential issues, I'd only ever use .local for its intended purpose. There's just too much potential for "weirdness" to occur. Personally, however, I completely avoid any use of either (.local and Multicast DNS) regardless.
--
On a side note, ".localdomain" mentioned in the grandparent comment should actually be "localhost."
--
I have plenty of public domains. .lan is short and easy, hence my preference for it.
Ideally there would be one or two private tlds codified just as there are private ip ranges (my hypothetical partner could also add random devices with conflicting IP, businesses have problems with conflicting IP/subnets often, these are just problems that need to be solved through proper organisation, so I fail to see why dns is somehow different).
There are several, in fact.
RFC8375 [0] states:
> This document registers the domain 'home.arpa.' as a special-use domain name [RFC6761] [1] ... 'home.arpa.' is intended to be the correct domain for uses like the one described for '.home' in [RFC7788] [2]: local name service in residential homenets.
In addition to "home.arpa.", there are several other domain names listed in IANA's "Special-Use Domain Names" registry [3] that "users are free to use ... as they would any other domain names" -- even if they are technically intended/reserved for other uses.
For as long as I can remember, I've used a subdomain of one of my registered domain names for everything in my home network. That has the advantage of, if and/or when desired, allowing me to do some "fancy tricks" (involving some combintion of DNS, VPN, and/or reverse proxying) to make specific internal/private resources available from the Internet.
--
[0]: https://tools.ietf.org/html/rfc8375
[1]: https://tools.ietf.org/html/rfc6761
[2]: https://tools.ietf.org/html/rfc7788
[3]: https://www.iana.org/assignments/special-use-domain-names/sp...
Is running an internal OAuth OIDC identity provider to issue signed identity tokens the same as using cleartext passwords?
Your typical TLS certificate is going to be more robust than your typical consumer / prosumer LAN security, and you typically have better tools (SSH certificates, 2FA, encryption at rest, etc, etc) for locking down a machine running a CA than network gear you either don't control or bought from a consumer-focused vendor.
Its a typical example of defense-in-depth. Hopefully your network is trustworthy, but if for whatever reason it becomes insecure/vulnerable you now have genuine encryption between client and server at application layer.