Browse Source

Add support for LOCAL_NETWORK environment variable

pull/14/head
Jordan Potter 4 years ago
parent
commit
42edf25751
  1. 11
      entrypoint.sh

11
entrypoint.sh

@ -2,6 +2,12 @@
set -e
default_route_ip=$(ip route | grep default | awk '{print $3}')
if [[ -z "$default_route_ip" ]]; then
echo "No default route configured" >&2
exit 1
fi
configs=`find /etc/wireguard -type f -printf "%f\n"`
if [[ -z "$configs" ]]; then
echo "No configuration files found in /etc/wireguard" >&2
@ -31,6 +37,11 @@ else
ip6tables -I OUTPUT ! -o $interface -m mark ! --mark $(wg show $interface fwmark) -m addrtype ! --dst-type LOCAL $docker6_network_rule -j REJECT
fi
if [[ "$LOCAL_NETWORK" ]]; then
ip route add $LOCAL_NETWORK via $default_route_ip
iptables -I OUTPUT -d $LOCAL_NETWORK -j ACCEPT
fi
shutdown () {
wg-quick down $interface
exit 0

Loading…
Cancel
Save