brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ufw default deny incoming sets the policy for everything without a rule

Ufw
~/tips/tip-ufw-default-deny-incoming

sudo ufw default deny incoming

Sets what ufw does with traffic that none of your rules match.

A firewall is only as strict as its default. I set the defaults first and add the exceptions after.

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw default deny routed

Incoming and outgoing apply to traffic for the machine itself, while routed covers packets forwarded between interfaces. Deny for incoming and allow for outgoing is the usual setup. Set up an SSH rule before you enable ufw on a remote host, otherwise you cut off your own session. Switching outgoing to deny is possible but means every service needs an explicit rule, including DNS and updates.

Further reading: ufw manual page

More Ufw tips sudo ufw app update all sudo ufw show raw sudo ufw allow to 10.0.0.1 proto esp sudo ufw allow to 224.0.0.0/24 from 10.0.0.1 proto vrrp sudo ufw show listening All Ufw tips (32) All topics

Link