Easy HTTPS for your private networks
getlocalcert.net
getlocalcert.net
I was kicking around the idea for an rfc that would be something like this. Your DHCP server would have an option to act as a CA (or point at one), with ACME protocol enabled. Then, you add DHCP option fields telling clients to trust this new CA certificate, but only for hosts on this local network (to avoid being able to MITM outside connections). Then clients on this network would be able to request certificates from the CA using ACME automatically and others on the network would automatically trust them assuming support for this standard was added the OS or browsers etc.
On servers, certmonger can do scep iirc. On private infrastructure, FreeIPA provides a packaged dogtag and you can create your own certificate profiles. Clients enrolled in freeipa have certmonger installed to refresh certificates.
Uhh...
> [...] ejbca [...]
Now you have two problems.
What I mean is, if you’ve been already running EJBCA for whatever reason then this is perhaps reasonable, but if your current setup is at the level of typing `openssl req` into a terminal (whether that’s a good idea or not), it sounds like a lot of additional complexity. (Can’t say anything about dogtag.)
I’ve been waiting forever for somebody to add an ACME backend to the Go SCEP library[1], but it doesn’t look like that has happened. In the meantime it includes a fairly competent standalone CA server at the abovementioned invoke-openssl-by-hand level.
Note that SCEP basically requires a trusted network, though, from what I remember.
If I see usage like this, there's ways I can make this cleaner.
...rather than to get an actual certificate.
I didn't dig past the front page, but as far as I can see, they don't issue HTTPS certs at all, easy or oherwise; they offer managed DNS subdomains. You want a cert, you have to get it somewhere else.
But you're right. Issuing Let's Encrypt certificates on behalf of users could simplify the process even more.
[1] https://docs.getlocalcert.net/acme-clients/#setting-txt-reco...
Solved for both Windows and Linux (Debian, Arch, Fedora). I might have unlikely solved this of OSX as well, but I am not buying Apply hardware just to test it.
What my solution does is check for certificates created by the project during a build step. If the certificates don't exist it creates them, installs them in the OS, and also installs them in the browser. Installation in the browsers is required in Linux and only for FireFox in Windows. These are cert chains containing a self-signed root, intermediary CA, and a local domain cert.
I have these certs configured to work with my own domains so that I can connect to a subdomain addressed to a loopback IP and the cert recognizes that domain, but the domain "localhost" works as well. Sometimes its nice to access a real domain to avoid any restrictions imposed upon accessing address "localhost". You just have to change the domains at the bottom of your OpenSSL option files.
Here is how I solved it with vanilla TypeScript in Node.js (also requires locally installed OpenSSL):
* OpenSSL option file 1 - https://github.com/prettydiff/share-file-systems/blob/master...
* OpenSSL option file 2 - https://github.com/prettydiff/share-file-systems/blob/master...
* Certificate library - https://github.com/prettydiff/share-file-systems/blob/master...
* Certificate interface from build tool - https://github.com/prettydiff/share-file-systems/blob/master...
* Certificate installation - https://github.com/prettydiff/share-file-systems/blob/master...
If you have any questions just open a Github issue on the project.
1. Buy your own public domain (such as companyname.dev)
2. Setup a LetsEncrypt wildcard certificate with DNS validation
3. Update your /etc/hosts to something like `127.0.0.1 companyname.dev`
We have this working with multiple developers, each renewing their certificates themselves. Works great, it's simple, and don't need to trust an extra third party.
Typically free domain name services are full of spam, malware, and other junk. getlocalcert seeks to avoid that as it only permits private network usage. My hope is that this model can serve that niche while avoiding abuse.
Operational costs are low: around $40/year in domains and $20/month in servers. Soliciting donations could probably cover that (some similar free services work that way).
acme-dns let's you add a CNAME to another DNS zone, which let's you issue certificates for the former domain name using a convenient API for the latter zone. Seriously read about it, it's awesome.
https://github.com/joohoi/acme-dns/
That tool is open source and self-hostable. getlocalcert also provides this feature, but as a hosted service. Choose the method you prefer.
https://docs.getlocalcert.net/tips/validation-domain/
Once DNS-01 is easy, wildcard certs are easy. Here's the docs for setting up a wildcard cert via getlocalcert: https://docs.getlocalcert.net/acme-clients/lego/
This service looks like the same thing. I guess if you're limited to certain then you can only do what it does, but I'm guessing there's lots of alternative software that'll do the DNS challenge if you look.
We haven't needed to copy the certs around the LAN. It works fine with dev's just individually running certbot renew as needed.
Yes, it tooks us a fair bit of fiddling around to work out how to do it, but final result is super simple. So I definitely would have considered a project like this in the past, but now we've got the scripts for it, it's pretty simple.
127.0.0.1 client7.companyname.dev our-amazing-product.companyname.dev postgres2.companyname.dev
So, then we can use the same settings, etc across devs.
Then each dev just runs the script to renew the script as they are needed (no need to share certs between devs)
[1] https://github.com/schlarpc/rfc2136_bridge/blob/main/src/rfc...
Our local-cloud program connects to our "certificate server", and asks for a name/ip combination.
Our certificate server gets it using API access to our "local-cloud" domain. The local machine receives it.
So the end user does not have the Domain credentials. They have credentials to our cert server, but those have very limited value (and would need to be decrypted first.)
I have a workflow for creating AWS credentials that are restricted to doing the LetsEncrypt DNS challenges for just a single sub-domain, and that seems to be working well. https://linsomniac.gitlab.io/post/2019-09-10-letsencrypt-wit...
Most of the time, you really shouldn't need this, and your local HTTPS development should just require:
mkcert -install
mkcert localhost
In the directory of your app, etc.If you're deploying private applications, these records should exist in your intranet DNS resolver instead.
$ export NAMESILO_API_KEY=...
$ export NAMESILO_POLLING_INTERVAL=10
$ export NAMESILO_PROPAGATION_TIMEOUT=1800
$ export NAMESILO_TTL=3600
$ lego --email <email> --dns namesilo --domains *.<domain>.com run- Setup Tailscale on the server and personal device
- Deploy apps (self hosted tools that I use) on the wireguard interface created by Tailscale
- Deploy caddy as a reverse proxy for all these tools and use `.internal` domain
- Use Adguard's DNS rewrites feature to answer custom DNS response for specified `.internal` domains. The A record contains the IP assigned by Tailscale (wg0 interface) for that device.
The Caddyfile is as simple as:
http://miniflux.karan.internal {
reverse_proxy 127.0.0.1:3000
}
Using this setup, as soon as I connect to Tailscale, I can access `miniflux.karan.internal` on a secure encrypted network without worrying about configuring HTTPS for local domains or renewing SSL certs.It is straightforward to create your own Root CA and use it to sign certificates for your private network, using openssl.
Ensure that you implement the V3 extensions with @altnames, for the certificates you issue, with a "DNS => <FQDN>" (or you can use an IP address instead of FDN. I have not experimented with that). .local domain names work fine
If you do not implement "@altnames" the certificate will work for tools like curl, wget "openssl s_client", but not for browsers. (In my notes some place I am too lazy to go and read there is a reference to the RFC that documents that you do not have to use the subject/CN, mēh)
There are other tools (than openssl) that do this to.
Using this service means you really do not have a private network
Even still, there are a lot of folks happily using private CAs, they aren't the target audience for this initial release.
[1] https://github.com/FiloSottile/mkcert/issues/302
[2] https://github.com/cert-manager/cert-manager/issues/3655
[3] https://alexsci.com/blog/name-non-constraint/
[4] https://github.com/Netflix/bettertls/issues/19
[5] https://docs.aws.amazon.com/privateca/latest/userguide/secur...
You might get away with installing your RootCA on your in-office PCs that you own.
Good luck though getting me to install it on my (external contractor) laptop or my (employee) phone, or my (hosted) VMS machines. -you- may plan to only use the CA for good, but I don't trust you (and by extension all your IT staff, present, past, and future) to be angels.
OpenSSL for example uses a custom pem file that the program developer supplies.
I cannot see how. Do you mean as a specific attack on a computer with the private Root CA installed, if the attacker gets their hands on the Root CA private key?
Still very convoluted. I cannot see the problem, beyond some very special cases.
I think the risk of leaking internal domain names is real, but overblown. If you find a vulnerable internal service via CT logs you still need to connect to the private network to exploit it. If you're connected to the private network, you could have enumerated subdomains many other ways. Early knowledge of vulnerable subdomains can speed up an attack or target selection, but this is still a two step process. Most subdomains are pretty boring anyway; it's not surprising to learn that $corp has subdomains like webmail, wiki, etc. These names don't leak version or brand information.
I was playing with the idea of doing CT log poisoning, where you register and renew certificates for decoy subdomains along side your real subdomain names. If you add enough noise, CT logs are no longer useful for enumerating private subdomains.
Those sort of problems are common, true. That is saying that competence is rare in computing.
That is not surprising given the almost complete lack of accountability in this space.
A root CA leak is hard to detect, has tremendous consequences, and adding limitations to the cert (TLD/domain) don’t work across every OS.
OTOH, leaking the existence of your private services (which are likely inaccessible over the internet for the general attacker) is a much smaller risk, and can be contained with wildcard certs as a workaround.
I guess I'll be the one to say it: many people, myself included, get intimidated by using OpenSSL. The CLI has a bunch of different options and dealing with the inherent complexity of a PKI makes it all a bit of a mess: where you try to find the right invocations for whatever you need to do online and even then aren't sure whether everything is done correctly.
At least that mirrors my own experience in the past and that of most folks I've talked to, both in private and prod projects. That's why I personally find software like Keystore Explorer actually decent for even things like running your own CA (probably for a small homelab, where you don't need automation): https://blog.kronis.dev/tutorials/lets-run-our-own-ca
And yet, even then I don't have the confidence that I've done things the "right" way, frankly probably not. That's even before you get into things like staying on top of CVEs and keeping everything updated - overall staying safe is very challenging. There's probably also the need to configure a web server, like Apache with SSLCACertificateFile and just plenty of things to go wrong along the way, especially if you need mTLS as well.
> Using this service means you really do not have a private network
That's a fair point, though!
Unsurprising. It is intimidating. I think a bit old fashioned in that sense. Once was a time when men were men because they could configure sendmail. All a bit silly really.
There are other alternatives. Too few, tho. It took me a week to work it all out using OpenSSL.
It's like saying that having a chair is unnecessary because you have a log, an axe, a saw, etc, and can build a sit to your liking when need be.
The thing is that when the need actually comes to be, you want a seat right now and of a known working kind, and strongly prefer a comfortable one. So thank the carpenter.
The thing is when you are securing a network you are building things with powerful tools.
Thing is using powerful tools can backfire badly.
That was my exact problem, an why I learnt this.
It is easy to install and easy to remove from an iOS device.
I've never had success with local CAs and self-signed certs on iPhone, despite going through the whole rigamarole of creating and installing an MDM profile with the trust root. Even after doing that, apps and Safari behave as if the certificate was untrusted. Is there some documentation you've successfully used and wouldn't mind pointing to?
Download the certificate, import/install it, and then do this: https://support.apple.com/en-us/HT204477
Unfortunately that's the hard part - getting Firefox/chrome/edge/safari and is/libc/curl to all trust the ca. It's a little easier on Linux, but still convoluted.
And with an actual trusted CA the trust is way too wide (every domain).
Not to mention revocation lists and certificate renewals (and revocation s) ...
Dedicated letsencrypt "internal" domain is probably the sweetspot for most uses these days.
Maybe a serviceN.int.example.com where int.example.com allows for dynamic DNS updates/DNS challenges.
I've been thinking about setting up powerdns/coredns/knotdns with rfc dynamic updates for a dedicated internal domain - but for now tailscale with magic DNS mostly fills the need (unfortunately not with ssl for all k8s internal services, "only" VPN).
https://github.com/joohoi/acme-dns/
https://docs.getlocalcert.net/tips/validation-domain/#self-h...
So I just pull in stuff from LetsEncrypt.
Yes, I know, I'm small potatoes, and that would require a very targeted attack, but the idea still bothers me.
However, my paranoia level is high.
I've usually seen DANE paired with DNSSEC, and on the internet it feels required. DANE on an air gapped network is new to me, do you just skip the DNSSEC part? I'd be fearful of joining a network that puts bogus DANE TLSA records for google.com, for example.
Browser support for DANE is at 0%, unfortunately.
DNSSEC works in an air gapped network when you deploy your own trust anchor in your DNS. I wouldn't touch a domain name that you don't own yourself (like google.com) but instead only use a domain name you purchased.
It surprises me that DANE is even listed on caniuse.com! I expected it to be way to exotic to be on that list. I'm under no illusion that browsers are going to support this anytime soon unfortunately.
Now let's hope I didn't wake up tptacek to lecture us on how DNSSEC is bad and how it will eat your children. ;)
The only problem is that I have to maintain a list of DNS entries for the StepCA container as extra hosts. I haven’t found an elegant solution for this part.
* https://github.com/joohoi/acme-dns
If your DNS provider has an API, you can hook into that for internal-only web servers; this handy code supports several dozen APIs so you don't have to re-invent the wheel:
* https://github.com/AnalogJ/lexicon
* https://pypi.org/project/dns-lexicon/
* https://dns-lexicon.readthedocs.io/en/latest/user_guide.html
It's inspired by ACME DNS, but getlocalcert is actually using PowerDNS with a Django API that's compatible. I originally built the tool as a fork of acme-dns, but lost traction somewhere, I switched to pdns and it worked great.
* own CA, to be distributed to all systems via Ansible playbook or Dockerfile directives
* Hashicorp Vault with enabled PKI engine
* Ansible Hashivault module [1]
* Ansible role & playbook to tie it all together
* CI enviroment for automated deployment of SSL certs to target systems
Works flawlessly once set up, including restart/reload of affected services. Might do a writeup on my personal blog at some point.
[1] https://github.com/ansible-collections/community.hashi_vault
It's just as easy to deploy a trusted CA using MDM as it is to deploy this.
Re. MDM, I've never seen a perfect rollout.
For services I host on my Tailscale/Headscale network, I just use DNS challenges. With Cloudflare and Caddy, it's as straightforward as adding:
tls { dns cloudflare {env.CLOUDFLARE_AUTH_TOKEN} }
to the site's configuration in the Caddyfile
If you don't have access to install the root certificate then by definition you don't control the private network, simple as that.
> when you want to share the application with others
This is literally the definition of no longer a "private network".
The encryption HTTPS provides isn't important if you trust your network. However server authentication is important if your devices move between networks (phone, laptop, etc). Applications don't know you switched networks, they just want to connect and will happily send sensitive data to an attacker if you ever connect to a malicious network. There was an example of `git push` leaking the entire commit history mentioned on HN not too long ago.
The problem with your security model is that you assume your private network is flawless. Do you really think you can trust every device that connects to your network to be secure? Including your Wi-Fi router? Because I don't, even for devices I personally bought. Even less so in a corporate setting.
Wildcard letsencrypt + internal DNS means you don't leak anything and you don't have to deal with the awkwardness of installing certificates.
I've seen certbot take 1+ hour to install on GCE micro VMs because it's so bloated. I've tried implementing the ACME protocol to avoid needing to use it, but it's one of the most byzantine processes I've seen. Let's Encrypt takes so much leverage from the edge to give us something that costs a latte. It's how freedom dies.
Inconvenient? Maybe. Security rubs against the grain of convenience, true
It gives you a https url for localhost by using your browser as a reverse proxy.
Take a look: https://tabserve.dev
I wrote about that here:
https://blog.katarismo.com/2023-06-04-expose-any-private-ser...
All my internal and external services inside and outside of my headscale/tailscale network can use a single cert this way. I generate a single cert and then reuse it everywhere.
on connect, a user is presented with an option to preselect a wifi network and input their geographic location. I managed to stuff a zip code lookup table into the code, but lat/long is really cumbersome to input, and using the phone's location sensor requires an HTTPS server
mongo.mydomain.com {
reverse_proxy 127.0.0.1:27017
}Doesn't this only work for HTTP too? It may work with MongoDB because it talks HTTP through TCP 27017, but PostgreSQL, for example, has a proprietary protocol on TCP 5432.
>Displays somewhat overcomplicated diagram with bunch of arrows and scary technobubble words.
Ping me again when HTTPs actually becomes easy
[1] https://blog.viktorpetersson.com/2022/12/23/securing-service...
Second, if it's private, surely you can just use your own Certificate Authority, instead of paying a tax to be listed on someone else's Certificate Authority.
Also, HTTPS with a public CA just works on most systems, whereas IPsec requires Client configuration. It's still easier to roll out than switching from IPv4.
For personal or experimental things, I may use a local CA, but getting certificates for the internal subdomains of my company is trivial when you already got a public domain on a Server that's capable of using DNS-01 challenges.
Enabling HTTPS is just way easier than actually ensuring you can trust your local network. Many real-life middle-class companies start out with just having a network and not thinking about security at all. Some companies may even have untrusted internal networks by choice by allowing BYOD.
Either write your own code or choose your dependencies more carefully.
PCI compliance among many other regulatory issues. You will be required to show that data is not only encrypted at rest but is encrypted through your entire transport chain regardless of any physical security. The threat model assumes that an attacker is able to temporarily access network resources undetected and can use simple sniffing tools to egress sensitive data. This will not be optional.
Are you suggesting that regulations make it so that everything should be a slow and inefficient https webapp?
trick question: you can't
even the network links between hosts in a single rack in a DC can be vulnerable
unless it's in your home, it's not trustable
They require your fingerprints for entry and everything is heavily monitored.
You can even get a stealthy cage if you don't want anyone to be able to see what kind of network equipment you have.
there was this whole thing with edward snowden a few years ago, maybe you remember?