Skip Navigation

Do I really need a firewall for my server?

I've been running my server without a firewall for quite some time now, I have a piped instance and snikket running on it. I've been meaning to get UFW on it but I've been too lazy to do so. Is it a necessary thing that I need to have or it's a huge security vulnerability? I can only SSH my server from only my local network and must use a VPN if I wanna SSH in outside so I'd say my server's pretty secure but not the furthest I could take it. Opinions please?

62 comments
  • My personal advice, secure it down to only permitting what needs it, regardless of your trust to the network.

    Treat each device as if they've been compromised and the attacker on the compromised device is now trying to move laterally. Example scenario: had you blocked all devices except your laptop or phone to your server, your server wouldn't have been hacked because someone went through a hacked cloud-connected HVAC panel.

    I lock down everything and grant access only to devices that should have access. Then on top of that, I enable passwords and 2FA on everything as if it were public... Nothing I self host is public. It's all behind my network firewall and router firewall, and can only be accessed externally by a VPN.

  • IMHO, security measures are necessary. I have a tendency to go a bit heavy on security because I really hate having to mop up after a breach. So the more layers I have, the better I feel. Most of the breaches I've experienced were not some dude in a smokey, dimly lit room, wearing a hoody, and clacking away at a keyboard, while confidently announcing 'I'm In!' or 'Enhance!'. Most are bots by the thousands. The bots are pretty sophisticated now days. They can scan vulnerabilities, attack surfaces, et al. They have an affinity for xmrig too, tho those are easy to spot when your server pegs all resources.

    So, for the couple days investment of implementing a good, layered security defense, and then the time it takes to monitor such defenses, is worth it to me, and lets me sleep better. To each their own. Not only are breaches a pain in the ass, they have serious ramifications and can have legal consequences such as in a case where your server became a hapless zombie and was orchestrated to attack other servers. So, even on the selfhosted side of things, security measures are required, I would think.

    It takes about 5 minutes to set up UFW which would be the absolute minimum, I would think.

  • If your router is setup to only allow in the ports with a service hanging off it, like SSH. Then a firewall wont add anything your router doesnt.

    On the flip side, if your running any kind of VPS or directly accessible server, like a VPS or dedicated server. Then a firewall is required.

    Now protecting your server from other things on your local network might something you want to do, think IoT stuff getting popped and being used to hack other things on the network

  • You don't. Providing you have an upstream gateway that do the firewall for you, provided you don't have an open WiFi, provided you use a reverse proxy, provided you have sane network settings all around, provided you run linux(or similar).

    Even better if you are behind CGNAT.

    Provided you know what you are doing.

    On the other hand, setting up a firewall in a safe way is no easy task either.

    I use an opnSense on top of my home network, given all the above "provided".

    Before that, I never run a firewall and never had an issue. Always being cg-nat tough.

  • Is it directly exposed over the Internet? If you only port forward the VPN on your router, I wouldn't worry about it unless you're worried about someone else already on your LAN.

    And even then, it's really more like an extra layer of security against accidentally running something exposed publicly that you didn't intend to, or maybe you want some services to only be accessible via a particular private interface. You don't need a firewall if you have nothing to filter in the first place.

    A machine without a firewall that doesn't have any open port behave practically the same from a security standpoint: nothing's gonna happen. The only difference is the port showing as closed vs filtered in nmap, and the server refusing to send any response not even a rejection, but that's it.

62 comments