fix: strip IPv6 http_port listeners when IPv6 is disabled in Squid container#2203
fix: strip IPv6 http_port listeners when IPv6 is disabled in Squid container#2203
Conversation
🔥 Smoke Test: Copilot BYOK (Offline) — PASS
Running in BYOK offline mode ( Overall: PASS · Author:
|
|
Smoke Test Results: ✅ GitHub MCP: Last 2 merged PRs retrieved (#2200, #2183) Overall: PASS
|
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent the Squid container from failing at startup on Docker daemons with IPv6 disabled by removing IPv6 http_port [::]:... listeners from squid.conf at container startup when IPv6 is unavailable.
Changes:
- Detect IPv6 availability in the Squid container via
/proc/sys/net/ipv6/conf/all/disable_ipv6. - When IPv6 is disabled, edit
/etc/squid/squid.confto remove IPv6http_port [::]:...listeners before launching Squid.
Show a summary per file
| File | Description |
|---|---|
| containers/squid/entrypoint.sh | Adds an IPv6-disabled probe and attempts to strip IPv6 http_port listeners from squid.conf prior to starting Squid. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
| IPV6_DISABLED="$(cat /proc/sys/net/ipv6/conf/all/disable_ipv6 2>/dev/null || echo 1)" | ||
| if [ "$IPV6_DISABLED" = "1" ]; then | ||
| echo "[squid-entrypoint] IPv6 is disabled in this namespace - removing http_port [::]: listeners to prevent fatal startup error" | ||
| sed -i '/^http_port \[::\]:/d' /etc/squid/squid.conf |
There was a problem hiding this comment.
The sed deletion only removes a single http_port [::]:... line. In SSL Bump mode, the generated squid.conf has an IPv6 http_port [::]:3128 ssl-bump \\ line followed by indented continuation lines (cert=..., key=..., etc.); deleting just the http_port line would leave those continuation lines behind and break config parsing. Also, the SSL-bump http_port [::]:... line in the generated config is prefixed by whitespace, so the current ^http_port anchor likely won’t match and won’t prevent the original fatal error. Update the removal logic to (1) match optional leading whitespace and (2) remove the entire multi-line stanza for IPv6 http_port directives (the header line plus its continuation lines).
| sed -i '/^http_port \[::\]:/d' /etc/squid/squid.conf | |
| tmp_conf="$(mktemp)" | |
| awk ' | |
| skip && /^[[:space:]]+/ { next } | |
| skip { skip = 0 } | |
| /^[[:space:]]*http_port \[::\]:/ { skip = 1; next } | |
| { print } | |
| ' /etc/squid/squid.conf > "$tmp_conf" | |
| mv "$tmp_conf" /etc/squid/squid.conf |
🔥 Smoke Test Results
Overall: PASS ✅ PR: "fix: strip IPv6 http_port listeners when IPv6 is disabled in Squid container" — author
|
|
Smoke test results (run 24910109124) Warning The following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
Chroot Version Comparison Results
Result: Not all tests passed. Python and Node.js versions differ between host and chroot. Go matches.
|
Smoke Test Results: GitHub Actions Services Connectivity
Summary: All 3 checks failed.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
On Docker daemons with
ipv6: false(the default on most Linux distros), Squid aborts withFATAL: http_port: IPv6 is not availablebecause Docker injectsnet.ipv6.conf.all.disable_ipv6=1into the container network namespace and Squid treats thehttp_port [::]:3128directive as fatal during config parse — before opening any log files.Changes
containers/squid/entrypoint.sh: Before starting Squid, probe/proc/sys/net/ipv6/conf/all/disable_ipv6. If IPv6 is disabled, strip allhttp_port [::]:lines from/etc/squid/squid.confviasedso Squid starts normally. The dual-stack listener is preserved on hosts where IPv6 is available.This handles both the plain-proxy and SSL-bump port configs, which both emit
http_port [::]:3128unconditionally fromsrc/squid-config.ts.