Hey all! For the longest time I’ve had a server that hosts some things (eg Syncthing), but is only available via SSH tunneling.
I’ve been thinking of self-hosting more things like Nextcloud and Vaultwarden. I can keep my SSH tunneling setup but it might make it difficult to do SSL.
How do you manage the security of having public-facing servers?
Why not use a proper VPN instead of SSH tunnels?
Mostly a convenience thing, since I only need it on-demand and I usually use SSH for things anyway. As this post suggests I’m obviously rethinking that now :)
A VPN you could use on your phone, computer, laptop, tablet, TV, Samsung SmartFridge, etc. I’ll admit it’s a bit more involved than
ssh -L ...
but it’s well worth it. Especially if you’re the only one using it. After setting up Wireguard I’ve elimated all my router port forwards except SSH and WGThanks for the tip! Tailscale was so easy to get into and is worth it like you said.
Yes you should be worried. Dont expose services you’re not able to keep up to date and know how to manage and secure. Using tailscale is a great alternative as it allows you to have access without exposing anything to the internet, I’d prefer that. For everything else, subscribe to a CVE service for those (I use nextcloud and matrix and follow all security findings) and be ready to take them offline as soon as a critical exploit appears. Dont expose your passwords directly to the internet - ever; no matter if anyone else tells you its OK.
Password protect your services, set up your web server correctly, use cloudflare for some extra security against stuff like DDoS/DoS attacks. Also less is more, do not expose what you don’t need to expose.
There is always inherent risk with opening up your stuff to the world wide web.
Some stuff you can’t even secure yourself; some services just have bad security practices. The only way to fix them would be to wait for an update or submit a pull request.
thank you so much for all the suggestions!
My biggest takeaway from all this is managed VPN solutions like Tailscale are cheap ($0), easy to set up, and lets me not expose ports to the outside world.
Here is my setup:
Cloudflare fronts all of my webserver traffic, and I have firewall rules in Cloudflare.
Then I have an OPNsense firewall that blocks a list of suspicious ips that updates automatically, and only allows port 80/443 connections from Cloudflare’s servers. The only other port I have open is for Wireguard to access all of my internal services. This does not go through Cloudflare obviously, and I use a different domain for my actual IP. I keep Vaultwarden internal for extra safety.
Next I run every internet facing service in k3s in a separate namespace. This namespace has its own traefik reverse proxy separate from my internal services. This is what port 80/443 forwards to. The namespace has network policies that prevent any egress traffic to my local network. Every container in the WAN facing namespace runs as a user with no login permission to the host. I am also picky about what storage I mount in them.
If you can get through that you deserve my data I think.
I need to learn more about cloudflare. Do you have the guide for this setup!
Unfortunately no guide, just things I’ve pieced together myself over the years.
Cloudflare is probably the easiest and most intuitive part of the setup though, you can setup dns/proxy/firewall rules very intuitively, and I’m sure there are plenty of guides out there.