diff --git a/debian9-x86_64.sh b/debian9-x86_64.sh index 02702c3..57726c3 100644 --- a/debian9-x86_64.sh +++ b/debian9-x86_64.sh @@ -16,14 +16,14 @@ MLVPN_PASS=${MLVPN_PASS:-$(head -c 32 /dev/urandom | base64 -w0)} OPENVPN=${OPENVPN:-yes} DSVPN=${DSVPN:-yes} INTERFACE=${INTERFACE:-$(ip -o -4 route show to default | grep -m 1 -Po '(?<=dev )(\S+)' | tr -d "\n")} -KERNEL_VERSION="4.19.104" -KERNEL_PACKAGE_VERSION="1.7+b864616" +KERNEL_VERSION="5.4.0" +KERNEL_PACKAGE_VERSION="1.8+1efcfb3" KERNEL_RELEASE="${KERNEL_VERSION}-mptcp_${KERNEL_PACKAGE_VERSION}" -GLORYTUN_UDP_VERSION="a9408e799ddbb74b5476fba70a495770322cd327" +GLORYTUN_UDP_VERSION="c113724eb0370ecd80d038192deeeb82a13ebed3" #MLVPN_VERSION="8f9720978b28c1954f9f229525333547283316d2" MLVPN_VERSION="f45cec350a6879b8b020143a78134a022b5df2a7" OBFS_VERSION="486bebd9208539058e57e23a12f23103016e09b4" -OMR_ADMIN_VERSION="0bee06d21605c9d9b4494a77e71043ce432aa5c2" +OMR_ADMIN_VERSION="d14741092dfe0ff550f09eee8a03865726114427" DSVPN_VERSION="3b99d2ef6c02b2ef68b5784bec8adfdd55b29b1a" #V2RAY_VERSION="v1.1.0" V2RAY_VERSION="v1.2.0-8-g59b8f4f" @@ -32,7 +32,7 @@ SHADOWSOCKS_VERSION="3.3.3" VPS_DOMAIN=${VPS_DOMAIN:-$(wget -4 -qO- -T 2 http://hostname.openmptcprouter.com)} VPSPATH="server-test" -OMR_VERSION="0.1006-test1" +OMR_VERSION="0.1015" set -e umask 0022 @@ -109,7 +109,7 @@ if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "9" ] && [ "$UPDATE_DEBIAN" = "yes" VERSION_ID="10" fi # Add OpenMPTCProuter repo -echo 'deb https://repo.openmptcprouter.com stretch main' > /etc/apt/sources.list.d/openmptcprouter.list +echo 'deb [arch=amd64] https://repo.openmptcprouter.com stretch main' > /etc/apt/sources.list.d/openmptcprouter.list cat <= 0.30' echo '====================================================================================' + echo 'Restarting systemd daemon...' + systemctl -q daemon-reload + echo 'done' echo 'Restarting systemd network...' systemctl -q restart systemd-networkd echo 'done' @@ -911,14 +914,18 @@ else fi if [ "$DSVPN" = "yes" ]; then echo 'Restarting dsvpn...' + systemctl -q start dsvpn-server@dsvpn0 || true systemctl -q restart dsvpn-server@* || true echo 'done' fi echo 'Restarting glorytun...' + systemctl -q start glorytun-tcp@tun0 || true systemctl -q restart glorytun-tcp@* || true + systemctl -q start glorytun-udp@tun0 || true systemctl -q restart glorytun-udp@* || true echo 'done' echo 'Restarting omr6in4...' + systemctl -q start omr6in4@user0 || true systemctl -q restart omr6in4@* || true echo 'done' if [ "$OPENVPN" = "yes" ]; then diff --git a/dsvpn-run b/dsvpn-run index e4d1ff8..e4000c2 100644 --- a/dsvpn-run +++ b/dsvpn-run @@ -10,10 +10,10 @@ fi . "$(readlink -f "$1")" exec dsvpn \ - ${MODE:+server} \ + ${MODE} \ "$1".key \ auto \ - ${PORT:+65401} \ - ${DEV:+dsvpn0} \ - ${LOCALTUNIP:+10.255.251.1} \ - ${REMOTETUNIP:+10.255.251.1} + ${PORT} \ + ${DEV} \ + ${LOCALTUNIP} \ + ${REMOTETUNIP} diff --git a/dsvpn0-config b/dsvpn0-config index c4164cf..933e98b 100644 --- a/dsvpn0-config +++ b/dsvpn0-config @@ -2,4 +2,4 @@ PORT=65401 DEV=dsvpn0 MODE=server LOCALTUNIP=10.255.251.1 -REMOTETUNIP=10.255.251.2 \ No newline at end of file +REMOTETUNIP=10.255.251.2 diff --git a/glorytun-tcp-post.sh b/glorytun-tcp-post.sh index f494e11..1522d79 100644 --- a/glorytun-tcp-post.sh +++ b/glorytun-tcp-post.sh @@ -4,5 +4,7 @@ INTF=gt-${DEV} [ -z "$LOCALIP" ] && LOCALIP="10.255.255.1" [ -z "$BROADCASTIP" ] && BROADCASTIP="10.255.255.3" -ip link set dev ${INTF} up -ip addr add ${LOCALIP}/30 brd ${BROADCASTIP} dev ${INTF} +[ "$(ip addr show dev $INTF | grep -o 'inet [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*')" != "$LOCALIP" ] && { + ip link set dev ${INTF} up 2>&1 >/dev/null + ip addr add ${LOCALIP}/30 brd ${BROADCASTIP} dev ${INTF} 2>&1 >/dev/null +} diff --git a/glorytun-udp-post.sh b/glorytun-udp-post.sh index 73a3853..be4d46a 100644 --- a/glorytun-udp-post.sh +++ b/glorytun-udp-post.sh @@ -4,5 +4,7 @@ INTF=gt-udp-${DEV} [ -z "$LOCALIP" ] && LOCALIP="10.255.254.1" [ -z "$BROADCASTIP" ] && BROADCASTIP="10.255.254.3" -ip link set dev ${INTF} up -ip addr add ${LOCALIP}/30 brd ${BROADCASTIP} dev ${INTF} +[ "$(ip addr show dev $INTF | grep -o 'inet [0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*')" != "$LOCALIP" ] && { + ip link set dev ${INTF} up 2>&1 >/dev/null + ip addr add ${LOCALIP}/30 brd ${BROADCASTIP} dev ${INTF} 2>&1 >/dev/null +} diff --git a/omr-service b/omr-service index c439d32..55c2c23 100755 --- a/omr-service +++ b/omr-service @@ -13,7 +13,33 @@ _multipath() { done } +_glorytun_udp() { + [ -z "$(glorytun show dev gt-udp-tun0 2>/dev/null | grep server)" ] && { + logger -t "OMR-Service" "Restart Glorytun-UDP" + systemctl -q restart glorytun-udp@* + } + for intf in /etc/glorytun-udp/*; do + /etc/glorytun-udp/post.sh /etc/glorytun-udp/${intf} + done +} + +_glorytun_tcp() { + for intf in /etc/glorytun-tcp/*; do + /etc/glorytun-tcp/post.sh /etc/glorytun-tcp/${intf} + done +} + +_omr_api() { + [ -z "$(curl -s -k -m 1 https://127.0.0.1:65500/)" ] && { + logger -t "OMR-Service" "Restart OMR-Admin" + systemctl -q restart omr-admin + } +} + while true; do + _glorytun_udp + _glorytun_tcp _multipath + _omr_api sleep 10 done