-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
53 lines (44 loc) · 1.66 KB
/
entrypoint.sh
File metadata and controls
53 lines (44 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bash
set -euo pipefail
# ── DNS Configuration ────────────────────────────────────────────────
# Start dnsmasq for local DNS forwarding. This is required for tools
# that bypass the system resolver (e.g., Rust reqwest) and need a DNS
# server on localhost.
DNSMASQ_CONF="/tmp/dnsmasq.conf"
# Build dnsmasq config from resolv.conf
{
echo "# Auto-generated dnsmasq config"
echo "listen-address=127.0.0.1"
echo "port=53"
echo "bind-interfaces"
echo "no-resolv"
echo "no-poll"
echo "no-daemon"
# Forward to upstream DNS servers from resolv.conf
if [[ -f /etc/resolv.conf ]]; then
while IFS= read -r line; do
if [[ "$line" =~ ^nameserver[[:space:]]+(.+) ]]; then
server="${BASH_REMATCH[1]}"
# Skip localhost (that would be us)
if [[ "$server" != "127.0.0.1" && "$server" != "::1" ]]; then
echo "server=$server"
fi
fi
done < /etc/resolv.conf
fi
# Use custom DNS if provided
if [[ -n "${SQUID_DNS:-}" ]]; then
echo "server=$SQUID_DNS"
fi
# Fallback public DNS
echo "server=8.8.8.8"
echo "server=1.1.1.1"
} > "$DNSMASQ_CONF"
echo "Starting dnsmasq..."
dnsmasq --conf-file="$DNSMASQ_CONF" &
DNSMASQ_PID=$!
# Give dnsmasq a moment to start
sleep 0.2
# ── Paude Proxy ─────────────────────────────────────────────────────
echo "Starting paude-proxy..."
exec /usr/local/bin/paude-proxy