36
submitted 11 hours ago by [email protected] to c/[email protected]

Hey there folks,

I'm trying to figure out how to configure my UFW, and I'm just not sure where to start. What can I do to see the intetnet traffic from individual apps so I can know what I might want to block? This is just my personal computer and I'm a total newbie to configuring firewalls so I'm just not sure how to go about it. Most online guides seem to assume one already knows what they want to block but I don't even know how/where to monitor local traffic to figure out what I can/should consider blocking.

all 29 comments
sorted by: hot top controversial new old
[-] [email protected] 3 points 2 hours ago

In a nutshell,

  • Use wireshark

  • See if theres any weird connections going on (i.e you visit pancakes.com and wireshark shows unrelatedsite.com making a request as well)

  • Block unrelatedsite.com

"What about firewalls?"

Block from ports 1000 'till the very end (65565 if I'm not mistaken.) -- that is your "bread and butter" approach.

"W-what if I'm using a port past 1000?"

Nah, you (very likely) aren't and never will.

[-] [email protected] 9 points 5 hours ago

Worth noting that if you're trying to block telemetery or ads or things like that, using an adblocking dns is probably the better option. Either through a pihole on your network or some online adblocking dns.

Other than that, if you're looking for one because you think you "need" one, don't worry too much if it's just a personal computer connected to a router. Most distros ship with sensible defaults for security.

If you actually want to use a firewall, block all incoming and allow all outgoing is a reasonable rule of thumb if you aren't running a server. Note that "block incoming" doesn't block connections that the system itself started.

[-] [email protected] 1 points 2 hours ago

This seems to be some of the most worthwhile advice. I do use a pretty reasonable DNS client (NextDNS) and it allows me to configure some useful filters and such, and when I'm browsing the internet I also use uBlock Origin and manually allow any third party content one by one.

I did configure UFW to block incoming and allow outgoing, and that should be more than enough for me. I think I'm a pretty "standard" user in the sense that I would make a fairly average target for a would-be attacker. It's not like I own a web server with goodies worth exploiting.

A part of me really wants to learn more because at some point I'll have my own router that I'll want to ensure is configured properly because I'll likely end up making my own server for media stuff.

Thank you for your reply!

[-] [email protected] 0 points 12 minutes ago

I recommend reading "TCP/IP Illustrated: Volume 1, Second Edition" if you want to learn more about networking. Make sure it's the second edition, because the first edition is very old. The second edition is also over a decade old now, but it's still almost completely correct, as the basics haven't changed much. And don't mistake the book to be overly simplified because of the title; it's a very technical book that references the actual RFCs wherever appropriate.

[-] [email protected] 5 points 4 hours ago

Blocking incoming traffic and accepting outgoing traffic is usually the default for distributions anyway.

[-] [email protected] 1 points 10 minutes ago

Debian is a notable exception.

[-] [email protected] 9 points 7 hours ago

What can I do to see the intetnet traffic from individual apps

Wireshark

what I might want to block?

One strategy is to block everything, and open ports as needed. Beware that most guides focus on inbound traffic, whereas you seem to be focusing on outbound traffic.

[-] [email protected] 1 points 42 minutes ago

wireshark does not work for individual apps, it cannot make a difference between traffic of process a and b.

[-] [email protected] 55 points 10 hours ago

You've got it backwards. A firewall blocks everything, then you open up the ports you want to use. A standard config would allow everything going out, and block everything coming in (unless you initiated that connection, then it is allowed).

So the question you should be asking, is what services do you think you're going to be running on your desktop that you plan to allow anyone on the internet to get to?

[-] [email protected] 1 points 38 minutes ago* (last edited 38 minutes ago)

no, not really. on linux that depends on the default policy of the corresponding chains, so it's configurable. I don't think all common distros default to reject either.

[-] [email protected] 8 points 8 hours ago

Not entirely clear but perhaps OP is talking about blocking unwanted outgoing reqjests? E.g. anti-features and such since they mention traffic from their apps.

[-] [email protected] 10 points 7 hours ago

You should block everything, except the things you want to get through. A firewall (at least in Linux) blocks everything inbound by default.

[-] [email protected] 1 points 40 minutes ago

A firewall (at least in Linux) blocks everything inbound by default.

are you sure? I thought that at least UFW allows through some common LAN services

[-] [email protected] 2 points 6 hours ago* (last edited 1 hour ago)

You don't need a firewall on a typical desktop computer. You only need them on routers and servers.

That is because your personal computer is not actually on the internet. It is on a local network (LAN) and it talks only to your router. The router is the computer connected to the internet, and it has a firewall.

