Role ipt-server: sync with ipt-server repo (93d9af8); adapt extract-fw-host-vars.py.

- Update firewall scripts and shared conf files from firewall/ipt-server
  (HTTP connection limits, IPv6 TCP MSS clamping, ban_ipv6_mask,
  mattermost TCP fallback, rename 'stansard_*' -> 'standard_*').
- New role variables: fw_set_max_new_http_conn_per_ip_per_second,
  fw_max_http_new_conn_per_ip_per_second, fw_set_max_concurrent_http_conn_per_ip,
  fw_max_concurrent_http_conn_per_ip, fw_set_max_new_http_conn_per_second,
  fw_max_new_http_conn_per_second, fw_throttle_tcp6_mss_for_https,
  fw_tcp6_mss_for_https_val, fw_mm_tcp_ports_in, fw_ban_ipv6_mask.
- Split fw_blocked_ips into fw_blocked_ips_v4 / fw_blocked_ips_v6 and
  rename it in host_vars accordingly.
- Restart firewall when scripts or shared conf files change.
- extract-fw-host-vars.py: map new variables, normalize '${var}' and renamed
  bash variables, fall back to IPv6 for shared variables and warn if IPv4
  and IPv6 values differ.
- README.md / MIGRATION.md: document host_vars naming
  (<short-hostname>-ipt-server.yml) and new variables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 22:01:28 +01:00
co-authored by Claude Opus 5.5
parent 4a6fc84c01
commit 402a6c9e89
22 changed files with 666 additions and 55 deletions
+29 -5
View File
@@ -42,9 +42,14 @@ roles/ipt-server/
Host-spezifische Konfiguration liegt ausschließlich in:
```
host_vars/${HOSTNAME}/ipt-server.yml
host_vars/${HOSTNAME}/${HOSTNAME%.*.*}-ipt-server.yml
```
Der Dateiname beginnt mit dem Hostnamen ohne Domain, z.B.
`host_vars/a.mx.oopen.de/a.mx-ipt-server.yml` oder
`host_vars/backup.oopen.de/backup-ipt-server.yml`
(`${HOSTNAME%.*.*}` schneidet die letzten zwei Labels ab).
---
## Neuen Host aufnehmen
@@ -61,7 +66,7 @@ cd /path/to/ansible/oopen-server
HOSTNAME=<hostname>
mkdir -p host_vars/${HOSTNAME}
cat > host_vars/${HOSTNAME}/ipt-server.yml << 'EOF'
cat > host_vars/${HOSTNAME}/${HOSTNAME%.*.*}-ipt-server.yml << 'EOF'
---
fw_manage_config: true
@@ -111,7 +116,7 @@ Was passiert:
Alle Änderungen erfolgen ausschließlich in der host_vars-Datei des Hosts:
```
host_vars/${HOSTNAME}/ipt-server.yml
host_vars/${HOSTNAME}/${HOSTNAME%.*.*}-ipt-server.yml
```
Danach:
@@ -132,7 +137,7 @@ tatsächlichen Änderungen wird die Firewall neu gestartet.
### Beispiel: HTTP-Server aktivieren
```yaml
# host_vars/${HOSTNAME}/ipt-server.yml
# host_vars/${HOSTNAME}/${HOSTNAME%.*.*}-ipt-server.yml
fw_http_server_ips: "$ext_ips" # oder konkrete IP
```
@@ -172,8 +177,17 @@ chmod 750 $DST/ipt-firewall-server $DST/ip6t-firewall-server
Ebenso für geteilte Conf-Dateien in `roles/ipt-server/files/etc/ipt-firewall/`.
Kommen dabei neue Variablen in `main_ipv4.conf.sample` / `main_ipv6.conf.sample`
hinzu, müssen sie zusätzlich nachgezogen werden in:
- `defaults/main.yml` (als `fw_*`-Variable mit Default),
- `templates/etc/ipt-firewall/main_ipv{4,6}.conf.j2`,
- `extract-fw-host-vars.py` (`DEFAULTS`, `MAIN_SHARED` bzw. `MAIN_V4_ONLY`/`MAIN_V6_ONLY`,
Sektion in `render_yaml`).
Nach dem Commit werden die neuen Skripte beim nächsten Ansible-Run auf alle
Hosts deployed.
Hosts deployed. Geänderte Skripte oder geteilte Conf-Dateien lösen einen
Neustart der Firewall aus.
---
@@ -188,6 +202,16 @@ Hosts deployed.
| `fw_ssh_server_ips` | `"$ext_ips"` | IPs auf denen SSH erlaubt ist |
| `fw_ssh_ports` | `"$standard_ssh_port"` | SSH-Port(s) |
| `fw_http_server_ips` | `""` | IPs auf denen HTTP/HTTPS erlaubt ist |
| `fw_set_max_new_http_conn_per_ip_per_second` | `true` | Neue HTTP(S)-Verbindungen/s pro Quell-IP begrenzen |
| `fw_max_http_new_conn_per_ip_per_second` | `"$default_max_http_new_conn_per_ip_per_second"` | Limit dazu |
| `fw_set_max_concurrent_http_conn_per_ip` | `true` | Gleichzeitige HTTP(S)-Verbindungen pro Quell-IP begrenzen |
| `fw_max_concurrent_http_conn_per_ip` | `"$default_max_concurrent_http_conn_per_ip"` | Limit dazu |
| `fw_set_max_new_http_conn_per_second` | `true` | SYN-Rate auf 80/443 insgesamt begrenzen |
| `fw_max_new_http_conn_per_second` | `"$default_max_new_http_conn_per_second"` | Limit dazu |
| `fw_throttle_tcp6_mss_for_https` | `false` | Nur IPv6: MSS eingehender HTTPS-SYNs clampen |
| `fw_tcp6_mss_for_https_val` | `"$min_tcp6_mss_for_https_val"` | Nur IPv6: MSS-Wert (z.B. `1360`) |
| `fw_mm_tcp_ports_in` | `"$standard_mattermost_tcp_ports_in"` | Mattermost TCP-Fallback (STUN) |
| `fw_ban_ipv6_mask` | `"$default_ban_ipv6_mask"` | Nur IPv6: Präfixlänge für `ban_ipv6.list`-Einträge ohne Maske |
| `munin_remote_ipv4` | `""` | Munin-Server IPv4 |
| `munin_remote_ipv6` | `""` | Munin-Server IPv6 |