Skip to content

Commit 57205bc

Browse files
authored
fix: strip IPv6 http_port listeners when IPv6 is disabled in Squid container (#2203)
* Initial plan * fix: strip IPv6 http_port listeners when IPv6 is disabled in Squid container --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 971630b commit 57205bc

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

containers/squid/entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,18 @@ if [ -d "/var/spool/squid_ssl_db" ]; then
99
echo "[squid-entrypoint] SSL Bump mode detected - SSL database ready"
1010
fi
1111

12+
# Check if IPv6 is available in this container namespace.
13+
# On Docker daemons with `ipv6: false` (the default on most Linux distros), the kernel
14+
# sets net.ipv6.conf.all.disable_ipv6=1 inside every container network namespace.
15+
# Squid treats `http_port [::]:3128` as a FATAL error when IPv6 is unavailable, aborting
16+
# before opening log files and causing the container to exit(1) immediately.
17+
# If IPv6 is disabled we strip the dual-stack listener lines so Squid can start normally.
18+
# The defense-in-depth intent is preserved on runners that do have IPv6 enabled.
19+
IPV6_DISABLED="$(cat /proc/sys/net/ipv6/conf/all/disable_ipv6 2>/dev/null || echo 1)"
20+
if [ "$IPV6_DISABLED" = "1" ]; then
21+
echo "[squid-entrypoint] IPv6 is disabled in this namespace - removing http_port [::]: listeners to prevent fatal startup error"
22+
sed -i '/^http_port \[::\]:/d' /etc/squid/squid.conf
23+
fi
24+
1225
# Start Squid directly (already running as proxy user via Dockerfile USER directive)
1326
exec squid -N -d 1

0 commit comments

Comments
 (0)