feat(ufw): add the ufw role #129

Merged
Defame1297 merged 2 commits from feat/ufw-role into main 2026-11-14 17:02:08 +00:00
4 changed files with 4 additions and 5 deletions
Showing only changes of commit 077d8715bf - Show all commits

No files matched your search

+1 -2
View File
@@ -9,7 +9,7 @@ Ubuntu 24.04 (noble), the image the molecule scenario runs on. 22.04 (jammy) is
## Requirements and run order
- Use it by its fully qualified name, `mortis.kamino.ufw`.
- Run `mortis.kamino.system_baseline` before this role. UFW's stock `/etc/ufw/sysctl.conf` re-applies sysctl values when UFW is enabled, which undoes baseline hardening. Mirror the baseline values in `ufw_sysctl_overrides`.
- Run the `system_baseline` role of this Collection before this role. UFW's stock `/etc/ufw/sysctl.conf` re-applies sysctl values when UFW is enabled, which undoes baseline hardening. Mirror the baseline values in `ufw_sysctl_overrides`.
- Main entry point: apply it in the play that hardens a host, after `system_baseline` and `systemd_hardening`, before `fail2ban`.
- `service_rules` entry point: called by each service role that owns firewall rules (`include_role` with `tasks_from: service_rules`), after the main entry point has run, passing `ufw_service_name` and `ufw_service_rules`.
- `orphan_rules` entry point: called once per host after every service role ran, with `ufw_managed_owners` set to the owners that are still managed.
@@ -45,7 +45,6 @@ Skipping `ufw_aggregate` leaves the lists the later tasks read (`ufw_aggregated_
- name: Harden and firewall the servers
hosts: servers
roles:
- role: mortis.kamino.system_baseline
- role: mortis.kamino.ufw
vars:
ufw_rules:
+1 -1
View File
@@ -19,7 +19,7 @@ ufw_rules: []
ufw_before_rules: []
# Keys/values written into /etc/ufw/sysctl.conf so ufw's stock file does not
# reset values set by mortis.kamino.system_baseline. Set per group of hosts.
# reset values set by the system_baseline role of this Collection. Set per group of hosts.
ufw_sysctl_overrides: []
# service_rules entry point. The owner tag is written into each rule's
+1 -1
View File
@@ -81,7 +81,7 @@ argument_specs:
description:
- >-
List of C({name, value}) mappings written as C(name=value) into /etc/ufw/sysctl.conf, so UFW does not reset
values set by mortis.kamino.system_baseline. The role default is an empty list.
values set by the system_baseline role of this Collection. The role default is an empty list.
- C(name) uses slashes, for example C(net/ipv4/conf/all/log_martians).
service_rules:
short_description: Apply the firewall rules of one service, tagged with its name
+1 -1
View File
@@ -9,7 +9,7 @@
tasks:
- name: Install ufw
ansible.builtin.package:
name: mortis.kamino.ufw
name: ufw
state: present
# An application profile whose name holds openssh, for the orphan seeds below.