mirror of
https://github.com/Ysurac/openmptcprouter-vps.git
synced 2025-02-12 11:21:56 +00:00
Fix dsvpn restart in omr-service, add VLESS-REALITY support
This commit is contained in:
parent
0d9a766d28
commit
c0af37c0c2
3 changed files with 24 additions and 9 deletions
|
@ -66,8 +66,8 @@ MLVPN_BINARY_VERSION="3.0.0+20211028.git.ddafba3"
|
|||
UBOND_VERSION="31af0f69ebb6d07ed9348dca2fced33b956cedee"
|
||||
OBFS_VERSION="486bebd9208539058e57e23a12f23103016e09b4"
|
||||
OBFS_BINARY_VERSION="0.0.5-1"
|
||||
OMR_ADMIN_VERSION="d560968d43850c48119c1b72372d6f341878ffa6"
|
||||
OMR_ADMIN_BINARY_VERSION="0.4+20231009"
|
||||
OMR_ADMIN_VERSION="afbcb55ef352a77c5f50a1b7e402ec515f5944b0"
|
||||
OMR_ADMIN_BINARY_VERSION="0.5+20231021"
|
||||
#OMR_ADMIN_BINARY_VERSION="0.3+20220827"
|
||||
DSVPN_VERSION="3b99d2ef6c02b2ef68b5784bec8adfdd55b29b1a"
|
||||
DSVPN_BINARY_VERSION="0.1.4-2"
|
||||
|
@ -538,10 +538,10 @@ if [ "$SOURCES" = "yes" ]; then
|
|||
#cd /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION}
|
||||
rm -f /var/lib/dpkg/lock
|
||||
rm -f /var/lib/dpkg/lock-frontend
|
||||
mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y"
|
||||
mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" 2>&1 >/dev/null
|
||||
rm -f /var/lib/dpkg/lock
|
||||
rm -f /var/lib/dpkg/lock-frontend
|
||||
dpkg-buildpackage -b -us -uc
|
||||
dpkg-buildpackage -b -us -uc 2>&1 >/dev/null
|
||||
rm -f /var/lib/dpkg/lock
|
||||
rm -f /var/lib/dpkg/lock-frontend
|
||||
cd /tmp
|
||||
|
@ -1041,6 +1041,10 @@ if [ "$XRAY" = "yes" ]; then
|
|||
[ "$PSK2" != "null" ] && [ -n "$PSK2" ] && [ "$PSK2" != "XRAY_PSK" ] && PSK="$PSK2"
|
||||
UPSK2=$(jq -r '.inbounds[] | select(.tag=="omrin-shadowsocks-tunnel") | .settings.clients[] | select(.email=="openmptcprouter") | .password' /etc/xray/xray-server.json | tr -d "\n")
|
||||
[ "$UPSK2" != "null" ] && [ -n "$UPSK2" ] && [ "$UPSK2" != "XRAY_UPSK" ] && UPSK="$UPSK2"
|
||||
XRAY_X25519_PRIVATE_KEY2=$(grep -Po '"'"privateKey"'"\s*:\s*"\K([^"]*)' /etc/xray/xray-vless_reality.json | head -n 1 | tr -d "\n")
|
||||
[ -n "$XRAY_X25519_PRIVATE_KEY2" ] && [ "$XRAY_X25519_PRIVATE_KEY2" != "XRAY_X25519_PRIVATE_KEY" ] && XRAY_X25519_PRIVATE_KEY="$XRAY_X25519_PRIVATE_KEY2"
|
||||
XRAY_X25519_PUBLIC_KEY2=$(grep -Po '"'"publicKey"'"\s*:\s*"\K([^"]*)' /etc/xray/xray-vless_reality.json | head -n 1 | tr -d "\n")
|
||||
[ -n "$XRAY_X25519_PUBLIC_KEY2" ] && [ "$XRAY_X25519_PUBLIC_KEY2" != "XRAY_X25519_PUBLIC_KEY" ] && XRAY_X25519_PUBLIC_KEY="$XRAY_X25519_PUBLIC_KEY2"
|
||||
fi
|
||||
jq -M 'del(.users[0].openmptcprouter.xray)' /etc/openmptcprouter-vps-admin/omr-admin-config.json > /etc/openmptcprouter-vps-admin/omr-admin-config.json.new
|
||||
mv -f /etc/openmptcprouter-vps-admin/omr-admin-config.json /etc/openmptcprouter-vps-admin/omr-admin-config.json.bak
|
||||
|
@ -1051,10 +1055,20 @@ if [ "$XRAY" = "yes" ]; then
|
|||
sed -i "s:V2RAY_UUID:$XRAY_UUID:g" /etc/xray/xray-server.json
|
||||
sed -i "s:XRAY_PSK:$PSK:g" /etc/xray/xray-server.json
|
||||
sed -i "s:XRAY_UPSK:$UPSK:g" /etc/xray/xray-server.json
|
||||
#fi
|
||||
if ([ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]) && [ -z "$(grep mptcp /etc/xray/xray-server.json | grep true)" ]; then
|
||||
sed -i 's/"sockopt": {/&\n "mptcp": true,/' /etc/xray/xray-server.json
|
||||
wget -O /etc/xray/xray-vless-reality.json ${VPSURL}${VPSPATH}/xray-vless-reality.json
|
||||
if [ -z "$XRAY_X25519_PRIVATE_KEY" ]; then
|
||||
XRAY_X25519_KEYS=$(/usr/bin/xray x25519)
|
||||
XRAY_X25519_PRIVATE_KEY=$(echo "${XRAY_X25519_KEYS}" | grep Private | awk '{ print $3 }' | tr -d "\n")
|
||||
XRAY_X25519_PUBLIC_KEY=$(echo "${XRAY_X25519_KEYS}" | grep Public | awk '{ print $3 }' | tr -d "\n")
|
||||
fi
|
||||
sed -i "s:XRAY_UUID:$XRAY_UUID:g" /etc/xray/xray-vless-reality.json
|
||||
sed -i "s:XRAY_X25519_PRIVATE_KEY:$XRAY_X25519_PRIVATE_KEY:g" /etc/xray/xray-vless-reality.json
|
||||
sed -i "s:XRAY_X25519_PUBLIC_KEY:$XRAY_X25519_PUBLIC_KEY:g" /etc/xray/xray-vless-reality.json
|
||||
|
||||
#fi
|
||||
#if ([ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]) && [ -z "$(grep mptcp /etc/xray/xray-server.json | grep true)" ]; then
|
||||
# sed -i 's/"sockopt": {/&\n "mptcp": true,/' /etc/xray/xray-server.json
|
||||
#fi
|
||||
rm -f /etc/xray/config.json
|
||||
ln -s /etc/xray/xray-server.json /etc/xray/config.json
|
||||
#if [ -f /etc/systemd/system/xray.service.dpkg-dist ]; then
|
||||
|
@ -1656,7 +1670,7 @@ sed -i 's/#SystemMaxUse=/SystemMaxUse=100M/' /etc/systemd/journald.conf
|
|||
|
||||
if [ "$TLS" = "yes" ]; then
|
||||
VPS_CERT=0
|
||||
apt-get -y install socat
|
||||
apt-get -y install socat cron
|
||||
if [ "$VPS_DOMAIN" != "" ] && [ "$(getent hosts $VPS_DOMAIN | awk '{ print $1; exit }')" != "" ] && [ "$(ping -c 1 -w 1 $VPS_DOMAIN)" ]; then
|
||||
if [ ! -f "/root/.acme.sh/$VPS_DOMAIN/$VPS_DOMAIN.cer" ]; then
|
||||
echo "Generate certificate for V2Ray"
|
||||
|
|
|
@ -60,7 +60,7 @@ _dsvpn() {
|
|||
remoteip="$(echo $localip | sed 's/\.1/\.2/')"
|
||||
if [ "$(ping -c 5 -w 5 $remoteip | grep '100%')" != "" ] && [ "$(expr $(date +%s) - $(stat -c %Y /proc/$(pgrep dsvpn)/exe ))" -gt "300" ]; then
|
||||
logger -t "OMR-Service" "No answer from VPN client end, restart DSVPN"
|
||||
systemctl restart dsvpn@dsvpn0
|
||||
systemctl restart dsvpn-server@dsvpn0
|
||||
fi
|
||||
#ip link set mtu 9000 dev dsvpn0 2>&1 >/dev/null
|
||||
fi
|
||||
|
|
|
@ -189,6 +189,7 @@
|
|||
"type": "field",
|
||||
"inboundTag": [
|
||||
"omrin-tunnel",
|
||||
"omrin-vless-reality",
|
||||
"omrin-vmess-tunnel",
|
||||
"omrin-socks-tunnel",
|
||||
"omrin-trojan-tunnel"
|
||||
|
|
Loading…
Reference in a new issue