π Feature Request - Automatic SSL certs with mkcert
the0neyouseek opened this issue Β· comments
Hi @typicode !
First and foremost, thanks for the useful tool. I use it almost every day at work and it's been amazingly great so far, kudos π !
Would it be possible to integrate something such as @FiloSottile/mkcert to have automatic ssl certs generated when we add
or remove
a server ?
I've done it manually (replacing cert.pem
and key.pem
in the .hotel
dir with the mkcert
generated ones) and it's working perfectly but I would prefer for it to be automated/built inβ¦
Thanks and have a nice day !
@the0neyouseek Hi, this feature came into my mind 2 years ago. And I remember it was also mentioned in other quite a few issues as well. That was why I started this alternative tool and started using it since.
https://github.com/layerssss/localhostd
It has gone through my own trial and fixes these 2 years and had a few additional features including trustable SSL built in. So I'm now inviting everyone to try it as well.
I've done it manually (replacing
cert.pem
andkey.pem
in the.hotel
dir with themkcert
generated ones)
Which names did you use when creating the cert with mkcert
? I tried *.localhost
, but that doesn't work, since wildcards on TLDs aren't supported.
@shreyasminocha Here's the command I've used :
mkcert localhost 127.0.0.1 hotel.localhost <name-of-project>.localhost
followed by any domain where I need ssl.
It's a bit of cumbersome process to do this manually and I would prefer it if hotel generated the cert itself on every domain creation/removal but it works.
@the0neyouseek Thanks! I thought there was some shorthand that worked with all .localhost
domains.
It's a bit of cumbersome process to do this manually and I would prefer it if hotel generated the cert itself on every domain creation/removal but it works.
Agreed.
Here's a one-liner that works for me:
ls ~/.hotel/servers | sed -E 's/\.json/.localhost/g' | tr '\n' ' ' | xargs mkcert -key-file ~/.hotel/key.pem -cert-file ~/.hotel/cert.pem 'localhost' '127.0.0.1' '0.0.0.0' 'hotel.localhost'
One could potentially hook this up to some filesystem watcher and run it each time new files are added to ~/.hotel/servers
. Kinda hacky, but works π€·ββοΈ.