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?

  • ipkpjersi@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    4 hours ago

    You should, yes. I run a firewall (I usually use ufw) on all of my Internet-connected devices, since all of my devices run Linux. There’s not really any good reason not to in 2025.

  • Mouette@jlai.lu
    link
    fedilink
    English
    arrow-up
    3
    ·
    14 hours ago

    I just went done this road and i’d say it is worth it even only for the learning part. I’ve set counter per application in nftable, and via a python script send them in SVG graph format to Glance dashboard. The result is I can monitor my whole network per application and the best part it all add up very well so I know there is no ‘unknown’ outgoing or ingoing traffic on my machine.

  • Mikelius@lemmy.ml
    link
    fedilink
    English
    arrow-up
    4
    ·
    18 hours ago

    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.

  • sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    4
    ·
    21 hours ago

    That depends. If you have exposed services, you could use some features of the firewall to geoip restrict incoming requests to prevent spam from China and Russia and whatnot.

    If you don’t have any services running on a publicly accessible port, then what would the firewall protect?

  • Magiilaro@feddit.org
    link
    fedilink
    English
    arrow-up
    7
    ·
    1 day ago

    I only bind applications to ports on the Internet facing network interfaces that need to be reachable from outside, and have all other ports closed because nothing is listening on them. A firewall in this case would bring me no further protection from external threats, because all those ports have to be open in the firewall too.

    But Linux comes with a firewall build in, so I use it even if it is not strictly needed with my strict port management regime for my services. And a firewall has the added benefit to limit outgoing network traffic to only allowed ports/applications.

  • Fizz@lemmy.nz
    link
    fedilink
    English
    arrow-up
    59
    ·
    2 days ago

    Disclaimer, I’m not a network professional im only learning. But you dont need ufw since your router firewall should be able to filter majority of the traffic. But in security there is a concept of layers. You want your router firewall then your device firewall to provide multiple layers incase something slips through one layer.

    So to give a simple answer, it depends how secure you want your network to be. Personally I think UFW is easy so you may as well set it up. 5sec of config might stop a hacker traversing your network hoping from device to device.

    • mr_jaaay@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      ·
      10 hours ago

      To follow up on this, I’d look to network segmentation as another useful security barrier. I’ve just started playing around with VLANs, but the way I plan on setting things up is to have individual VLANs for services, management and IoT, with the LAN for all other user-land devices. On top of this you add strict firewall rules to what can talk to what, on which ports, etc. So all devices on the network can do DNS queries to my two DNS servers, for instance, but things from my services VLAN can’t reach anything outside of this VLAN…

    • farcaller@fstab.sh
      link
      fedilink
      English
      arrow-up
      29
      ·
      2 days ago

      This is the best answer. Your router protects you from the outside, but a local firewall can protect you from someone prodding your lan from a hacked camera or some other IoT device. By having a firewall locally you just minimize the attack surface further.

      • Elvith Ma'for@feddit.org
        link
        fedilink
        English
        arrow-up
        10
        ·
        2 days ago

        Instead of thinking with layers, you should use think of Swiss cheese. Each slice of cheese has some holes - think of weaknesses in the defense (or intentional holes as you need a way to connect to the target legitimately). Putting several slices back to back (in random order and orientation) means that the way to penetrate all layers is not a simple straight way, but that you need to work around each layer.

        • null_dot@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          3
          arrow-down
          4
          ·
          2 days ago

          I’ve heard this analogy before but I don’t really care for it myself.

          It creates a mental image but isn’t really analogous.

          In the case of a firewall on a server behind a NAT, ports forwarded through the NAT are holes through the first several slices.

          • Elvith Ma'for@feddit.org
            link
            fedilink
            English
            arrow-up
            3
            arrow-down
            1
            ·
            2 days ago

            If done correctly, those may only be open from the internet, but not from the local network. While SSH may only be available from your local network - or maybe only by the fixed IP of your PC. Other services may only be reachable, when coming from the correct VLAN (assuming you did segment your home network). Maybe your server can only access the internet, but not to the home network, so that an attacker has a harder time spreading into your home network (note: that’s only really meaningful, if it’s not a software firewall on that same server…)

    • agile_squirrel@lemmy.ml
      link
      fedilink
      English
      arrow-up
      4
      arrow-down
      2
      ·
      1 day ago

      I have about 20 services on my machine so I’m going to need to open a ton of ports (ssh, SSL, multiple higher number ports since some services require several ports). At that point, what is the point of a firewall if so many ports are open? With so many ports open, it seems like a firewall doesn’t add much security vs the complexity it adds.

      • Fizz@lemmy.nz
        link
        fedilink
        English
        arrow-up
        2
        ·
        22 hours ago

        If someone exploits a service on the machine they can then connect outside that machine on any port. Ufw would prevent this. The router firewall would also likely prevent this unless they used an open port of the router or upnp was enabled.

      • eldain@feddit.nl
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 day ago

        I recommend fail2ban to stop the automated attacks that are the background noise of the internet. It will set your firewall to block certain ip’s for a while, especially ports 21/22 are getting hammered with dictionary login attempts. And port 80 and 8080 for example get constantly version checked to see if you are vulnerable with an old apache, old dokuwiki etc, so don’t expose more than you need to and maybe learn about ssh tunnels and close a few.

        I once installed ossim in a small network with a server and it showed me it is war out there, scripts flying everywhere.

        • lud@lemm.ee
          link
          fedilink
          English
          arrow-up
          3
          ·
          24 hours ago

          Also get rid of password authentication if you can.

        • agile_squirrel@lemmy.ml
          link
          fedilink
          English
          arrow-up
          1
          ·
          23 hours ago

          My server is only available on my LAN and via a VPN. Is fail2ban applicable? Or is it mainly for public facing servers?

          • eldain@feddit.nl
            link
            fedilink
            English
            arrow-up
            1
            ·
            16 hours ago

            Only public facing ports, maybe your openvpn login. But that means you are already firewalled up and your attack surface is tiny, good 👍

        • Jakeroxs@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 day ago

          That doesn’t count as a firewall though no? I use traefik as my reverse proxy (and like one thing on nginx that also goes through traefik ultimately) but I still put crowdsec on top

          • swab148@lemm.ee
            link
            fedilink
            English
            arrow-up
            3
            ·
            1 day ago

            No, but putting a bunch of those services behind a reverse proxy would lower the amount of open ports. It would also have the side effect of making firewall configuration easier, since you don’t need rules for all those ports anymore.

    • JubilantJaguar@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      arrow-down
      8
      ·
      edit-2
      1 day ago

      it depends how secure you want your network to be. Personally I think UFW is easy so you may as well set it up

      IMO this attitude is problematic. It encourages people (especially newbies) to think they can’t trust anything, that software is by nature unreliable. I was one of those people once.

      Personally, now I understand better how these things work, there’s no way I’m wasting my time putting up multiple firewalls. The router already has a firewall. Next.

      PS: Sure, people don’t like this take - you can never have enough security, right? But take account of who you’re talking to - OP didn’t understand that their server is not even on the public internet. That fact makes all the difference here.

      • Appoxo@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        6
        ·
        1 day ago

        IMO this attitude is problematic. It encourages people (especially newbies) to think they can’t trust anything, that software is by nature unreliable. I was one of those people once.

        IMO: Exactly the reverse. That’s how we get clients clicking and agreeing to everything presented without for once thinking critically.

        In 6 working years (MSP) I had probably less than 10 occurrences of clients questioning a security concept from their own action.
        If we didnt protect them from their own stupidity, the amount of cyber breaches would explode…

        Just recently:
        A client: I clicked on the box that is asking me for domain credentials.

        The client didnt say what type of window it was or what happened before/after.
        The client juat contacted us, because the pc wouldnt connect to the network and thus was unusable… >_>

        • JubilantJaguar@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          arrow-down
          3
          ·
          1 day ago

          Possibly it’s about personality types. I was only going on my own experience. Of always being told by a chorus of experts “Oh no you don’t want to do that!” and ending up being terrified to touch anything. When I now know that I usually had nothing to be afraid of, because dangerous things tend to be locked down by design, exactly as they should be.

          • Appoxo@lemmy.dbzer0.com
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 day ago

            Until they arent.
            They are experts because they knew what clicking the wrong button might do.
            E.g.: Database admins using the wrong script with a miscconfigured argument or a backup admin responding to a failover, tripple checking every setting to not create a problematic failover and then still clicking the wrong button causing an outage because some random behaviour caused an overload.

            It happens. And best case you were better (double or tripple) safe than sorry.

  • irmadlad@lemmy.world
    link
    fedilink
    English
    arrow-up
    15
    ·
    1 day ago

    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.

  • foggy@lemmy.world
    link
    fedilink
    English
    arrow-up
    11
    ·
    1 day ago

    If it is just you on your server and the only access from outside your network is SSHing in front the VPN? You’re good. Especially if it’s just you on your network/VPN.

    If there are services that others utilize, you need a firewall. Can’t trust other people’s devices to not drag in malware.

  • magic_smoke@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    12
    ·
    edit-2
    2 days ago

    I like to run ufw on all my machines but I’m also a tinfoil-hat wearing wacko who believes that no computer should ever really be trusted. Just trusted enough to do specific tasks.

    If someone somehow busts into one of my VLANs, at least the other machines on that net will still have some sort of protection.

  • ancoraunamoka@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    7
    ·
    2 days ago

    One thing that hasn’t been said in this thread is the following: Do you trust your router? Do you have an isp that can probe your router remotely and access it? In those cases, you absolutely need a firewall

    • ikidd@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      1 day ago

      Absolutely. Even if your ISP is firewalling, never trust they will maintain it, and some of these cheapshit routers they use are awful. Use your own router and put it on the ISP routers DMZ.

  • superglue@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 day ago

    I use OpenWRT on my network and each server I have is on its own VLAN. So in my case, my router is the firewall to my servers. But I do have on my todo list to get the local firewalls working as well. As others have said, security is about layers. You want an attacker to have to jump multiple hurdles.

    • Possibly linux@lemmy.zip
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 day ago

      Why did you put each server in its own vlan? You now have a bunch of separate broadcast domains that need a router to move traffic between them. Switching is much faster since it is done in hardware most of the time.

      • superglue@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        Mainly for security reasons. Both servers have some limited exposure to the internet. Are you saying doing it that way has performance implications? I haven’t noticed any problems its all fast just like before when everything was on the same LAN

        • Possibly linux@lemmy.zip
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 day ago

          It will impact server to server performance significantly.

          If the servers are independent that’s fine but don’t do a file share or some other performance critical component across vlans.

          • superglue@lemmy.dbzer0.com
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 day ago

            Interesting, I haven’t noticed anything, in fact since I switched everything has felt faster. And I’m constantly sending large files to devices on other VLANs.

            • Possibly linux@lemmy.zip
              link
              fedilink
              English
              arrow-up
              1
              arrow-down
              1
              ·
              1 day ago

              It will be slower with more latency and CPU usage.

              I would highly recommend you read up on networking and the OSI model. Switching is extremely fast because it is done in hardware. Routing is slow because it goes though the CPU.

              If all else fails you could create a dedicated vlan for storage access.

  • hsdkfr734r@feddit.nl
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    2 days ago

    In your case: no need for a fw if you can trust your local network.

    Generally: services can have bugs - reverse proxy them. Not everybody needs to access the service - limit access with a firewall. Limit brute-force/ word-list attempts - MFA / fail2ban.

  • Evotech@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    edit-2
    1 day ago

    No

    If it’s just one server you probably already use a firewall on the server.

  • Matt The Horwood@lemmy.horwood.cloud
    link
    fedilink
    English
    arrow-up
    7
    ·
    2 days ago

    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

  • Shimitar@downonthestreet.eu
    link
    fedilink
    English
    arrow-up
    6
    arrow-down
    1
    ·
    2 days ago

    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.