check new version
This commit is contained in:
27
roles/01-server_hardening/tasks/04-configure-firewall.yml
Normal file
27
roles/01-server_hardening/tasks/04-configure-firewall.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
- name: Install UFW firewall
|
||||
ansible.builtin.apt:
|
||||
name: ufw
|
||||
state: present
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: Configure UFW defaults
|
||||
community.general.ufw:
|
||||
direction: "{{ item.direction }}"
|
||||
policy: "{{ item.policy }}"
|
||||
loop:
|
||||
- { direction: 'incoming', policy: 'deny' }
|
||||
- { direction: 'outgoing', policy: 'allow' }
|
||||
notify: reload firewall
|
||||
|
||||
- name: Allow TCP ports
|
||||
community.general.ufw:
|
||||
rule: allow
|
||||
port: "{{ item }}"
|
||||
proto: tcp
|
||||
loop: "{{ firewall_allowed_tcp_ports }}"
|
||||
notify: reload firewall
|
||||
|
||||
- name: Enable UFW
|
||||
community.general.ufw:
|
||||
state: enabled
|
Reference in New Issue
Block a user