this post was submitted on 10 Jan 2025
83 points (95.6% liked)

Selfhosted

41114 readers
635 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

tldr: I'd like to set up a reverse proxy with a domain and an SSL cert so my partner and I can access a few selfhosted services on the internet but I'm not sure what the best/safest way to do it is. Asking my partner to use tailsclae or wireguard is asking too much unfortunately. I was curious to know what you all recommend.

I have some services running on my LAN that I currently access via tailscale. Some of these services would see some benefit from being accessible on the internet (ex. Immich sharing via a link, switching over from Plex to Jellyfin without requiring my family to learn how to use a VPN, homeassistant voice stuff, etc.) but I'm kind of unsure what the best approach is. Hosting services on the internet has risk and I'd like to reduce that risk as much as possible.

  1. I know a reverse proxy would be beneficial here so I can put all the services on one box and access them via subdomains but where should I host that proxy? On my LAN using a dynamic DNS service? In the cloud? If in the cloud, should I avoid a plan where you share cpu resources with other users and get a dedicated box?

  2. Should I purchase a memorable domain or a domain with a random string of characters so no one could reasonably guess it? Does it matter?

  3. What's the best way to geo-restrict access? Fail2ban? Realistically, the only people that I might give access to live within a couple hundred miles of me.

  4. Any other tips or info you care to share would be greatly appreciated.

  5. Feel free to talk me out of it as well.

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 6 days ago

For point number 2, security through obscurity is not security.
Besides, all issued certificates are logged publicly. You can search them here https://crt.sh

Nginx Proxy Manager is easy to set up and will do LE acme certs, has a nice GUI to manage it.

If it's just access to your stuff for people you trust, use tailscale or wireguard (or some other VPN of your choice) instead of opening ports to the wild internet.
Much less risk

[–] [email protected] 3 points 5 days ago* (last edited 5 days ago)

if you know/use docker, the solution that has been the most straightforward for me is SWAG. the setup process is fairly easy when combined with registering your domain with Porkbun, as they allow free API access needed for obtaining top-level (example.com) as well as wildcard (*.example.com) SSL certificates.

along with that, exposing a new service is fairly easy with the plethora of already included nginx configs for services like Nextcloud, Syncthing, etc.

[–] [email protected] 2 points 5 days ago

I use traefik with a wildcard domain pointing to a Tailscale IP for services I don't want to be public. For the services I want to be publicly available I use cloudflare tunnels.

[–] [email protected] 5 points 6 days ago (1 children)

Why is it too much asking your partner to use wireguard? I installed wireguard for my wife on her iPhone, she can access everything in our home network like she was at home, and she doesn't even know that she is using VPN.

[–] [email protected] 2 points 6 days ago (2 children)

A few reasons

  1. My partner has plenty of hobbies but sys-admin isn't one of them. I know I'll show them how to turn off wireguard to troubleshoot why "the internet isn't working" but eventually they would forget. Shit happens, sometimes servers go down and sometimes turning off wireguard would allow the internet to work lol
  2. I'm a worrier. If there was an emergency, my partner needed to access the internet but couldn't because my DNS server went down, my wireguard server went down, my ISP shit the bed, our home power went out, etc., and they forgot about the VPN, I'd feel terrible.
  3. I was a little too ambitious when I first got into self hosting. I set up services and shared them before I was ready and ended up resetting them constantly for various reasons. For example, my Plex server is on it's 12th iteration. My partner is understandably weary to try stuff I've set up. I'm at a point where I don't introduce them to a service I set up unless accessing it is no different than using an app (like the Homeassistant app) or visiting a website. That intermediary step of ensuring the VPN is on and functional before accessing the service is more than I'd prefer to ask of them

Telling my partner to visit a website seems easy, they visit websites every day, but they don't use a VPN everyday and they don't care to.

[–] [email protected] 5 points 5 days ago (1 children)

you're talking to a community of admins that force their family to "use the thing". they can't understand why anyone can't debug tech issues because they have surrounded themselves with people who can.

I get it, my wife isn't technical at all. she gets online about once a week to check email. I couldn't even begin to explain to her how to debug her connection problems past turn it off and on again.

so, to simplify things, she doesn't connect to the home network outside of the home network. but I was able to teach her how to download movies/shows from Plex to her phone and I was able to explain why ads show up on her apps when she's out of the house.

it's not perfect, but it's the best I can give her with her understanding of the technology. knowing the limitations of your user base is just as important as developing the tools they will use and how they will access them.

[–] [email protected] 2 points 5 days ago

I get where the original commenter is coming from. A VPN is easy to use, why not have my partner just use the VPN? But like, try adding something to your routine that you don't care about or aren't interested in. It's an uphill battle and not every hill is worth dying on.

All that to say, I appreciate your comment.

[–] [email protected] 2 points 6 days ago
  1. I don’t think this is a problem with tailscale but you should check. Also you don’t have to pipe all the traffic through your tunnel. In the allowed IPs you can specify only your subnet so that everything else leaves via the default gateway.
  2. in the DNS server field in your WireGuard config you can specify anything, doesn’t have to be RFC1918 compliant. 1.1.1.1 will work too
  3. At the end of the day, a threat model is always gonna be security vs. convenience. Plex was used as an attack vector in the past as most most people don’t rush to patch it (and rightfully so, there are countless horror stories of PMS updates breaking the whole thing entirely). If you trust that you know what you’re doing, and trust the applications you’re running to treat security seriously (hint: Plex doesn’t) then go ahead, set up your reverse proxy server of choice (easiest would be Traefik, but if you need more robustness then nginx is still king) and open 443 to the internet.
[–] [email protected] 4 points 6 days ago* (last edited 6 days ago) (1 children)

Why do so many people do this incorrectly. Unless you are actually serving a public then you don't need to open anything other than a WireGuard tunnel. My phone automatically connects to WireGuard as soon as I disconnect from my home WiFi so I have access to every single one of my services and only have to expose one port and service.

If you are going through setting up caddy or nginx proxy manager or anything else and you're not serving a public.... you're dumb.

[–] [email protected] 4 points 6 days ago (3 children)

What are you using to auto connect to VPN when you disconnect from your home wifi?

[–] [email protected] 3 points 6 days ago

WG Tunnel does that natively, you can whitelist some wifis and auto connect on other and optionally on mobile data

[–] [email protected] 1 points 5 days ago

The Wireguard iOS app has an “on-demand” toggle that automatically connects when certain conditions are met (on cellular, on wifi, exclude certain networks, etc)

[–] [email protected] 1 points 6 days ago

Tasker on android, bit faffy and shouldn't at all be necisary

[–] [email protected] 5 points 6 days ago* (last edited 6 days ago)

Tailscale is very popular among people I know who have similar problems. Supposedly it's pretty transparent and easy to use.

If you want to do it yourself, setting up dyndns and a wireguard node on your network (with the wireguard udp port forwarded to it) is probably the easiest path. The official wireguard vpn app is pretty good at least for android and mac, and for a linux client you can just set up the wireguard thing directly. There are pretty good tutorials for this iirc.

Some dns name pointing to your home IP might in theory be an indication to potential hackers that there's something there, but just having an alive IP on the internet will already get you malicious scans. Wireguard doesn't respond unless the incoming packet is properly signed so it doesn't show up in a regular scan.

Geo-restriction might just give a false sense of security. Fail2ban is probably overkill for a single udp port. Better to invest in having automatic security upgrades on and making your internal network more zero trust

[–] [email protected] 3 points 6 days ago

I came here to upvote the post that mentions haproxy, but I can't see it, so I'm resorting to writing one!

Haproxy is super fast, highly configurable, and if you don't have the config nailed down just right won't start so you know you've messed something up right away :-)

It will handle encryption too, so you don't need to bother changing the config on your internal server, just tweak your firewall rules to let whatever box you have haproxy running on (you have a DMZ, right?) see the server, and you are good to go.

Google and stackexchange are your friends for config snippets. And I find the actual documentation is good too.

Configure it with certificates from let's encrypt and you are off to the races.

[–] [email protected] 21 points 1 week ago (7 children)

Caddy with cloudflare support in a docker container.

[–] [email protected] 1 points 6 days ago (1 children)

Does Caddy have an OWASP plugin like nginx?

[–] [email protected] 2 points 6 days ago

I don't use it, but it looks like yes.

https://github.com/corazawaf/coraza-caddy

load more comments (6 replies)
[–] [email protected] 14 points 1 week ago* (last edited 1 week ago) (5 children)

How do you handle SSL certs and internet access in your setup?

I have NPM running as “gateway” between my LAN and the Internet and let handle it all of my vertificates using the built-in Let’s Encrypt features. None of my hosted applications know anything about certificates in their Docker containers.

As for your questions:

  1. You can and should – it makes managing the applications much easier. You should use some containerization. Subdomains and correct routing will be done by the reverse proxy. You basically tell the proxy “when a request for foo.example.com comes in, forward it to myserver.local, port 12345” where 12345 is the port the container communicates over.
  2. 100% depends on your use case. I purchased a domain because I host stuff for external access, too. I just have my setup to report it’s external IP address to my domain provider. It basically is some dynamic DNS service but with a “real domain”. If you plan to just host for yourself and your friends, some generic subdomain from a dynamic DNS service would do the trick. (Using NPMs Let’s Encrypt configuration will work with that, too.)
  3. You can’t. Every georestricting can be circumvented. If you want to restrict access, use HTTP basic auth. You can set that up using NPM, too. So users authenticate against NPM and only when it was successful,m the routing to the actual content will be done.
  4. You might want to look into Cloudflare Tunnel to hide your real IP address and protect against DDoS attacks.
  5. No 🙂
load more comments (5 replies)
[–] [email protected] 12 points 1 week ago* (last edited 1 week ago) (3 children)

or a domain with a random string of characters so no one could reasonably guess it? Does it matter?

That does not work. As soon as you get SSL certificates, expect the domain name to be public knowledge, especially with Let's Encrypt and all other certificate authorities with transparency logs. As a general rule, don't rely on something to be hidden from others as a security measure.

[–] [email protected] 8 points 1 week ago

It is possible to get wildcard certificates from LetsEnrcypt which doesn't give anyone information on which subdomains are valid as your reverse proxy would handle that. Still arguably security through obscurity, but it does make it substantially harder for anyone who can't intercept traffic between the client and server.

load more comments (2 replies)
load more comments
view more: next ›