Stop “Sneaky” Connections on Linux with OpenSnitch: A Powerful Application-Level Firewall

Security tutorial - IT technology blog
Security tutorial - IT technology blog

Why Traditional Firewalls Aren’t Enough

After auditing security for over 10 servers and dozens of Linux workstations, I’ve noticed a major flaw in many people’s mindsets: focusing too much on “Inbound” traffic while completely ignoring “Outbound.”

Tools like UFW or iptables usually allow all outbound connections by default. Imagine a mysterious Python script or a browser extension silently compressing your personal data and sending it to a hacker’s server via port 443. In this scenario, UFW is useless because it sees port 443 as a valid connection.

OpenSnitch solves this problem, similar to how Little Snitch works on macOS. Whenever an application requests internet access, a popup immediately appears asking for your permission. You hold the power; not a single byte of data leaves your system without your consent.

Install OpenSnitch in 5 Minutes

To get started on Debian/Ubuntu-based distributions, it’s best to use the .deb files directly from GitHub to ensure you have the latest features (such as eBPF support).

Step 1: Download the Installer

Visit the OpenSnitch Releases page. You need to download two files: opensnitch_*.deb (the background daemon) and python3-opensnitch-ui_*.deb (the user interface).

# Download the latest version (e.g., 1.6.x)
wget https://github.com/evilsocket/opensnitch/releases/download/v1.6.0/opensnitch_1.6.0-1_amd64.deb
wget https://github.com/evilsocket/opensnitch/releases/download/v1.6.0/python3-opensnitch-ui_1.6.0-1_all.deb

Step 2: Install and Activate

sudo apt update
sudo apt install ./opensnitch*.deb ./python3-opensnitch-ui*.deb
sudo systemctl enable --now opensnitch

Once installed, find “OpenSnitch” in your Application Menu and launch it. An eye icon will appear in your taskbar, ready to catch any suspicious connections.

How It Works: More Than Just Port Blocking

Unlike network-layer firewalls that only see IP addresses and ports, OpenSnitch operates at the application layer. When a process makes a system call to connect to the network, OpenSnitch intercepts it.

The system then extracts detailed information: Which process is calling (e.g., /usr/bin/spotify)? Who executed it? Which domain is it trying to reach? If no rule is predefined, you will receive a notification with several options:

  • Allow: Grant access immediately.
  • Deny: Block the connection.
  • Duration: Customize how long the rule lasts (30 seconds, until reboot, or permanently).

I once discovered a free photo editing tool sending over 200 telemetry requests per hour to a strange server in Russia, all thanks to this real-time alert mechanism.

Configuration Tips to Avoid Notification Overload

When you first start using OpenSnitch, the constant popups can be annoying. Don’t get discouraged; apply these two rules to optimize your experience:

1. Prioritize Blocking by Domain instead of IP

Major services like Google, AWS, or Cloudflare use dynamic IP ranges. If you block by IP, the popup will reappear every time the IP changes. In the alert window, select the “to this domain” option. This makes your rules more durable and reduces repeat notifications by about 80%.

2. Fixing Accidental Blocks

If you suddenly find yourself unable to update your system, you likely accidentally blocked apt or dnf. Open the UI, go to the Rules tab, search for the application name, and change its status from Deny to Allow. Everything will return to normal instantly.

Practical Experience: What Not to Block

Through my experience using it on a daily work machine, I’ve gathered a few important notes:

  • System Processes: Be extremely careful with systemd-resolved (which handles DNS) or ntp (time synchronization). Blocking these will prevent your computer from accessing any website, even if your internet connection is active.
  • Malware/Backdoor Monitoring: If you are testing a script downloaded from GitHub, keep OpenSnitch active. If you see it trying to connect to a strange IP via port 4444 or 1337, that’s a clear sign of a reverse shell (malicious control code).
  • System-wide Ad Filtering: You can load blocklists into OpenSnitch to block entire advertising and tracking domains at the system level, which is much lighter than running heavy browser extensions.

Quick Troubleshooting

If the eye icon disappears or you stop seeing popups, perform a quick check with this command:

sudo journalctl -u opensnitch -f

If the log reports NFQUEUE errors, your kernel might be missing a module or there might be a conflict with another firewall. However, on modern distributions like Ubuntu 22.04+, OpenSnitch runs very stably.

OpenSnitch is an essential tool if you want to truly master your computer. It helps you understand exactly what applications are doing behind your back, elevating your privacy and security to a new level.

Share: