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.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by ThinkBeat on Sunday October 24, 2021 @01:57PM (#28980342)
Do it 90s style.

Install apache (or nginx or lighttpd) on your box using your distros package manager of choice.

Configure https on apache.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by LeoPanthera on Sunday October 24, 2021 @02:22PM (#28980579)
Seriously. Adding a docker layer to a device as lightweight as a Raspberry Pi just seems like insanity.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by 404mm on Sunday October 24, 2021 @02:37PM (#28980709)
It doesn’t really. Don’t confuse docker with a virtualization layer. Well made containers bring just the processes you’d be running anyway.

I run a few containers on my RPi and cannot tell a difference in performance.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by SahAssar on Sunday October 24, 2021 @02:44PM (#28980767)
I agree if the container brings any benefits. In this case there is nothing that a standard distro-packaged apache/nginx wouldn't do. There is no automation of build steps, lets-encrypt or similar.

Installing docker and running that daemon for just this is not the right way.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by nuerow on Sunday October 24, 2021 @05:11PM (#28981963)
> Seriously. Adding a docker layer to a device as lightweight as a Raspberry Pi just seems like insanity.

Your definition of insanity is perplexing. Docker in this context is pretty trivial to setup and run, and it's used mainly to manage packaging and deployment. Do you happen to have any experience at all with Docker?

Re:Setting up a static HTTPS website on your Raspberry Pi us... by LeoPanthera on Sunday October 24, 2021 @06:47PM (#28982648)
Yes, and it's doubly pointless here, because it isn't doing anything that couldn't be done better by the OS's own package manager. Better, probably, because you will get timely security updates.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by nuerow on Monday October 25, 2021 @04:09AM (#28985500)
> Yes, and it's doubly pointless here, because it isn't doing anything that couldn't be done better by the OS's own package manager.

No, not really. With Docker, packaging is a solved problem, and you also get for free a deployment history which you can roll back and forward at will. You also get introspection and blue/green deployments, and if you really want to you can also setup a cluster of nodes for free where you can run whole application stacks with a one-liner.

There is really no excuse to do things the hard way.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by patrakov on Monday October 25, 2021 @02:35AM (#28985016)
It still does have a non-zero cost, especially in the long run, when security vulnerabilities pop up. With distribution package management, on Ubuntu, you can rely on your Nginx being updated and restarted automatically while you sleep. With Docker, you need to subscribe to a security mailing list in order to know about the vulnerability in the first place, and then run some commands manually that re-create the container.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by nuerow on Monday October 25, 2021 @04:05AM (#28985472)
> It still does have a non-zero cost, especially in the long run, when security vulnerabilities pop up.

It really doesn't. Unless you were planning on doing a one-and-done deployment, it's trivial to update and redeploy Docker images. Even in my side projects I have CI/CD pipelines updating and redeploying Docker images daily.

> With distribution package management, on Ubuntu, you can rely on your Nginx being updated and restarted automatically while you sleep.

Whatever you can do with Ubuntu, you can do precisely the same with Docker when running a base image of Ubuntu.

> With Docker, you need to subscribe to a security mailing list in order to know about the vulnerability in the first place, and then run some commands manually that re-create the container.

No, you really don't. Just pull the latest base image, build your images by calling apt to update your dependencies, and you're done.

Whatever you can do with a bare metal/VM install, you can do with Docker.

There is nothing magical stopping you from doing the basic stuff with Docker.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by capableweb on Monday October 25, 2021 @04:50AM (#28985771)
patrakov is talking about updating the docker daemon/engine (that runs on the host), not the images that you run with docker.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by patrakov on Monday October 25, 2021 @05:26AM (#28985925)
Nope, I was talking about the images. More precisely, about knowing when to update them.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by Gigachad on Monday October 25, 2021 @03:06AM (#28985163)
Docker is extremely light weight and I wouldn’t have any concerns about running it on an rpi
Re:Setting up a static HTTPS website on your Raspberry Pi us... by schwartzworld on Sunday October 24, 2021 @01:24PM (#28980009)
It seems like a lot of work to serve a static site over your local network. How is this different from running `python -m SimpleHTTPServer`?
Re:Setting up a static HTTPS website on your Raspberry Pi us... by capableweb on Sunday October 24, 2021 @01:58PM (#28980352)
For development I'm sure SimpleHTTPServer is fine for most use-cases (except SPAs, of course), but for more serious use, nginx and SimpleHTTPServer couldn't be more different.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by suprfsat on Sunday October 24, 2021 @02:07PM (#28980434)
Doesn't involve installing an obsolete version of Python.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by schwartzworld on Sunday October 24, 2021 @04:46PM (#28981741)
I just meant if you aren't exposing it to the outside world, why not use any other server? Curious about the real advantages.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by oynqr on Sunday October 24, 2021 @04:54PM (#28981803)
python -m http.server

ok fun guy

Re:Setting up a static HTTPS website on your Raspberry Pi us... by butz on Sunday October 24, 2021 @01:25PM (#28980032)
Why even use docker for a static website server?
Re:Setting up a static HTTPS website on your Raspberry Pi us... by NortySpock on Sunday October 24, 2021 @01:40PM (#28980176)
Your docker-compose file becomes configuration-as-code, and it's a one-line change to set up different websites on different ports.

Sure, I could install lighttpd myself, but docker-compose gives me a common configuration file format.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by nimbius on Sunday October 24, 2021 @01:42PM (#28980206)
Docker is a hard dependency if you need your article on the front page of HN.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by antongribok on Sunday October 24, 2021 @01:32PM (#28980112)
To learn a bit about Docker?
Re:Setting up a static HTTPS website on your Raspberry Pi us... by oblak on Sunday October 24, 2021 @02:08PM (#28980444)
Spawn a VM instead of mutilating your Pi?
Re:Setting up a static HTTPS website on your Raspberry Pi us... by capableweb on Sunday October 24, 2021 @02:57PM (#28980865)
Hacking is called mutilating now? Give the guy/girl a break. I don't think this is meant to be a production setup so whatever is fine, and you can always reflash it if needed so not sure I'd call this "mutilation"
Re:Setting up a static HTTPS website on your Raspberry Pi us... by yrds96 on Sunday October 24, 2021 @01:30PM (#28980100)
"One command" production ready server
Re:Setting up a static HTTPS website on your Raspberry Pi us... by readingnews on Sunday October 24, 2021 @02:00PM (#28980376)
I totally disagree with this reply, and agree with the thread starter... I really, really do not see the point of this.

One command? Did you read the github page?

At the end, this doc even has you hand editing your nginx for SSL?!? Why on earth... why not just use certbot automation? This seems totally counter to the idea. Again, am I being dense? Is this just "look what I can do with docker that makes my life more complicated"? Honestly, at this point it feels like more work for less output.

This seems way harder than installing nginx and certbot, and now I have a hard dependency on docker and whatever else you pulled in.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by marginalia_nu on Sunday October 24, 2021 @04:49PM (#28981765)
Seems like optimizing a thing that's already pretty quick and easy to set up (and using docker and similar does not mean you don't need to understand how nginx works).
Re:Setting up a static HTTPS website on your Raspberry Pi us... by megous on Sunday October 24, 2021 @01:56PM (#28980329)
You mean like `apt install nginx`? :)
Re:Setting up a static HTTPS website on your Raspberry Pi us... by codegeek on Sunday October 24, 2021 @02:10PM (#28980467)
I am not a fan of docker for everything but 'apt install nginx' would not give you https out of the box. I am beginning to like Caddy which comes with https enabled but I have never used it in production yet.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by megous on Sunday October 24, 2021 @08:21PM (#28983245)
If you want https you can just run certbot. It will bootstrap the nginx config. I dislike programs that change the configuration automatically, and thus run dehydrated instead of certbot, but running apt install nginx certbot and some certbot incantation to make it bootstrap your domains is not really any more bothersome, than having to figure out how docker works, and how to manage changes to my nginx config with it over time, etc..
Re:Setting up a static HTTPS website on your Raspberry Pi us... by capableweb on Sunday October 24, 2021 @01:10PM (#28979855)
Tangential at best: where can you get a hold on a Raspberry Pi 4 in Europe? Every store is sold-out and the ones that aren't only allow one per customer.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by horsellama on Sunday October 24, 2021 @01:15PM (#28979919)
Re:Setting up a static HTTPS website on your Raspberry Pi us... by capableweb on Sunday October 24, 2021 @01:20PM (#28979974)
> This product is limited to 1 per customer
Re:Setting up a static HTTPS website on your Raspberry Pi us... by horsellama on Sunday October 24, 2021 @02:11PM (#28980473)
Oops, sorry didn’t notice that they are doing this now. I’ve bought some at few weeks of distance tho (a zeroW and a 3B)
Re:Setting up a static HTTPS website on your Raspberry Pi us... by geerlingguy on Sunday October 24, 2021 @01:58PM (#28980354)
Most people just need one, fortunately.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by capableweb on Sunday October 24, 2021 @02:01PM (#28980380)
Sure, that's probably true. Wasn't what I asked for in my original comment though :)
Re:Setting up a static HTTPS website on your Raspberry Pi us... by emilfihlman on Sunday October 24, 2021 @04:46PM (#28981745)
https://www.verkkokauppa.com/fi/product/57364/mndkd/Raspberr...

You might want to also grab the sd card from there.

I recommend getting the power supply, case and fan from Digikey.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by kzrdude on Sunday October 24, 2021 @01:36PM (#28980145)
Why are pis so often limited like this, is it a requirement from the foundation? Just curious.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by deadbunny on Sunday October 24, 2021 @01:41PM (#28980192)
Demand outstrips production. Especially with a chip shortage and lots of people stuck inside lookin for projects.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by kzrdude on Sunday October 24, 2021 @05:47PM (#28982242)
So why does the retailer benefit from limiting like this? To sell more starter kits etc?
Re:Setting up a static HTTPS website on your Raspberry Pi us... by butz on Sunday October 24, 2021 @01:26PM (#28980052)
Are there any other, more available cheap boards, that could run a simple web server?
Re:Setting up a static HTTPS website on your Raspberry Pi us... by rolph on Sunday October 24, 2021 @02:22PM (#28980575)
ive reflashed old routers with openWRT into a server cluster, they are a lot more portable, quiet and power efficient, of course this doesnt scale up well as the hardware has its limits. keep in mind you dont have to host the entire website on one server, so you can balance the load that way if you need to.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by oynqr on Sunday October 24, 2021 @05:00PM (#28981868)
Check out some of the supported boards for armbian, nanopis are usually pretty cheap and decent enough.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by yjftsjthsd-h on Sunday October 24, 2021 @05:11PM (#28981967)
It's a bit more work, but for single-digit quantities you could just buy one per store from a bunch of vendors, possibly repeating weekly or whatever until you get the desired number?
Re:Setting up a static HTTPS website on your Raspberry Pi us... by megous on Sunday October 24, 2021 @01:58PM (#28980349)
Re:Setting up a static HTTPS website on your Raspberry Pi us... by capableweb on Sunday October 24, 2021 @02:00PM (#28980374)
> Maximálně 1 ks na zákazníka.

Which I assume means something like "This product is limited to 1 per customer"

Re:Setting up a static HTTPS website on your Raspberry Pi us... by pzduniak on Sunday October 24, 2021 @02:21PM (#28980574)
https://botland.com.pl will sell you up to 10.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by capableweb on Sunday October 24, 2021 @02:54PM (#28980842)
Thanks, looks like a nice choice! Unfortunately they only have 2 (4GB model, rest is out of stock) in stock at the moment ("Available quantity: 2" it says), but will keep an eye for when they get re-stocked.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by jsisto on Sunday October 24, 2021 @02:11PM (#28980470)
I accomplish this with raspberry pi + docker + swag https://docs.linuxserver.io/general/swag
Re:Setting up a static HTTPS website on your Raspberry Pi us... by kaycebasques on Sunday October 24, 2021 @01:41PM (#28980190)
I'm ashamed that I was so naïve about this, but I was disappointed to realize that hosting a website to the entire public internet on my Pi was non-trivial. Of course once I dug into the idea it was obvious why it was difficult and furthermore that it would be a dangerous thing to do. Just sharing and curious if anyone has done it or knows useful documentation on the topic.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by dividuum on Sunday October 24, 2021 @01:50PM (#28980274)
It sounds like you Pi doesn't have a public IP address. So you need some way to tunnel requests to it. On solution would to be SSH into one of your own public boxes somewhere and use reverse port forwarding (-R). Although that's probably not very reliabile on its own as you have to make sure the connection stays alive. More professional solutions are probably ngrok or cloudflare tunnel. The latter is meant exactly for what you describe: expose a service on a private machine as a public facing web site.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by capableweb on Sunday October 24, 2021 @01:59PM (#28980362)
Port forwarding from your router is another option, redirect all 443/80 traffic from the public interface of the router to your Raspberry, preferably on a separate VLAN and also firewalls on both your router and Raspberry before enabling that.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by patrakov on Monday October 25, 2021 @02:38AM (#28985023)
Some VPNs offer public IPs, too (and from some, even static IPs can be bought). E.g. PureVPN.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by 13415 on Sunday October 24, 2021 @01:47PM (#28980240)
Why was is complicated? I'm hosting https://talumriel.de for my German novels on a Rapberry Pi 3b, using Nginx and Letsencrypt with cryptbot. It's probably not super-secure, but the setup was very easy. I basically just followed one of the tutorials on the Net.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by miyuru on Sunday October 24, 2021 @02:31PM (#28980661)
Just FYI, your server is not reachable with the IPv6 address.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by 13415 on Sunday October 24, 2021 @03:00PM (#28980884)
Thanks. I think it's because of my router.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by oblak on Sunday October 24, 2021 @02:06PM (#28980421)
I've been hosting my application on a 3B+ for years. What makes the Pi different to any other machine that you have on your home network? Assuming you have a static IP, all you have to do is forward ports 80/443 (or whatever) to the right machine/ports.

They're great little machines for this exact purpose. No need to have a full blown PC serving trivial stuff. Only problem is, they use SD cards and eventually. I've had a quality 128GB card in mine that has died/been corrupted about 3 times in 4 years. That's my biggest issue with these amazing little machines

Re:Setting up a static HTTPS website on your Raspberry Pi us... by rain1 on Sunday October 24, 2021 @01:56PM (#28980325)
This guide is just for hosting locally. If you want to host to the outside internet you also need to do port forwarding on your router. So that when someone connects to your outside IP your router relays that to the pi specifically.

It's not super dangerous, just make sure you keep everything updated (your linux OS, your server software). And make sure that you only open the ports you need to.

Re:Setting up a static HTTPS website on your Raspberry Pi us... by chuchichaestli on Sunday October 24, 2021 @05:46PM (#28982235)
Instead of opening ports on your firewall, you could introduce a mesh. I'm using nebula by slack, rest is 90's style with apache /nginx, lego for le dns-challenged certs, and the nebula lighthouse as a proxy. Works fine, is secure and does not bind 443 on your router to.a specific pi.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by alsobrsp on Sunday October 24, 2021 @10:24PM (#28983917)
Why in the absolute hell does a static site need docker? I don't get it, it is not that hard to properly configure software.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by Gigachad on Monday October 25, 2021 @03:11AM (#28985187)
Why does a static site even need hardware? Just drop it on GitHub/lab pages and call it a day.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by rain1 on Monday October 25, 2021 @01:54AM (#28984825)
the goal was to run nginx in docker, if you want to run nginx without docker you can just not do the docker parts. not sure what you mean about properly configure software - you can configure nginx the same whether you use docker or not?
Re:Setting up a static HTTPS website on your Raspberry Pi us... by tragictrash on Sunday October 24, 2021 @09:49PM (#28983720)
This is a bad guide and should be recognized as such. They should be using certbot or some other utility, not creating their own CA.
Re:Setting up a static HTTPS website on your Raspberry Pi us... by lovek3292 on Sunday October 24, 2021 @02:09PM (#28980452)
One command" production ready server