The question highlights a classic misunderstanding about networking that IMO should be better addressed. I was like OP once, and panicking about this pointlessly.

Addendum: You're all replying to OP as if they're a sysadmin managing a public-facing server. But OP says clearly that they're just a beginner on a PC - which will almost certainly be firewalled by their router. We should be encouraging and educating people like this, not terrorizing them about all the risks they're taking.

[-] [email protected] 5 points 5 hours ago

I think you need a bit of Swiss cheese in your security philosophy. Relying only on your router's firewall is a single point of failure. If it fails you are screwed. Relying on multiple layers means if one layer fails, another one might save you.

swiss cheese security model

[-] [email protected] 2 points 3 hours ago

Well, screwed I will be, then. I'm not going to waste my life babysitting a bespoke firewall on my Ubuntu Desktop.

And it seems like a bad idea to be telling beginners on Ubuntu or Mint whatever that their "security philosophy is flawed" and they must imperatively run these 10 lines of mysterious code or else bad things will happen.

This whole discussion looks like a misunderstanding. OP is not a sysadmin on public-facing server. They are a beginner on a laptop at home.

[-] [email protected] 2 points 2 hours ago

I mostly agree with you, but given it’s a laptop that may not always be at home. It is wise to consider enabling the firewall when connecting to other untrusted networks like Starbucks

[-] [email protected] 1 points 1 hour ago

Yes, fair point.

As I understand it, the main risk of an untrusted local network is with DNS. The best precaution being to set it manually (to 1.1.1.1 for example or ideally something less centralized). Actually I used to do that myself, running a stub DNS server on localhost. This kind of option really should be in every OS by default.

Would be interested to know the consensus on better locking down a roving laptop.

[-] [email protected] 7 points 9 hours ago* (last edited 9 hours ago)

A firewall by default blocks everything coming from outside going in (without being requested).
Firewalls can also block traffic going out from your PC to the internet. In a company where you need to protect against data exfiltration by employees, and as a last resort safeguard against malware communicating with outside servers, you want that. In that case, a security expert makes a detailed plan of all installed software, to determine what needs to connect from which internal IP to which external IP over which port. Then all other outbound traffic is blocked. This needs to be adjusted constantly, every time a new software is installed or an update changes a software's requirements. It's a full-time job.

On a home PC running Linux, that's absolute overkill. There are no untrusted users in your home and you're probably not the target for a directed attack by skilled actors. So just leave ufw on default, which blocks all inbound traffic and allows all outbound.

[-] [email protected] 9 points 10 hours ago

UFW

This is just my personal computer and I'm a newbie to configure firewalls

Leave it alone.

If you want to experiment, set up a VM and experiment there.

Also, if you want to learn about Linux firewalls, go for iptables instead. UFW is easier, yes, but you won't get the standard way of configuring a Linux firewall, though to be honest, unless you are directly connecting the computer to the internet, you probably won't need to bother.

And if you are working in an environment where you are dealing with a segmented network with limited access between segments, they will probably already use a separate firewall that is easier to manage centrally than induvidual firewalls running on individual computers

[-] [email protected] 1 points 34 minutes ago

I think it's fine to start with UFW on a desktop system at home to learn the very basics and get an idea on what ports you actually need. learning iptables/nftables is useful, but not necessary for a simple user at that level

[-] [email protected] 8 points 8 hours ago

if you want to learn about Linux firewalls, go for iptables instead.

I'd suggest learning nftables might be more fruitful nowadays.

[-] [email protected] 4 points 9 hours ago

I think you might be looking for something like OpenSnitch.

[-] [email protected] 2 points 8 hours ago

the command ss shows connections

[-] [email protected] -5 points 11 hours ago* (last edited 10 hours ago)

You shouldn't be touching it, honestly. There's a firewall at your router. It should be responsible for blocking incoming traffic. Firewalls on individual machines are for servers where you know exactly what's going in and out. I don't have a firewall on my desktop or laptop.

You will spend the best years of your life chasing random network connections if you block everything by default.

[-] [email protected] 0 points 32 minutes ago

I don't have a firewall on my desktop or laptop

you are brave to use your laptop that way. or is it used as a stationary device?

but yes it is useful at home if you live with people who you don't trust to be managing their computer safely

[-] [email protected] 1 points 22 minutes ago

you are brave to use your laptop that way

why? I don't connect it to untrusted networks

this post was submitted on 27 Sep 2024
36 points (100.0% liked)

Linux

47452 readers
1403 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS