Firewall
- UFW
Contents
UFW #
ufw, uncomplicated firewall is a simple firewall command line utility.
Example: Setup for SSH #
This will block all incoming connections by default and creates an execption for SSH (port 22):
ufw default deny incoming
ufw allow in ssh
ufw enable
Warning: if you are running this on a VPS you can be locked out if you acidentaly block your SSH port. You can fix this by opening the recovery environment and running ufw disable.
Enable/disable #
ufw enableufw disable
Status #
ufw statusufw status verbose
Open ports #
ufw allow 1234ufw allow in 1234ufw allow out 1234ufw allow in 1234 comment 'Description here'
Remove rules #
- Run
ufw status numberedto show all rules with a number - Run
ufw remove [number]to remove a rule