mirror of
https://github.com/Ysurac/openmptcprouter-vps.git
synced 2025-02-12 11:21:56 +00:00
Commit latest small changes in script
This commit is contained in:
parent
e063e29ff9
commit
ce4516fac2
7 changed files with 44 additions and 23 deletions
|
@ -629,6 +629,8 @@ if [ "$OBFS" = "yes" ]; then
|
||||||
cd /tmp
|
cd /tmp
|
||||||
rm -rf /tmp/simple-obfs
|
rm -rf /tmp/simple-obfs
|
||||||
else
|
else
|
||||||
|
rm -f /var/lib/dpkg/lock
|
||||||
|
rm -f /var/lib/dpkg/lock-frontend
|
||||||
apt-get -y -o Dpkg::Options::="--force-overwrite" install omr-simple-obfs=${OBFS_BINARY_VERSION}
|
apt-get -y -o Dpkg::Options::="--force-overwrite" install omr-simple-obfs=${OBFS_BINARY_VERSION}
|
||||||
fi
|
fi
|
||||||
#sed -i 's%"mptcp": true%"mptcp": true,\n"plugin": "/usr/local/bin/obfs-server",\n"plugin_opts": "obfs=http;mptcp;fast-open;t=400"%' /etc/shadowsocks-libev/config.json
|
#sed -i 's%"mptcp": true%"mptcp": true,\n"plugin": "/usr/local/bin/obfs-server",\n"plugin_opts": "obfs=http;mptcp;fast-open;t=400"%' /etc/shadowsocks-libev/config.json
|
||||||
|
@ -662,6 +664,8 @@ if [ "$V2RAY_PLUGIN" = "yes" ]; then
|
||||||
#cd /tmp
|
#cd /tmp
|
||||||
#rm -rf /tmp/simple-obfs
|
#rm -rf /tmp/simple-obfs
|
||||||
else
|
else
|
||||||
|
rm -f /var/lib/dpkg/lock
|
||||||
|
rm -f /var/lib/dpkg/lock-frontend
|
||||||
apt-get -y install v2ray-plugin=${V2RAY_PLUGIN_VERSION}
|
apt-get -y install v2ray-plugin=${V2RAY_PLUGIN_VERSION}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1188,11 +1192,11 @@ else
|
||||||
cp ${DIR}/shorewall4/shorewall.conf /etc/shorewall/shorewall.conf
|
cp ${DIR}/shorewall4/shorewall.conf /etc/shorewall/shorewall.conf
|
||||||
cp ${DIR}/shorewall4/policy /etc/shorewall/policy
|
cp ${DIR}/shorewall4/policy /etc/shorewall/policy
|
||||||
cp ${DIR}/shorewall4/params /etc/shorewall/params
|
cp ${DIR}/shorewall4/params /etc/shorewall/params
|
||||||
cp ${DIR}/shorewall4/params.vpn /etc/shorewall/params.vpn
|
#cp ${DIR}/shorewall4/params.vpn /etc/shorewall/params.vpn
|
||||||
cp ${DIR}/shorewall4/params.net /etc/shorewall/params.net
|
#cp ${DIR}/shorewall4/params.net /etc/shorewall/params.net
|
||||||
cp ${DIR}/shorewall6/params /etc/shorewall6/params
|
cp ${DIR}/shorewall6/params /etc/shorewall6/params
|
||||||
cp ${DIR}/shorewall6/params.net /etc/shorewall6/params.net
|
#cp ${DIR}/shorewall6/params.net /etc/shorewall6/params.net
|
||||||
cp ${DIR}/shorewall6/params.vpn /etc/shorewall6/params.vpn
|
#cp ${DIR}/shorewall6/params.vpn /etc/shorewall6/params.vpn
|
||||||
cp ${DIR}/shorewall6/interfaces /etc/shorewall6/interfaces
|
cp ${DIR}/shorewall6/interfaces /etc/shorewall6/interfaces
|
||||||
cp ${DIR}/shorewall6/stoppedrules /etc/shorewall6/stoppedrules
|
cp ${DIR}/shorewall6/stoppedrules /etc/shorewall6/stoppedrules
|
||||||
cp ${DIR}/shorewall6/snat /etc/shorewall6/snat
|
cp ${DIR}/shorewall6/snat /etc/shorewall6/snat
|
||||||
|
|
|
@ -8,6 +8,11 @@ if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "9" ]; then
|
||||||
echo "This script doesn't work with Debian Stretch (9.x)"
|
echo "This script doesn't work with Debian Stretch (9.x)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
echo "You must run the script as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
||||||
echo "You can select any interface and set any IPs during Pi-hole configuration, this will be modified for OpenMPTCProuter at the end."
|
echo "You can select any interface and set any IPs during Pi-hole configuration, this will be modified for OpenMPTCProuter at the end."
|
||||||
echo "Don't apply Pi-hole firewall rules."
|
echo "Don't apply Pi-hole firewall rules."
|
||||||
|
|
25
omr-service
25
omr-service
|
@ -42,6 +42,15 @@ _glorytun_tcp() {
|
||||||
|
|
||||||
_dsvpn() {
|
_dsvpn() {
|
||||||
[ -n "$(ip -6 r show 64:ff9b::/96 dev dsvpn0)" ] && ip -6 r del 64:ff9b::/96 dev dsvpn0 2>&1 >/dev/null
|
[ -n "$(ip -6 r show 64:ff9b::/96 dev dsvpn0)" ] && ip -6 r del 64:ff9b::/96 dev dsvpn0 2>&1 >/dev/null
|
||||||
|
if [ -f /etc/openmptcprouter-vps-admin/current-vpn ] && [ "$(cat /etc/openmptcprouter-vps-admin/current-vpn)" = "dsvpn" ]; then
|
||||||
|
localip="$(cat /etc/dsvpn/dsvpn0 | grep LOCALTUNIP | cut -d '=' -f2)"
|
||||||
|
[ -z "$localip" ] && localip="10.255.251.1"
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_shadowsocks() {
|
_shadowsocks() {
|
||||||
|
@ -66,13 +75,15 @@ _omr_api() {
|
||||||
_lan_route() {
|
_lan_route() {
|
||||||
cat /etc/openmptcprouter-vps-admin/omr-admin-config.json | jq -c '.users[0][]' |
|
cat /etc/openmptcprouter-vps-admin/omr-admin-config.json | jq -c '.users[0][]' |
|
||||||
while IFS=$"\n" read -r c; do
|
while IFS=$"\n" read -r c; do
|
||||||
vpnremoteip=$(echo "$c" | jq -r '.vpnremoteip')
|
if [ -n "$c" ]; then
|
||||||
if [ -n "$vpnremoteip" ] && [ "$vpnremoteip" != "null" ]; then
|
vpnremoteip=$(echo "$c" | jq -r '.vpnremoteip')
|
||||||
echo "$c" | jq -c -r '.lanips[] //empty' |
|
if [ -n "$vpnremoteip" ] && [ "$vpnremoteip" != "null" ]; then
|
||||||
while IFS=$"\n" read -r d; do
|
echo "$c" | jq -c -r '.lanips[] //empty' |
|
||||||
network=$(ipcalc -n $d | grep Network | awk '{print $2}')
|
while IFS=$"\n" read -r d; do
|
||||||
[ -n "$network" ] && [ -z "$(ip r show $network via $vpnremoteip)" ] && ip r replace $network via $vpnremoteip 2>&1 >/dev/null
|
network=$(ipcalc -n $d | grep Network | awk '{print $2}')
|
||||||
done
|
[ -n "$network" ] && [ -z "$(ip r show $network via $vpnremoteip)" ] && ip r replace $network via $vpnremoteip 2>&1 >/dev/null
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||||
OVH=false
|
HETZNER=false
|
||||||
if [ "$1" = "ovh" ]; then
|
if [ "$1" = "hetzner" ]; then
|
||||||
OVH=true
|
HETZNER=true
|
||||||
INTERFACE="$2"
|
INTERFACE="$2"
|
||||||
else
|
else
|
||||||
INTERFACE="$1"
|
INTERFACE="$1"
|
||||||
|
@ -13,9 +13,9 @@ fi
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$OVH" = false ]; then
|
if [ "$HETZNER" = false ]; then
|
||||||
echo "Select best test server..."
|
echo "Select best test server..."
|
||||||
HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip http://proof.ovh.net/files/10Gb.dat https://speed.hetzner.de/10GB.bin http://ipv4.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin"
|
HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip https://speed.hetzner.de/10GB.bin http://ipv4.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin"
|
||||||
bestping="9999"
|
bestping="9999"
|
||||||
for pinghost in $HOSTLST; do
|
for pinghost in $HOSTLST; do
|
||||||
domain=$(echo $pinghost | awk -F/ '{print $3}')
|
domain=$(echo $pinghost | awk -F/ '{print $3}')
|
||||||
|
@ -32,7 +32,7 @@ if [ "$OVH" = false ]; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$HOST" ] && HOST="http://proof.ovh.net/files/10Gio.dat"
|
[ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin"
|
||||||
|
|
||||||
echo "Best server is $HOST, running test:"
|
echo "Best server is $HOST, running test:"
|
||||||
trap : HUP INT TERM
|
trap : HUP INT TERM
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||||
OVH=false
|
HETZNER=false
|
||||||
if [ "$1" = "ovh" ]; then
|
if [ "$1" = "hetzner" ]; then
|
||||||
OVH=true
|
HETZNER=true
|
||||||
INTERFACE="$2"
|
INTERFACE="$2"
|
||||||
else
|
else
|
||||||
INTERFACE="$1"
|
INTERFACE="$1"
|
||||||
|
@ -14,9 +14,9 @@ fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ "$OVH" = false ]; then
|
if [ "$HETZNER" = false ]; then
|
||||||
echo "Select best test server..."
|
echo "Select best test server..."
|
||||||
HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip http://www.ovh.net/files/10Gb.dat https://speed.hetzner.de/10GB.bin http://ipv6.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin"
|
HOSTLST="http://speedtest.frankfurt.linode.com/garbage.php?ckSize=10000 http://speedtest.tokyo2.linode.com/garbage.php?ckSize=10000 http://speedtest.singapore.linode.com/garbage.php?ckSize=10000 http://speedtest.newark.linode.com/garbage.php?ckSize=10000 http://speedtest.atlanta.linode.com/garbage.php?ckSize=10000 http://speedtest.dallas.linode.com/garbage.php?ckSize=10000 http://speedtest.fremont.linode.com/garbage.php?ckSize=10000 http://speedtest.tele2.net/1000GB.zip https://speed.hetzner.de/10GB.bin http://ipv6.bouygues.testdebit.info/10G.iso http://par.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin http://ams.download.datapacket.com/10000mb.bin http://fra.download.datapacket.com/10000mb.bin http://lon.download.datapacket.com/10000mb.bin http://mad.download.datapacket.com/10000mb.bin http://prg.download.datapacket.com/10000mb.bin http://sto.download.datapacket.com/10000mb.bin http://vie.download.datapacket.com/10000mb.bin http://war.download.datapacket.com/10000mb.bin http://atl.download.datapacket.com/10000mb.bin http://chi.download.datapacket.com/10000mb.bin http://lax.download.datapacket.com/10000mb.bin http://mia.download.datapacket.com/10000mb.bin http://nyc.download.datapacket.com/10000mb.bin"
|
||||||
bestping="9999"
|
bestping="9999"
|
||||||
for pinghost in $HOSTLST; do
|
for pinghost in $HOSTLST; do
|
||||||
domain=$(echo $pinghost | awk -F/ '{print $3}')
|
domain=$(echo $pinghost | awk -F/ '{print $3}')
|
||||||
|
@ -33,7 +33,7 @@ if [ "$OVH" = false ]; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$HOST" ] && HOST="http://proof.ovh.net/files/10Gio.dat"
|
[ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin"
|
||||||
|
|
||||||
echo "Best server is $HOST, running test:"
|
echo "Best server is $HOST, running test:"
|
||||||
trap : HUP INT TERM
|
trap : HUP INT TERM
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
OMR_ADDR=fe80::a00:2
|
Loading…
Reference in a new issue