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?

  • notepass@feddit.de
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    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).

  • BlueBockser@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    arrow-down
    1
    ·
    1 year ago

    My preferred option is to have the VPS inside a VPC that blocks all external traffic by default. Then I can open up specific ports for specific IP ranges.

    The reason I prefer this over a firewall configuration on the VPS itself is that the latter seems far more error-prone to me. For example, I’ve had problems in the past with ufw and Docker where container ports were still reachable even though access was denied via ufw.