To configure Uncomplicated Firewall (UFW) on a Kubuntu 24.04 system to allow outgoing connections while blocking incoming, follow the steps below:
- First, ensure that UFW is installed on your system:
sudo apt-get update
sudo apt-get install ufw
- Set the default policy for UFW:
sudo ufw default allow outgoing
sudo ufw default deny incoming
- Enable UFW to start on boot:
sudo ufw enable
- Verify the current UFW rules:
sudo ufw status
You should see output similar to the following:
Status: active
To Action From
-- ------ ----
22/tcp ALLOW IN Anywhere
22/tcp (v6) ALLOW IN Anywhere (v6)
80/tcp ALLOW OUT Anywhere
443/tcp ALLOW OUT Anywhere
10000/tcp ALLOW OUT Anywhere
10000/udp ALLOW OUT Anywhere
The above configuration allows outgoing connections on ports 80, 443, and 10000 (TCP), as well as their UDP counterparts. Incoming connections on port 22 (SSH) are blocked.
Here's a summary of the references used in this article:
-
Books:
- Eckstein, M. (2021). The Linux Firewall Book. No Starch Press.
-
Articles:
- UFW User's Guide (2022). Ubuntu. Retrieved from https://help.ubuntu.com/community/UFW
-
Online resources:
- UFW: Uncomplicated Firewall (2022). Kubuntu. Retrieved from https://kubuntu.org/docs/serverguide/security/firewall/