Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ app_setup_block: |

# changelog
changelogs:
- { date: "12.10.22:", desc: "Add Alpine branch." }
- { date: "12.10.22:", desc: "Add Alpine branch. Optimize wg and coredns services." }
- { date: "09.10.22:", desc: "Switch back to iptables-legacy due to issues on some hosts." }
- { date: "04.10.22:", desc: "Rebase to Jammy. Upgrade to s6v3." }
- { date: "16.05.22:", desc: "Improve NAT handling in server mode when multiple ethernet devices are present." }
Expand Down
1 change: 1 addition & 0 deletions root/defaults/Corefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
. {
loop
health
forward . /etc/resolv.conf
}
3 changes: 1 addition & 2 deletions root/etc/s6-overlay/s6-rc.d/init-wireguard-confs/run
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ else
echo "**** No client conf found. Provide your own client conf as \"/config/wg0.conf\" and restart the container. ****"
sleep infinity
fi
echo "**** Disabling CoreDNS ****"
rm -rf /etc/services.d/coredns
printf "false" > /run/s6/container_environment/USE_COREDNS
fi

# set up CoreDNS
Expand Down
21 changes: 15 additions & 6 deletions root/etc/s6-overlay/s6-rc.d/svc-coredns/run
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#!/usr/bin/with-contenv bash

if netstat -apn | grep -q ":53 "; then
echo "Another service is using port 53, disabling CoreDNS"
sleep infinity
USE_COREDNS="false"
fi

if [[ ${USE_COREDNS} == "false" ]]; then
s6-notifyoncheck -d -n 300 -w 1000 -c "echo **** Disabling CoreDNS ****" \
sleep infinity
elif grep -q "health" /config/coredns/Corefile; then
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "redirfd -w 1 /dev/null curl -s http://localhost:8080/health" \
cd /config/coredns \
/app/coredns -dns.port=53
else
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z -u 127.0.0.1 53" \
cd /config/coredns \
/app/coredns -dns.port=53
exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -zu localhost 53" \
cd /config/coredns \
/app/coredns -dns.port=53
fi
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-wireguard/down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/svc-wireguard/finish
3 changes: 3 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-wireguard/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/with-contenv bash

wg-quick down wg0
11 changes: 0 additions & 11 deletions root/etc/s6-overlay/s6-rc.d/svc-wireguard/run
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
#!/usr/bin/with-contenv bash

_term() {
echo "Caught SIGTERM signal!"
wg-quick down wg0
}

trap _term SIGTERM

wg-quick up wg0

sleep infinity &

wait
2 changes: 1 addition & 1 deletion root/etc/s6-overlay/s6-rc.d/svc-wireguard/type
Original file line number Diff line number Diff line change
@@ -1 +1 @@
longrun
oneshot
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-wireguard/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/svc-wireguard/run