Skip to content

Setup firewall

Danny Bouwers edited this page Mar 4, 2022 · 1 revision

The most easy way to setup a firewall, is by making use of UFW (Uncomplicated Firewall). Luckily, it's available for Alpine Linux:

apk add ufw

For best security, block all incoming traffic by default and open ports once you need them to be open:

ufw default deny incoming # block incoming by default
ufw default allow outgoing # allow all outgoing
ufw allow ssh # allow ssh, to enable remote management
ufw allow https # allow https, that's where we'll find all proxied services
ufw allow http # allow http, so Traefik can be reached to redirect traffic to https
ufw allow from 192.168.0.0/16 # allow any traffic form LAN, e.g. for Unifi and AdGuard
ufw enable # enable the firewall
Clone this wiki locally