typicode / hotel

🏩 A simple process manager for developers. Start apps from your browser and access them using local domains
MIT License
9.98k stars 426 forks source link

πŸ”’ Feature Request - Automatic SSL certs with mkcert #309

Open the0neyouseek opened 6 years ago

the0neyouseek commented 6 years ago

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 !

layerssss commented 5 years ago

@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.

image

Screen Shot 2019-06-20 at 3 58 58 PM
shreyasminocha commented 5 years ago

@the0neyouseek

I've done it manually (replacing cert.pem and key.pem in the .hotel dir with the mkcert 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.

the0neyouseek commented 5 years ago

@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.

shreyasminocha commented 5 years ago

@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.

shreyasminocha commented 4 years ago

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 πŸ€·β€β™‚οΈ.