From f44200d581a0bf19da33a6c0c04040e7965ce3bf Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Sat, 7 Nov 2026 03:12:46 +0100 Subject: [PATCH] refac: extend egress rules to IPv6 (#209) The egress rules now also cover IPv6 traffic. --- entrypoint-slim.sh | 5 +++++ entrypoint.sh | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/entrypoint-slim.sh b/entrypoint-slim.sh index 5edba30..83e6eb2 100755 --- a/entrypoint-slim.sh +++ b/entrypoint-slim.sh @@ -191,6 +191,11 @@ setup_egress_firewall() { iptables -A OUTPUT -m set --match-set allowed dst -j ACCEPT fi iptables -A OUTPUT -j DROP + # The allowed set holds IPv4 addresses only + ip6tables -F OUTPUT + ip6tables -A OUTPUT -o lo -j ACCEPT + ip6tables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT + ip6tables -A OUTPUT -j DROP echo "Egress firewall active — dropping CAP_NET_ADMIN permanently" } diff --git a/entrypoint.sh b/entrypoint.sh index d3a4c4f..9449382 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -171,6 +171,11 @@ if [ "${OPEN_TERMINAL_ALLOWED_DOMAINS+set}" = "set" ]; then sudo iptables -A OUTPUT -m set --match-set allowed dst -j ACCEPT fi sudo iptables -A OUTPUT -j DROP + # The allowed set holds IPv4 addresses only + sudo ip6tables -F OUTPUT + sudo ip6tables -A OUTPUT -o lo -j ACCEPT + sudo ip6tables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT + sudo ip6tables -A OUTPUT -j DROP echo "Egress firewall active — dropping CAP_NET_ADMIN permanently" exec sudo -E PATH="$PATH" capsh --drop=cap_net_admin --user=user -- -c 'exec open-terminal "$@"' -- "$@"