Skip to content

Commit 9ec8bd1

Browse files
committed
Fix PID file permission denied: use squid-writable directory
squid -z (as root) creates /var/run/squid.pid, then gosu drops to squid user which can't overwrite the root-owned file. Fixes: - Test configs: pid_filename /var/run/squid/squid.pid (squid-owned) - Entrypoint: remove stale PID file before starting as squid user https://claude.ai/code/session_01Tfy3kPd51qRgxpCFXjb2g9
1 parent 8654b32 commit 9ec8bd1

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

.github/workflows/squid-build-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ jobs:
181181
cache_peer 127.0.0.1 parent 11080 0 no-query no-digest connect-fail-limit=2 connect-timeout=8 round-robin proxy-only originserver name=socks_test socks5
182182
visible_hostname test
183183
cache deny all
184+
pid_filename /var/run/squid/squid.pid
184185
cache_log /var/log/squid/cache.log
185186
access_log stdio:/var/log/squid/access.log combined
186187
CONF
@@ -335,6 +336,7 @@ jobs:
335336
cache_peer 127.0.0.1 parent 11081 0 no-query no-digest connect-fail-limit=2 connect-timeout=8 round-robin proxy-only originserver name=socks_auth socks5 socks-user=testuser socks-pass=testpass
336337
visible_hostname test
337338
cache deny all
339+
pid_filename /var/run/squid/squid.pid
338340
cache_log /var/log/squid/cache.log
339341
access_log stdio:/var/log/squid/access.log combined
340342
CONF

squid_patch/docker-entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ fi
1212
# Ensure proper ownership
1313
chown -R squid:squid /var/cache/squid /var/log/squid /var/run/squid 2>/dev/null || true
1414

15+
# Remove stale PID file left by squid -z (created as root)
16+
rm -f /var/run/squid.pid /var/run/squid/squid.pid 2>/dev/null || true
17+
1518
echo "Starting Squid with config: ${SQUID_CONFIG_FILE}"
1619
exec gosu squid squid -N -f "${SQUID_CONFIG_FILE}" "$@"

0 commit comments

Comments
 (0)