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

fix: correctly set default routes

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