forked from ansible-lockdown/RHEL9-CIS
updated yamllint, company naming, linting and spacing
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This commit is contained in:
parent
1b694832bb
commit
2de8a39cdc
66 changed files with 461 additions and 675 deletions
|
|
@ -17,8 +17,7 @@
|
|||
state: present
|
||||
|
||||
- name: "4.1.2 | PATCH | Ensure a single firewall configuration utility is in use"
|
||||
when:
|
||||
- rhel9cis_rule_4_1_2
|
||||
when: rhel9cis_rule_4_1_2
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
@ -52,7 +51,7 @@
|
|||
name: "{{ rhel9cis_firewall }}"
|
||||
state: installed
|
||||
|
||||
- name: "4.1.2 | PATCH | Ensure a single firewall configuration utility is in use | {{ rhel9cis_firewall }} started and enabled"
|
||||
- name: "4.1.2 | PATCH | Ensure a single firewall configuration utility is in use | {{ rhel9cis_firewall }} started and enabled" # noqa name[template]
|
||||
ansible.builtin.systemd:
|
||||
name: "{{ rhel9cis_firewall }}"
|
||||
enabled: true
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
---
|
||||
|
||||
- name: "4.2.1 | AUDIT | Ensure firewalld drops unnecessary services and ports"
|
||||
when:
|
||||
- rhel9cis_rule_4_2_1
|
||||
when: rhel9cis_rule_4_2_1
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
@ -25,8 +24,7 @@
|
|||
- "{{ discovered_services_and_ports.stdout_lines }}"
|
||||
|
||||
- name: "4.2.2 | PATCH | Ensure firewalld loopback traffic is configured | firewalld"
|
||||
when:
|
||||
- rhel9cis_rule_4_2_2
|
||||
when: rhel9cis_rule_4_2_2
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@
|
|||
- rhel9cis_rule_4_3_3
|
||||
- rhel9cis_rule_4_3_4
|
||||
tags: always
|
||||
ansible.builtin.shell: "nft add table inet {{ rhel9cis_nft_tables_tablename }}"
|
||||
ansible.builtin.command: "nft add table inet {{ rhel9cis_nft_tables_tablename }}"
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.1 | PATCH | Ensure nftables base chains exist"
|
||||
when:
|
||||
- rhel9cis_rule_4_3_1
|
||||
when: rhel9cis_rule_4_3_1
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
@ -52,7 +52,8 @@
|
|||
|
||||
- name: "4.3.1 | PATCH | Ensure nftables base chains exist | Create chains if needed"
|
||||
when: rhel9cis_nft_tables_autochaincreate
|
||||
ansible.builtin.shell: "{{ item }}"
|
||||
ansible.builtin.command: "{{ item }}"
|
||||
changed_when: true
|
||||
failed_when: false
|
||||
loop:
|
||||
- nft create chain inet "{{ rhel9cis_nft_tables_tablename }}" input { type filter hook input priority 0 \; }
|
||||
|
|
@ -60,8 +61,7 @@
|
|||
- nft create chain inet "{{ rhel9cis_nft_tables_tablename }}" output { type filter hook output priority 0 \; }
|
||||
|
||||
- name: "4.3.2 | PATCH | Ensure nftables established connections are configured"
|
||||
when:
|
||||
- rhel9cis_rule_4_3_2
|
||||
when: rhel9cis_rule_4_3_2
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
@ -84,31 +84,36 @@
|
|||
|
||||
- name: "4.3.2| PATCH | Ensure nftables established connections are configured | Add input tcp established accept policy"
|
||||
when: '"ip protocol tcp ct state established accept" not in discovered_nftables_inconnectionrule.stdout'
|
||||
ansible.builtin.shell: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" input ip protocol tcp ct state established accept
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" input ip protocol tcp ct state established accept
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.2 | PATCH | Ensure nftables established connections are configured | Add input udp established accept policy"
|
||||
when: '"ip protocol udp ct state established accept" not in discovered_nftables_inconnectionrule.stdout'
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" input ip protocol udp ct state established accept
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.2 | PATCH | Ensure nftables established connections are configured | Add input icmp established accept policy"
|
||||
when: '"ip protocol icmp ct state established accept" not in discovered_nftables_inconnectionrule.stdout'
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" input ip protocol icmp ct state established accept
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.2 | PATCH | Ensure nftables established connections are configured | Add output tcp new, related, established accept policy"
|
||||
when: '"ip protocol tcp ct state established,related,new accept" not in discovered_nftables_outconnectionrule.stdout'
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" output ip protocol tcp ct state new,related,established accept
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.2 | PATCH | Ensure nftables established connections are configured | Add output udp new, related, established accept policy"
|
||||
when: '"ip protocol udp ct state established,related,new accept" not in discovered_nftables_outconnectionrule.stdout'
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" output ip protocol udp ct state new,related,established accept
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.2 | PATCH | Ensure nftables established connections are configured | Add output icmp new, related, established accept policy"
|
||||
when: '"ip protocol icmp ct state established,related,new accept" not in discovered_nftables_outconnectionrule.stdout'
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" output ip protocol icmp ct state new,related,established accept
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.3 | PATCH | Ensure nftables default deny firewall policy"
|
||||
when:
|
||||
- rhel9cis_rule_4_3_3
|
||||
when: rhel9cis_rule_4_3_3
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
@ -144,22 +149,25 @@
|
|||
- name: "4.3.3 | PATCH | Ensure nftables default deny firewall policy | Enable SSH traffic"
|
||||
when: '"tcp dport ssh accept" not in discovered_nftables_sshallowcheck.stdout'
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" input tcp dport ssh accept
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.3 | PATCH | Ensure nftables default deny firewall policy | Set hook input deny policy"
|
||||
when: '"type filter hook input priority 0; policy drop;" not in discovered_nftables_inputpolicy.stdout'
|
||||
ansible.builtin.command: nft chain inet "{{ rhel9cis_nft_tables_tablename }}" input { policy drop \; }
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.3 | PATCH | Ensure nftables default deny firewall policy | Create hook forward deny policy"
|
||||
when: '"type filter hook forward priority 0; policy drop;" not in discovered_nftables_forwardpolicy.stdout'
|
||||
ansible.builtin.command: nft chain inet "{{ rhel9cis_nft_tables_tablename }}" forward { policy drop \; }
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.3 | PATCH | Ensure nftables default deny firewall policy | Create hook output deny policy"
|
||||
when: '"type filter hook output priority 0; policy drop;" not in discovered_nftables_outputpolicy.stdout'
|
||||
ansible.builtin.command: nft chain inet "{{ rhel9cis_nft_tables_tablename }}" output { policy drop \; }
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.4 | PATCH | Ensure nftables loopback traffic is configured"
|
||||
when:
|
||||
- rhel9cis_rule_4_3_4
|
||||
when: rhel9cis_rule_4_3_4
|
||||
tags:
|
||||
- level1-server
|
||||
- level1-workstation
|
||||
|
|
@ -189,11 +197,14 @@
|
|||
- name: "4.3.4 | PATCH | Ensure nftables loopback traffic is configured | Set iif lo accept rule | nftables"
|
||||
when: '"iif \"lo\" accept" not in discovered_nftables_iiflo.stdout'
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" input iif lo accept
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.4 | PATCH | Ensure nftables loopback traffic is configured | Set ip sddr rule | nftables"
|
||||
when: '"ip saddr 127.0.0.0/8 counter packets 0 bytes 0 drop" not in discovered_nftables_ipsaddr.stdout'
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" input ip saddr 127.0.0.0/8 counter drop
|
||||
changed_when: true
|
||||
|
||||
- name: "4.3.4 | PATCH | Ensure nftables loopback traffic is configured | Set ip6 saddr rule | nftables"
|
||||
when: '"ip6 saddr ::1 counter packets 0 bytes 0 drop" not in discovered_nftables_ip6saddr.stdout'
|
||||
ansible.builtin.command: nft add rule inet "{{ rhel9cis_nft_tables_tablename }}" input ip6 saddr ::1 counter drop
|
||||
changed_when: true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue