diff --git a/scripts/disable-ipv6.sh b/scripts/disable-ipv6.sh new file mode 100644 index 0000000..79c978c --- /dev/null +++ b/scripts/disable-ipv6.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# +# disable-ipv6.sh — kill IPv6 live + persist (no reboot) [#748] +# Run as root. Idempotent. Charles ruling 2026-09-03: IPv6 off fleet-wide. +# Rollback per host: delete /etc/sysctl.d/99-disable-ipv6.conf, then +# sysctl -w net.ipv6.conf.all.disable_ipv6=0 (and per-interface =0 as needed). +# +set -euo pipefail + +CONF=/etc/sysctl.d/99-disable-ipv6.conf +cat > "$CONF" <<'EOF' +# IPv6 disabled fleet-wide (Charles ruling 2026-09-03, [#748], follow-on to [#745]) +# Rollback: delete this file, then set net.ipv6.conf.{all,default,lo}.disable_ipv6=0 +net.ipv6.conf.all.disable_ipv6 = 1 +net.ipv6.conf.default.disable_ipv6 = 1 +net.ipv6.conf.lo.disable_ipv6 = 1 +EOF + +# Live apply: 'all' gates new traffic; per-interface flags disable existing ifs +# (incl. lo, tailscale0, docker0 — fleet-wide consistent, v4 everywhere). +sysctl -q -w net.ipv6.conf.all.disable_ipv6=1 +sysctl -q -w net.ipv6.conf.default.disable_ipv6=1 +sysctl -q -w net.ipv6.conf.lo.disable_ipv6=1 +for f in /proc/sys/net/ipv6/conf/*/disable_ipv6; do + echo 1 > "$f" 2>/dev/null || true +done + +v=$(sysctl -n net.ipv6.conf.all.disable_ipv6) +n=$(ip -6 addr show 2>/dev/null | grep -c inet6 || true) +echo "host=$(hostname) ipv6_disabled=$v remaining_inet6_addrs=$n" diff --git a/siem/deploy-agent.sh b/siem/deploy-agent.sh index e3fe0e2..59a88c1 100644 --- a/siem/deploy-agent.sh +++ b/siem/deploy-agent.sh @@ -27,6 +27,16 @@ if ! grep -q "
$MGR" "$CONF"; then sed -i "s|[^<]*|$MGR|" "$CONF" fi +# Package robustness (learned on PMG/PBS hosts 2026-09-03): postinst can +# leave the MANAGER_IP placeholder, a missing wazuh user, and root:root +# ownership — all three break startup with misleading errors. +id wazuh >/dev/null 2>&1 || useradd -r -d /var/ossec -s /usr/sbin/nologin wazuh +sed -i "s|MANAGER_IP|$MGR|" "$CONF" +chown -R root:wazuh /var/ossec 2>/dev/null || true +chown -R wazuh:wazuh /var/ossec/queue /var/ossec/logs /var/ossec/etc 2>/dev/null || true +chown root:wazuh /var/ossec/var/run 2>/dev/null || true +chmod 770 /var/ossec/queue/sockets /var/ossec/var/run /var/ossec/etc 2>/dev/null || true + systemctl enable wazuh-agent >/dev/null 2>&1 || true systemctl restart wazuh-agent sleep 8