[c] bugfixing for firewall

This commit is contained in:
Sangelo 2024-10-16 21:40:36 +02:00
parent b8500d3dee
commit d61cf8e414
2 changed files with 4 additions and 2 deletions

View file

@ -9,7 +9,8 @@ common_firewall_reject: false # reject all connections by default
# Default Firewall Rules # Default Firewall Rules
common_firewall: common_firewall:
- port: 22 - port: 22
state: allow rule: allow
state: present
interface: "{{ common_firewall_lan_interface if common_firewall_lan_interface }}" interface: "{{ common_firewall_lan_interface if common_firewall_lan_interface }}"
comment: "Allow incoming connections on {{ common_firewall_lan_interface if common_firewall_lan_interface else 'all interfaces' }}" comment: "Allow incoming connections on {{ common_firewall_lan_interface if common_firewall_lan_interface else 'all interfaces' }}"

View file

@ -39,7 +39,8 @@
- name: Configure firewall rules - name: Configure firewall rules
community.general.ufw: community.general.ufw:
port: "{{ rule.port }}" port: "{{ rule.port }}"
rule: "{{ rule.state | default('allow') }}" rule: "{{ rule.rule | default('allow') }}"
delete: "{{ true if rule.state == 'absent' else false | default(false) }}"
proto: "{{ rule.protocol | default('tcp') }}" proto: "{{ rule.protocol | default('tcp') }}"
interface: "{{ rule.interface if rule.interface != 'all' else omit }}" interface: "{{ rule.interface if rule.interface != 'all' else omit }}"
comment: "{{ rule.comment | default('Custom rule for port {{ rule.port }} on {{ rule.interface }}') }}" comment: "{{ rule.comment | default('Custom rule for port {{ rule.port }} on {{ rule.interface }}') }}"