17 Commits
Author SHA1 Message Date
chrisandClaude Opus 5.5 a0e573f1ae Role ipt-server: detect ulogd2 via systemd instead of ps (logging_ipv{4,6}.conf).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 23:17:05 +01:00
chrisandClaude Opus 5.5 02990faf70 Role ipt-server: configurable rate for the new-TCP-connection limit; new defaults.
- Sync ipt-firewall-server, ip6t-firewall-server and default_settings.conf
  with firewall/ipt-server affa35d: new limit_new_tcp_connections_per_seconds_rate
  (default 30, burst twice the rate); the rule now only drops SYNs above the
  limit instead of accepting those below it; several IPv6 fixes.
- defaults: fw_limit_new_tcp_connections_per_seconds_per_source_IP: false,
  fw_limit_new_tcp_connections_per_seconds_ports: "80,110,143,443,465,995",
  new fw_limit_new_tcp_connections_per_seconds_rate (overridable with _v6).
- templates, extract-fw-host-vars.py, README: new variable and defaults.
- oolm-shop: drop fw_limit_new_tcp_connections_per_seconds_per_source_IP_v6
  (it would have enabled the limit for IPv6 with the new default ports).
- piwik: fw_manage_config: true, per_IP_connection_limit 501, no
  new-connection limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 18:51:16 +01:00
chrisandClaude Opus 5.5 ecc2ae2fbe Role ipt-server: restart docker after a firewall restart; roll out to 18 hosts.
- handlers: a firewall restart flushes the DOCKER* chains and docker's NAT
  rules; restart docker afterwards if it is running (like fail2ban).
- host_vars: add values missing from host_vars generated by an older
  extract-fw-host-vars.py:
  - mm-irights, mm-nd, mm-rav: fw_mm_server_ips
  - test.mx: fw_mail_client_ips_v6, fw_dovecot_auth_service_v6,
    fw_mumble_server_ips_v6
  - mm: fw_allow_local_service_v6 uses "<port>,<proto>" (the IPv6 script
    splits on ',', the IPv4 script on ':').

Rolled out to a.mx, a.ns, b.mx, b.ns, backup.warenform, cl-01, cl-02,
cl-dissens, cl-flr, cl-irights, cl-nd-test, cl-ndm, mm, mm-irights, mm-nd,
mm-rav, o45, test.mx; second run changed=0 on all of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 00:30:08 +01:00
chrisandClaude Opus 5.5 0499706703 extract-fw-host-vars.py: write host_vars/<host>/<short>-ipt-server.yml by default.
Without -o the script now writes the standard host_vars file (relative to
the script, independent of the cwd). An existing file is only overwritten
with --force; this is checked before connecting to the host. -o - prints
to stdout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 01:28:00 +01:00
chrisandClaude Opus 5.5 3e6486c5b5 extract-fw-host-vars.py: abort if a conf file cannot be read; add --from-dir. Migrate cl-test.
Previously an unreadable file (e.g. /etc/ipt-firewall is 0750 after the
role ran) silently produced almost empty host_vars. The script now exits
with an error and writes nothing. --from-dir reads the conf files from a
local directory, e.g. fetched with ansible using the vaulted become
password.

Add host_vars for cl-test.oopen.de (fw_manage_config: true).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 01:00:55 +01:00
chrisandClaude Opus 5.5 ec62f54ab4 Role ipt-server: restart fail2ban after a firewall restart if it is running.
A firewall restart flushes the fail2ban chains. The new handler restarts
fail2ban only if it is active; it does nothing if fail2ban is stopped or
not installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:52:08 +01:00
chrisandClaude Opus 5.5 3d6840ef3a Role ipt-server: allow IPv6-only overrides of shared variables; migrate nd, oolm-shop, web-01, web0.
Shared variables (and fw_ext_interfaces / fw_local_interfaces) can now be
overridden for IPv6 via <name>_v6. extract-fw-host-vars.py emits these
overrides when the IPv4 and IPv6 configs differ, instead of a warning.

Add host_vars for nd.warenform.de, oolm-shop.oopen.de, web-01.oopen.de
and web0.warenform.de (fw_manage_config: true).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:50:03 +01:00
chrisandClaude Opus 5.5 402a6c9e89 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>
2026-11-02 22:01:28 +01:00
chris 965ad5cde2 fix: specify ansible.builtin.template for service file and configuration deployments 2026-07-30 23:48:29 +02:00
chris e74fca04a2 Update migration guide: add step to freeze current firewall rules and create ipt-server.yml for a.ns.oopen.de with initial configuration 2026-06-29 11:38:20 +02:00
chris ba5683864a Add sudo to iptables-save commands in migration guide for proper permissions 2026-06-29 08:20:02 +02:00
chris 1171d156b7 Add sudo to iptables-save commands in migration guide for proper permissions 2026-06-29 08:16:53 +02:00
chris 682a08b53e Refactor extract-fw-host-vars.py to improve quoted value handling and add fw_manage_config to generated YAML; create ipt-server.yml for a.mx.oopen.de with initial configuration 2026-06-29 08:13:40 +02:00
chris f149b09892 Refactor ipt-server role: update migration and README for hostname variable usage; remove obsolete ipt-server.yml for cloud-01.oopen.de 2026-06-27 22:38:12 +02:00
chris 7db2b7ee9b Update ipt-server role: specify hosts in ipt-server.yml and add configuration for cloud-01.oopen.de 2026-06-27 22:23:49 +02:00
chris 5a98895b66 Role ipt-server: rename 'host_vars/<server-name>/ipt_firewall.yml' to 'host_vars/<server-name>/ipt-server.yml'. 2026-06-27 02:32:15 +02:00
chris 9798ca9cd6 Add ipt-server role with firewall configuration and management
- Created handlers for reloading systemd and restarting firewall services.
- Implemented tasks to ensure the existence of configuration directories and files.
- Deployed host-specific and shared configuration files using templates.
- Added scripts for managing IPv4 and IPv6 firewalls.
- Configured systemd service units for ipt-firewall and ip6t-firewall.
- Enabled and started firewall services on system boot.
2026-06-26 19:30:01 +02:00