Install Uncomplicated Firewall to a Raspberry Pi

--

Uncomplicated Firewall (ufw) is an easy-to-use front-end for iptables, it blocks all incoming connections by default ✅.

Raspberry Pi OS doesn’t automatically come with this app, we need to install it (yes, I also think it should be a default app)

$ sudo apt install ufw

I’m connecting to my Raspberry Pi via SSH, so to not get locked out enable it with the following command:

$ sudo ufw allow ssh/tcp

Enable logging (optional)

$ sudo ufw logging on

Turn it on:

$ sudo ufw enable

Check status:

$ sudo ufw status
Status: active

To Action From
-- ------ ----
22/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)

As you can see, ssh is the only enabled port ✅

References

--

--

Salvador Guerrero
Salvador Guerrero

Written by Salvador Guerrero

Computer Science Engineer, Cross-Platform App Developer, Open Source contributor. 🇲🇽🇺🇸

No responses yet