Hi. I wanted to know if it's needed to install a firewall on a linux desktop/laptop. Why yes or why no?

    • blarp@lemmy.ml
      link
      fedilink
      English
      arrow-up
      12
      arrow-down
      1
      ·
      1 year ago

      yup, all you have to do is install ufw then run:

      sudo systemctl enable --now ufw
      sudo ufw default deny
      sudo ufw allow from 192.168.0.0/24
      # if you want ssh:
      sudo ufw limit ssh
      sudo ufw enable
      
      • Turun@feddit.de
        link
        fedilink
        arrow-up
        18
        arrow-down
        1
        ·
        1 year ago

        If you allow the whole subnet you might as well not use a firewall. Your router has one and port forwarding is disabled by default.

        • blarp@lemmy.ml
          link
          fedilink
          English
          arrow-up
          3
          ·
          1 year ago

          Hey thank you for this comment. I was just following the ArchWiki and you can also find similar directions here. I think the idea is that on a home network, every device can be trusted, but it's still good to have a firewall in case your ISP's firewall is crappy. What do you think?

          • NaN@lemmy.sdf.org
            link
            fedilink
            English
            arrow-up
            5
            ·
            1 year ago

            Your isp firewall uses nat, and a hacked isp gateway or some other device that had ports forwarded to it are the most likely things to be reaching into your network. They’ll be on that subnet.

            • blarp@lemmy.ml
              link
              fedilink
              English
              arrow-up
              2
              ·
              1 year ago

              Ohhh of course. Thank you.

              So the more practical solution is just to assign a static IP to all my trusted devices, then allow those IP addresses rather than the whole subnet.

              That makes total sense, but why do you think the ArchWiki says otherwise? Do you think they're just presenting a "just werks" solution?

              • NaN@lemmy.sdf.org
                link
                fedilink
                English
                arrow-up
                5
                ·
                edit-2
                1 year ago

                Yes, they’re giving “very simplistic” and also demonstrating how to deny and add access in multiple ways.

                It’s also not uncommon to do things like that. The default firewall config in Fedora is wide open for every port above 1024.

                • blarp@lemmy.ml
                  link
                  fedilink
                  English
                  arrow-up
                  4
                  ·
                  1 year ago

                  You are a rock star.

                  Okay, I now have new awesome rules! I assigned my other two machines static IPs (192.168.1.3 and 192.168.1.4, respectively). So now I have:

                  sudo systemctl enable --now ufw
                  sudo ufw default deny
                  sudo ufw allow from 192.168.1.3
                  sudo ufw allow from 192.168.1.4
                  sudo ufw limit ssh
                  sudo ufw enable
                  

                  SSH still works, everything is awesome. Thanks again 👏👏👏

                • Infernal_pizza@lemmy.world
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  1 year ago

                  I set up a rule last night to allow SSH access from any device on my subnet, is it a good idea to add a separate rule blocking SSH from my router? I’ve already set up SSH with public key authentication so in theory there aren’t many devices that can access it but the firewall restriction seemed like a good idea

                  • Turun@feddit.de
                    link
                    fedilink
                    arrow-up
                    1
                    ·
                    1 year ago

                    If you are worried that an attacker may have compromised your router and that key auth is not secure enough, then yes it would make sense.

                    I move ssh to a non-default port, only allow key based auth and install fail2ban. This is enough for me. It protects against automated attacks hitting port 22 and prevents brute force.

        • BrianTheeBiscuiteer@lemmy.world
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          1 year ago

          Yeah, I kind of agree. Unless this is a mobile device pretty much all traffic will come from within your subnet. I often deny incoming from my gateway (i.e. router) and poke holes as necessary.

    • 𝘋𝘪𝘳𝘬@lemmy.ml
      link
      fedilink
      arrow-up
      7
      arrow-down
      10
      ·
      1 year ago

      It’s also comically useless to have a desktop firewall application installed when you’re already behind some sort of firewall solution like a router not forwarding most incoming traffic.

      • Molecular0079@lemmy.world
        link
        fedilink
        English
        arrow-up
        12
        ·
        1 year ago

        It depends. Sure, maybe somewhat redundant for a home desktop that just stays at home on a network you control, but for a laptop it is absolutely essential.

        You may also want a firewall to defend against other devices within your local network. Let's say you have IoT devices, many of which are poorly secured and maintained by their manufacturers, or you live with family members or guests who don't practice or even know about proper computing hygiene and are bringing in devices onto your local WiFi.

        • 𝘋𝘪𝘳𝘬@lemmy.ml
          link
          fedilink
          arrow-up
          4
          arrow-down
          1
          ·
          1 year ago

          My IoT devices already have a dedicated network and guest can use my guest WiFi. But yes, you’re right. It depends. And especially for mobile devices some sort of local firewall solution could be relevant. If there are no ports exposed to the LAN you’re pretty save, though.

          • Jagger2097@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            1 year ago

            No you aren't, browser based malware puts the attacker inside your fancy network. A basic firewall will greatly hinder any attack at basically no cost to you.

      • BrianTheeBiscuiteer@lemmy.world
        link
        fedilink
        arrow-up
        5
        arrow-down
        1
        ·
        1 year ago

        There's incoming and then there's outgoing traffic. Software firewalls can forbid processes that may be advertised as "offline only" from reaching out; typically a hardware firewall doesn't care about this kind of thing.

      • Salix@sh.itjust.works
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        1 year ago

        Some people like hosting some servers on their desktop as well, and doesn't want others on their local network to access them. With firewalls, you can allow specific IP address to reach those servers.

      • wmassingham@lemmy.world
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        1 year ago

        That's fine right up until something on your network, even the ISP modem-firewall-router-switch itself, gets compromised.