Stabilize ARM restart path for DNS and proxy services

This commit is contained in:
auto-ci
2026-03-05 20:52:06 -05:00
parent 4cae0783a6
commit 2e56306a4e
6 changed files with 97 additions and 5 deletions
+1 -1
View File
@@ -8,4 +8,4 @@ generated.yml
# local runtime state
pihole/etc-pihole/
tailscale/
# tailscale source files are versioned; runtime state is stored in Docker volume
Submodule PopuraDNS updated: ea3a9e4232...584c991eb1
+6 -3
View File
@@ -14,7 +14,9 @@
services:
dark3proxy:
platform: linux/arm64
# 3proxy-eagle does not currently build reliably for arm64 in this repo.
# Keep this service on amd64 under ARM override to avoid restart loops.
platform: linux/amd64
i2pd_yggdrasil:
build:
@@ -36,10 +38,11 @@ services:
platform: linux/arm64
coredns:
platform: linux/arm64
# Current local CoreDNS build path is validated on amd64.
platform: linux/amd64
unbound:
platform: linux/arm64
platform: linux/amd64
pihole:
platform: linux/arm64
+16
View File
@@ -0,0 +1,16 @@
#syntax=docker/dockerfile:1
FROM tailscale/tailscale:latest
RUN apk add --no-cache \
iptables \
socat \
curl \
bash \
redsocks
COPY ./post-rules.sh /post-rules.sh
COPY ./redsocks.conf /etc/redsocks.conf
RUN chmod +x /post-rules.sh
# Entrypoint to configure and start Tailscale + traffic redirection
ENTRYPOINT ["/post-rules.sh"]
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
set -e
# Start Tailscale in background
/usr/local/bin/tailscaled --tun=userspace-networking &
TAILSCALED_PID=$!
# Wait for Tailscale to initialize
sleep 2
# Authenticate with Tailscale via auth key
if [ -n "$TS_AUTHKEY" ] && [ "$TS_AUTHKEY" != "tskey-YOUR-AUTH-KEY-HERE" ]; then
# tailscale up flags change over time; avoid deprecated options.
/usr/local/bin/tailscale up --authkey="$TS_AUTHKEY" ${TS_EXTRA_ARGS:-"--accept-dns=false --advertise-exit-node"} || true
else
echo "TS_AUTHKEY is not set to a real key; skipping tailscale up"
fi
# Wait a bit for Tailscale to be ready
sleep 3
# Configure iptables to redirect all traffic through redsocks
echo "Setting up iptables rules for traffic redirection..."
# Enable IP forwarding for exit node
sysctl -w net.ipv4.ip_forward=1 2>/dev/null || true
sysctl -w net.ipv6.conf.all.forwarding=1 2>/dev/null || true
# Create a chain for darkproxy traffic
iptables -t nat -N DARKPROXY 2>/dev/null || iptables -t nat -F DARKPROXY
# Whitelist local traffic and Tailscale
iptables -t nat -A DARKPROXY -d 127.0.0.0/8 -j RETURN
iptables -t nat -A DARKPROXY -d 10.5.0.0/16 -j RETURN
iptables -t nat -A DARKPROXY -d 100.64.0.0/10 -j RETURN # Tailscale IP range
# Redirect all other TCP to redsocks
iptables -t nat -A DARKPROXY -p tcp -j REDIRECT --to-ports 12345
# Apply chain to all output
iptables -t nat -I OUTPUT 1 -j DARKPROXY 2>/dev/null || true
iptables -t nat -I PREROUTING 1 -j DARKPROXY 2>/dev/null || true
echo "Starting redsocks..."
redsocks -c /etc/redsocks.conf
# Keep container alive
wait $TAILSCALED_PID
+25
View File
@@ -0,0 +1,25 @@
base {
log_debug = off;
log_info = on;
log = "stderr";
daemon = on;
redirector = iptables;
}
redsocks {
local_ip = 0.0.0.0;
local_port = 12345;
ip = 10.5.0.8;
port = 1080;
type = socks5;
}
redudp {
local_ip = 0.0.0.0;
local_port = 10053;
ip = 10.5.0.8;
port = 1080;
dest_ip = 10.5.0.6;
dest_port = 53;
}