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

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

    If your computer is connected to a network, I don't see any downside of enabling a firewall. It's a good security layer to have and costs basically no resources to keep running.

    • RaivoKulli@sopuli.xyz
      link
      fedilink
      arrow-up
      8
      arrow-down
      1
      ·
      1 year ago

      I guess a downside is having to fiddle with it, allowing stuff you want to get through. Sometimes it blocks stuff you don't want blocked

  • Pantherina@feddit.de
    link
    fedilink
    arrow-up
    22
    arrow-down
    1
    ·
    1 year ago

    Yes, and hopefully you will have one preinstalled, blocking all incoming connections.

    An outbound firewall like Opensnitch or Portmaster is also nice. But here I would say often you dont need one. Balena Etcher was the only App loading Ads, at all. Firefox and Thunderbird can be hardened. The rest is okay and doesnt phone home, Flatpak permissions ard also great.

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

    Linux comes with a default firewall it's called IPtables/NFtables, Just make sure that it's on. Example I Ubuntu Sudo ufw enable.

  • utopiah@lemmy.ml
    link
    fedilink
    arrow-up
    16
    ·
    1 year ago

    Ironically enough if you do not know what a firewall actually does (and saying it "protects" against "stuff is NOT enough) IMHO you do need one. That being said unless you know what you are doing, better leave it to the default one with default settings.

    • 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
        19
        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?

          • Bitrot@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?

              • Bitrot@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

        • 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
      9
      ·
      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
        11
        ·
        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.

  • flashgnash@lemm.ee
    link
    fedilink
    arrow-up
    15
    ·
    1 year ago

    On a laptop absolutely. My firewall on my laptop doesn't let me discriminate between networks so I'm always worried someone will try to attack me on public WiFi for the few ports I want open

    On a desktop on a network you trust less important but still no firewall means if another device on your network gets compromised you're screwed

    • Sir_Simon_Spamalot@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 year ago

      For laptop, what kind of attack would we be protecting ourselves from? I get the relevance of antivirus, VPN, and device encryption, but what about firewall?

      • flashgnash@lemm.ee
        link
        fedilink
        arrow-up
        5
        ·
        1 year ago

        Any vulnerabilities in any of your software that can talk to a network, ssh, browser, the operating system itsself could be exploited if your firewall is down

        If you're using username and password and have ssh enabled, for example anyone on your network could attempt to log in to your machine

          • flashgnash@lemm.ee
            link
            fedilink
            arrow-up
            2
            ·
            1 year ago

            At that point why not just have the firewall set to deny everything just to be safe though? There's always the chance you missed something that's decided to listen on some random port and if you aren't using anything that listens on a network why have the firewall open anyway

          • flashgnash@lemm.ee
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            1 year ago

            My understanding is there can be a vulnerability in absolutely anything

            Browsers are unlikely to but don't think it's impossible

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

              A firewall protects open ports on your machine. A browser does not have any open ports.

              Of course they have vulnerabilities, but a firewall won't protect you from them.

      • Paragone@sh.itjust.works
        link
        fedilink
        arrow-up
        0
        arrow-down
        2
        ·
        1 year ago

        If you have the ability to take a look at either SANS website, and see their articles, or have your system show you all the automatic attacks hitting your machine, then maybe you will understand…

        Botnets are coded to hammer-away at all possible internet-addresses, trying to break-in & highjack more machines, to include in the established criminal-machine that the botnet is…

        SANS said, a decade or 2 ago, that it took, on average, something like 6 or 4 minutes for a new MS-Windows machine to be owned by some attack from the internet.

        I've had linux machines cracked/owned, and wiped 'em to get 'em clean.

        Having no immune-system is BAD.

        Linux botnets, apple operating-system botnets, they exist.

        I don't think there is any operating-system that is connected to the internet that doesn't have attacks coded to crack it.

        I just looked at SANS.org, and they have totally changed, so they are now … more a moneymaking-machine wanting B2B biz?

        Here, though, are some cheat-sheets they made:

        https://www.sans.org/posters/?msc=main-nav

        They used to tell us the top-20 most effective protections for particular threats, identifying how prevalent the threats were, etc…

        No idea who does that nowadays…

      • ReversalHatchery@beehaw.org
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        1 year ago

        Yes, except that whether you do is not at all obvious.

        Do you use KDE Connect? If yes, you run a network service. Syncthing, a bittorrent client? Those too, and many others. I know this is a Linux community, but as a comparison windows has a bunch of network services running by default.
        By saying "network services", I think menu of us would just think about a web server or a file server, conclude that they don't run any of those, and don't bother with it.

        When in doubt, sudo netstat -lutpn, and look for the listening ports to see what software listens for informing requests.

      • jcarax@beehaw.org
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        I'd still have one, eventually something is going to slip past a new configuration or dependency that listens.

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

    Do you need a lock on the door of your place?

    No, but it’s a damn good idea to protect whatever is in it.

    • FuzzChef@feddit.de
      link
      fedilink
      arrow-up
      8
      arrow-down
      1
      ·
      edit-2
      1 year ago

      That's a bad comparison. Without a lock you can just open the door from the outside.

        • LufyCZ@lemmy.world
          link
          fedilink
          arrow-up
          7
          arrow-down
          1
          ·
          1 year ago

          It's not.

          If you have a house, it has a door which you can use to access everything inside.

          If you have a linux install with no services running on it, it has no doors, and thus doesn't need any door locks. And if it does have services running on there (which run publicly), it now has doors, sure, but getting one of those doors open doesn't guarantee access to the whole house - usually it's gonna be an empty room

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

            Linux with no services? That's not a usable system for anyone who would ask "do I need a firewall"

            Systemd is a service that runs logind. What are you doing without them?

            • rwhitisissle@lemmy.ml
              link
              fedilink
              arrow-up
              6
              ·
              1 year ago

              I think by services they mean self-hosted, web-based services, or things like sshd - services which work by actively serving connections on a particular port or ports.

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

                And even then, a properly configured SSHD instance wouldn't really benefit from a firewall, unless you wanted to block all countries besides your own or something.

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

    Yes, because while I trust my device, I do not trust the Chromecast or the WAP to not be an asshole and fuck with things.

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

        Trust may be the worng word as Windows will be Windows but I know that no one is going to zero day my devices because I am not that high value of a target.

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

          That's a bad mentally as well. Most stacks these days are about quantity not quality. If you blindly hit 10000 targets it's more profitable than trying to spear a single one.

          Akin to not wearing a seatbelt because you are unlikely to be killed by a sniper

  • Notamoosen@kbin.social
    link
    fedilink
    arrow-up
    12
    arrow-down
    1
    ·
    1 year ago

    I'd say if you plan on using it any public places, or if you don't have full control over all the computers/technology in your home network, it's a good idea to run one. It's a nice last resort should someone on the same lan have a piece of malicious software.

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

    Its always a good idea. I have a firewall on my laptop since I travel and connect to many different networks.

    I don't run any services that would be broadcasting open ports but its always better to be safe

    • jcarax@beehaw.org
      link
      fedilink
      arrow-up
      7
      ·
      1 year ago

      Hell, even if you don't travel. You never know when something nasty is going to get loose on your network. Especially since most folks have some IoT things, and don't bother to properly isolate them.

  • tal@lemmy.today
    link
    fedilink
    arrow-up
    12
    arrow-down
    2
    ·
    edit-2
    1 year ago

    No, you don't. But it's also not necessarily a bad idea if it's not going to create issues for you.

    Normally, a software package that wants to talk over IP and only wants to let local software communicate with it can listen only on loopback addresses (like 127.0.0.1). But I have definitely seen software packages that have defaulted to listening to the world (gpsd used to do this by default, for example, which would let anyone in the world who could talk to your machine see precisely where you were). Having a firewall makes the default to be secure – you know that the default is not to be reachable, regardless of what some software author thinks is a good idea.

    Most home systems these days are generally behind a NATting router, which effectively firewalls them against the outside world (though maybe IPv6 will change this), so they can't be directly reached from the outside anyway, unless a user has set up port forwarding on the router, the systems are effectively firewalled anyway, unless an attacker can get inside the network somehow.

    It's one more thing that you're going to have to remember to deal with if you're installing software and troubleshooting network problems. You install software package X and it isn't reachable, you're going to have to figure out how to diagnose problems. As long as this isn't a problem for you…shrugs

    I don't personally run firewalls on my desktops. But I have also, over the years, occasionally checked netstat -ntap and discovered that a service that I thought only listened locally was listening to the world, gpsd probably being the most-flagrant example.

    If I were not behind a router, or if I were forwarding all ports to my system, I would be firewalling my desktop systems.

    On a dedicated server, I'd be less worried, because I'm not normally installing tons of random software on the thing. If you aren't going to firewall it, though, be sure that you've checked to see what is listening on the server.

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

      There is no reason to not leverage a firewall. Plenty of browser based malware can breach your home router and call back out to allow an attacker to explore your network. Windows has included a firewall for over a decade and it's fine. You can with a single command enable Linux's built in firewall and be glad you did the bare minimum of cyber security.

      • sebsch@discuss.tchncs.de
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        1 year ago

        Windows network layer is a desaster. It is so bad, you could currupt the system with Ping in the past.

        I would not say, you should not have a firewall on a desktop, but saying it's a good idea bc/ windows makes me laugh.

    • wolf@lemmy.zip
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I strongly disagree.

      For example on systems based on Debian (running myself) which simply enables networked services by default running a firewall is a total no brainer. Same is true for literally every Linux distribution with dependency management.

      Especially if someone asks, it is a strong indicator this person should run a firewall.

  • IsoKiero@sopuli.xyz
    link
    fedilink
    English
    arrow-up
    8
    ·
    1 year ago

    You most likely already have one installed, but not enabled. It doesn't harm anything (maybe you need to allow traffic to ssh or other configuration, but after that you're all set) and it's a layer of protection, specially if you need to move between networks (public wifi etc).

    • Diplomjodler@feddit.de
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      1 year ago

      On Mint the firewall is enabled by default. Setting up firewall rules is pretty easy though, so it's worth taking five minutes to read up on it.

  • Toddster@feddit.de
    link
    fedilink
    arrow-up
    11
    arrow-down
    3
    ·
    1 year ago

    No - If you are aware which programs open incoming ports. E.g. check with netstat -tulpe

    Yes - If you want to make sure e.g. TCP port 22 or a webserver on 443 etc is only available from IP/Adapter xy. Or if you want to mess with filtering outgoing connections.

  • smileyhead@discuss.tchncs.de
    link
    fedilink
    arrow-up
    8
    arrow-down
    1
    ·
    1 year ago

    Yes, because you can forget what services are running and maybe they can be explited.

    An example can be Syncthing which setting are done via web browser at port 8384. If you do not have a firewall, everyone on the same network would be able to change Syncthing settings and then sync your directories to their devices.

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

      Is syncthing listening on all addresses, or only loopback? A firewall would block it, sure, but that would also be bad design.

    • ReversalHatchery@beehaw.org
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      Good point, but syncthing only listens on localhost as others have said too.
      However it still is a network service that can have vulnerabilities, besides many others like KDE Connect (which may be a target as one of its purposes is remote control and monitoring) or a bittorrent client