Skip to content
Snippets Groups Projects
Verified Commit 3fd543e9 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

fix: correctly set default routes

parent d528ce58
No related branches found
No related tags found
No related merge requests found
Pipeline #2886 passed
......@@ -9,7 +9,7 @@ RUN rm /sbin/iptables /sbin/ip6tables
RUN ln -s /sbin/ip6tables-nft /sbin/ip6tables
RUN ln -s /sbin/iptables-nft /sbin/iptables
ENV LOCAL_NETWORK=""
ENV LOCAL_NETWORKS=""
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
#!/bin/sh
set -eu
if [ -n "$LOCAL_NETWORK" ]; then
if [ -n "$LOCAL_NETWORKS" ]; then
gateway=$(ip route list match 0.0.0.0 | grep -v tun0 | cut -d ' ' -f 3)
interface=$(ip route list match 0.0.0.0 | grep -v tun0 | cut -d ' ' -f 5)
echo gateway="$gateway"
......@@ -14,6 +14,8 @@ chmod 0666 /dev/net/tun
wg-quick up /wireguard.conf
if [ -n "$LOCAL_NETWORK" ]; then
ip r add "$LOCAL_NETWORK" via "${gateway}" dev "${interface}"
if [ -n "$LOCAL_NETWORKS" ]; then
for LOCAL_NETWORK in $LOCAL_NETWORKS; do
ip route add "$LOCAL_NETWORK" via "${gateway}" dev "${interface}"
done
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment