Hey guys,
I finally come around and started the journey of self-hosting and decided to get a VPS. After securing it, by making login via public-key default, I installed CasaOS and instantly regretted it since it now can be reached freely from the internet. A while ago, I read that you can limit the incoming connection to only VPN and ssh. And configured a Wireguard-VPN on the server via pivpn. But the server can still be reached from the internet. So what do I have to do now? Is it even the right choice, or am I missing something? How do you guys secure your VPS?
Zerotier or Tailscale is for you. I personally use Zt but the recent update with Mullvad support really empowers Tailscale.
What’s the point of renting a VPS if you only access it from your own network? I understand why a large company would do it (risk mitigation) but I don’t understand why a self-hoster wouldn’t just use an old computer at home. Your costs would be reduced and you could more easily control access.
Now that being said, most Cloud VPS providers have a firewall that you can configure from their web portal. If you whitelist your home network public IP then you can be sure that anyone connecting to your VPS will have to be doing so from your home network. You could do the same thing with UFW or Iptables on the VPS but I recommend using the external firewall because it won’t take resources from your VPS while defending against a DDOS.
The two main reasons I decided to opt for a VPS was, that I don’t have a PC here that is efficient enough and the faster fresh installs and snapshots are a pro too.
If you haven’t already, check out Proxmox. It’s an operating system that specializes in running Virtual Machines. If you run Proxmox at home you can have all the features that you just mentioned and more.
You can set up firewall rules that limit connections to certain ports. For example, you can disallow connections to everything but port 22 (which ssh runs on) to only allow access to the ssh server from outside. Same with VPN.
Read up on ufw (or iptables if you want to do it lower level and have a drink on hand).
iptables!
ufw makes it way nicer to use tho. I only use iptables as I have a configuration script I wrote way back in the day.
Yeah UFW is the way to go, but when you run into an embedded Linux device that only runs iptables and can only be accessed via ssh?
Well…. Keep that drink handy
Yes, but how often does that happen to the average person?
Deity of choice willing, never lol
zerotier.