ufw
ufw
Set up ufw in Debian-like systems.
Requirements
None
Variables
ufw_default_incoming_policy
[default:deny
]: Default (incoming) policyufw_default_outgoing_policy
[default:allow
]: Default (outgoing) policyufw_logging
[default:off
]: Log levelufw_rules
[default: seedefaults/main.yml
]: Rules to applyufw_etc_default_ipv6
[default:true
]: Set to yes to apply rules to support IPv6ufw_etc_default_default_input_policy
[default:DROP
]: Set the default input policy toACCEPT
,DROP
, orREJECT
. Please note that if you change this you will most likely want to adjust your rulesufw_etc_default_default_output_policy
[default:ACCEPT
]: Set the default output policy toACCEPT
,DROP
, orREJECT
. Please note that if you change this you will most likely want to adjust your rulesufw_etc_default_default_forward_policy
[default:DROP
]: Set the default forward policy toACCEPT
,DROP
orREJECT
. Please note that if you change this you will most likely want to adjust your rulesufw_etc_default_default_application_policy
[default:SKIP
]: Set the default application policy toACCEPT
,DROP
,REJECT
orSKIP
. Please note that setting this toACCEPT
may be a security riskufw_etc_default_manage_builtins
[default:false
]: By default, ufw only touches its own chains. Set this to 'yes' to have ufw manage the built-in chains too. Warning: setting this to 'yes' will break non-ufw managed firewall rulesufw_etc_default_ipt_sysctl
[default:/etc/ufw/sysctl.conf
]: IPT backend, only enable if using iptables backendufw_etc_default_ipt_modules
[default:[nf_conntrack_ftp, nf_nat_ftp, nf_conntrack_netbios_ns]
]: Extra connection tracking modules to load. Complete list can be found innet/netfilter/Kconfig
of your kernel source
Dependencies
None
Example
---
- hosts: all
roles:
- ufw
Allow ssh
- hosts: all
roles:
- ufw
vars:
ufw_rules:
- rule: allow
to_port: 22
protocol: tcp
Allow all traffic on eth1
- hosts: all
roles:
- ufw
vars:
ufw_rules:
- rule: allow
interface: eth1
to_port: ''
Allow snmp traffic from 1.2.3.4 on eth0
- hosts: all
roles:
- ufw
vars:
ufw_rules:
- rule: allow
interface: eth0
from_ip: 1.2.3.4
to_port: 161
protocol: udp
License
MIT
Author Information
Mischa ter Smitten (based on work of weareinteractive)
Feedback, bug-reports, requests, ...
Are welcome!
ansible-galaxy install kmonticolo/ansible-ufw