The following is the GNU All-permissive License as recommended in https://www.gnu.org/licenses/license-recommendations.en.html

Copyright (C) 2024 Free Software Foundation sysadmin@fsf.org

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.

Contributions are welcome. See https://savannah.gnu.org/maintenance/fsf/.

ufw

ufw (Uncomplicated Firewall) is used by some VMs in Ansible. To enable ufw for the VM, add it to the ufw group. Note that rules stick around, even if you remove the rule from ansible that added the firewall rule. You have to add a rule to delete it in Ansible, or delete any custom rules by hand.

To see a list of firewall rules:

ufw show added

The above format allows you to copy and paste a rule then to add the word delete after ufw to remove the rule. Make sure to include the comment keyword and its quoted value.

You may also be interested in a shorter form:

ufw status

Add an IP address for example giving access to a volunteer. Replace 127.0.0.1 with their IP address

ufw insert 1 allow from 127.0.0.1 comment 'Allow Eric in.'

To add an IPv6 address, it needs to come after IPv4 rules. Using insert 1 will result in ERROR: Invalid position '1'. Use ufw status and count the number of rules until an IPv6 rule and insert above that. More information.

Resources