Compare commits
3 Commits
6b2fb5c0d7
...
3cc178f690
Author | SHA1 | Date | |
---|---|---|---|
3cc178f690 | |||
bd43aaea64 | |||
2d4fad9532 |
@@ -24,4 +24,5 @@ VOLUME ["/etc/wireguard"]
|
||||
|
||||
ENV WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun LOGNAME=nobody INTERFACE=wg0
|
||||
COPY set_gateway.sh /etc/wireguard/
|
||||
COPY persistentkeepalive.sh /etc/wireguard/
|
||||
ENTRYPOINT ["/sbin/tini", "--", "/bin/sh", "-c", "test -f \"/etc/wireguard/$INTERFACE.conf\" || ( umask 077 && printf '%s\\n' '[Interface]' 'Address = 10.8.0.1/24' 'PostUp = iptables --table nat --append POSTROUTING --jump MASQUERADE' 'PostDown = iptables --table nat --delete POSTROUTING --jump MASQUERADE' 'ListenPort = 51820' \"PrivateKey = $(wg genkey)\" | tee \"/etc/wireguard/$INTERFACE.conf\" ) && test -c /dev/net/tun || { mkdir -p /dev/net && mknod -m 666 /dev/net/tun c 10 200; } && exec wg-quick up \"$INTERFACE\"", "--"]
|
||||
|
6
persistentkeepalive.sh
Executable file
6
persistentkeepalive.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
sleep 15;
|
||||
PERSISTENT_KEEP_ALIVE=$(cat /etc/wireguard/wg0.conf | grep PersistentKeepalive | awk '{print $3}');
|
||||
WG_SERVER_IP="$(cat /etc/wireguard/wg0.conf | grep Address | awk '{print $3}' | cut -d . -f1-3).1";
|
||||
ping -s 0 -I wg0 -i $PERSISTENT_KEEP_ALIVE $WG_SERVER_IP
|
@@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
ENDPOINT=$(cat /etc/wireguard/wg0.conf | grep Endpoint | awk '{print $3}' |cut -d ':' -f1)
|
||||
ENDPOINT=$(cat /etc/wireguard/wg0.conf | grep Endpoint | awk '{print $3}' |cut -d ':' -f1);
|
||||
IP_GATEWAY=$(route -n | grep 'UG[ \t]' | awk '{print $2}');
|
||||
route add -host $ENDPOINT gw $IP_GATEWAY
|
||||
route add -host $ENDPOINT gw $IP_GATEWAY;
|
||||
|
||||
/etc/wireguard/persistentkeepalive.sh &
|
||||
|
Reference in New Issue
Block a user