News for hackers. Stuff that matters.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by InvaderFizz on Sunday October 24, 2021 @01:20PM (#28979970)
I was initially looking at this to see how they automated their Let's Encrypt and if it was better than just using Caddy. I was disappointed to find they are just creating a self-signed RootCA and issuing certs.

  > Now if you go into Chromium browser settings and search "certificates", in the Security tab, Manage Certificates, you can add an Authority. Import 'ca.pem'. Tell the browser to Trust this certificate for identifying websites. This should add 'org-test-ca' to your browser. This allows HTTPS certificates signed by that to be seen as valid in your browser.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by inportb on Sunday October 24, 2021 @01:25PM (#28980040)
This is how I automate LE (technically ACME/ZeroSSL) in my Nginx reverse proxy.

https://git.inportb.com/jyio/docker-nginx-auto

Basically, inotifywait on the config directory and request new certificates as needed. Grep the config files for hostnames (and ignore if labeled NOSSL). And a configuration snippet to include the same SSL config for anything that needs SSL (including the .well-known/acme-challenge directory). Oh, and use cron to renew periodically.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by InvaderFizz on Sunday October 24, 2021 @01:34PM (#28980133)
> inotifywait on the config directory

I like this idea. I'm going to start using this.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by inportb on Sunday October 24, 2021 @01:48PM (#28980251)
Just be aware that nginx needs a self-signed certificate in the very beginning, to serve the .well-known/acme-challenge directory. To simplify the initial setup, I include a default "snake oil" certificate, which gets overwritten.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by megous on Sunday October 24, 2021 @01:54PM (#28980310)
It doesn't. You can serve it over http.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by yjftsjthsd-h on Sunday October 24, 2021 @05:03PM (#28981895)
With apache2 httpd, you can of course serve the challenge over insecure HTTP, but httpd won't start if you say it should use a cert that doesn't actually exist, so for the sake of automated setup and not having to edit the config multiple times it's way easier to write a self-signed cert and then overwrite it with LE. I think the situation is the same with nginx but not 100% sure.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by megous on Sunday October 24, 2021 @08:27PM (#28983276)
You can use IfFile to gate the TLS part of the server until the certificate file exists, if you really don't want to edit your config files during TLS bootstrap.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by inportb on Sunday October 24, 2021 @09:24PM (#28983581)
The situation is the same with nginx. It's way easier to write a self-signed cert and then overwrite it with LE.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by ossusermivami on Sunday October 24, 2021 @05:27PM (#28982096)
I just use dns and acme.sh for that reason and not bother about it anymore
Re:Setting up a static HTTPS website on your Raspberry Pi us... by inportb on Sunday October 24, 2021 @01:58PM (#28980351)
Interesting! Thanks for pointing that out.

Though... I think I'd still include the snake oil cert and serve everything over SSL, because it simplifies the configuration.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by jonasal on Monday October 25, 2021 @03:53AM (#28985400)
How I solve this is that I deactivate all configuration files that have missing certificates, and then reactivate them again after the files have been created.

https://github.com/JonasAlfredsson/docker-nginx-certbot

Re:Setting up a static HTTPS website on your Raspberry Pi us... by windexh8er on Sunday October 24, 2021 @06:03PM (#28982356)
> I was disappointed to find they are just creating a self-signed RootCA and issuing certs.

Agreed. Not sure why you'd go through the trouble of importing a self-signed CA when you can provision certs for any internal service with LE. I dont use self-signed and instead have been using LE certs provisioned for internal services for the last couple years. Extra nice to be able to leverage DNS challenge for cert provisioning at home to get around overloading common ports.

I know a lot of people mention Caddy but I find Traefik [0] (pronounced "traffic") more flexible. It's routing and middleware configurations are fantastic. Especially when you want to stick a reverse proxy in front of things that are a pain to provision certs into (switches, routers, old embedded web interfaces, etc).

[0] https://traefik.io/traefik/

Re:Setting up a static HTTPS website on your Raspberry Pi us... by rain1 on Monday October 25, 2021 @01:57AM (#28984839)
didn't know you could do this with LE. Good tip. Although this seems quite complicated to do.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by aaomidi on Monday October 25, 2021 @06:05AM (#28986115)
A lot of webservers now have ACME built in and you can just have it automatically handle the entire certificate life cycle.