mirror of
https://github.com/Ysurac/openmptcprouter-vps.git
synced 2025-03-09 15:50:00 +00:00
Compare commits
267 commits
Author | SHA1 | Date | |
---|---|---|---|
|
fd55a16550 | ||
|
7aac683f4f | ||
|
f8484dc742 | ||
|
efd7ffd1db | ||
|
0091388ff2 | ||
|
56a2c5f7ff | ||
|
c942c30384 | ||
|
be6a17dcdd | ||
|
4b590a13eb | ||
|
2a0501172f | ||
|
458b472a78 | ||
|
3b4f875051 | ||
|
455f3c86d8 | ||
|
3ac858c56b | ||
|
c635b0a1b6 | ||
|
c0e0e19b6c | ||
|
c06b6ac75f | ||
|
93f9244e83 | ||
|
b76adb8a24 | ||
|
5abd262382 | ||
|
654e1a1335 | ||
|
6aa0d03888 | ||
|
4e16d813bf | ||
|
70a240a396 | ||
|
f713ebcc67 | ||
|
49390c7277 | ||
|
1cc3bda158 | ||
|
172c0461be | ||
|
efdb9e3ef7 | ||
|
c13a84dc6b | ||
|
fd2a3f1a27 | ||
|
103e508dd7 | ||
|
90d327abbe | ||
|
1ab5d977de | ||
|
96775408d7 | ||
|
2b99a77d1a | ||
|
b4d8f5551c | ||
|
001aa3be4d | ||
|
0bd93fb5c8 | ||
|
a5fc57038b | ||
|
a9e217fb7c | ||
|
c0c9627007 | ||
|
6e64c06325 | ||
|
c708189fb9 | ||
|
c0af37c0c2 | ||
|
0d9a766d28 | ||
|
0743e7c75a | ||
|
8ac6293b58 | ||
|
8cef34ed5b | ||
|
afa31c4f03 | ||
|
a029915e39 | ||
|
e9fd4192dc | ||
|
0ad22072a7 | ||
|
73cecfb6f9 | ||
|
dfba574f7e | ||
|
450da26917 | ||
|
2204e080d3 | ||
|
4b349539f7 | ||
|
19bc566da6 | ||
|
178186002c | ||
|
cb5f138c4e | ||
|
c91411a621 | ||
|
039218a015 | ||
|
2806a8078a | ||
|
8af0bed8c3 | ||
|
3de88a211f | ||
|
fdcd1c59f9 | ||
|
56d3c8ae08 | ||
|
8d1055668f | ||
|
dfdfaa2487 | ||
|
cc756de52d | ||
|
9c3f955a61 | ||
|
838d1b69e5 | ||
|
4e09734f41 | ||
|
44467085a7 | ||
|
7a7a4a2778 | ||
|
cf8aa1dc03 | ||
|
b3ef329cd0 | ||
|
3dc18b63b8 | ||
|
657c2b386c | ||
|
c232d34169 | ||
|
ade517b142 | ||
|
4fbb8d08f3 | ||
|
a8553ba64f | ||
|
2b5afea3a1 | ||
|
16e01d1120 | ||
|
0fcb2c22f4 | ||
|
d7dacc3e72 | ||
|
ce4516fac2 | ||
|
e063e29ff9 | ||
|
bfe7d972b9 | ||
|
a5cf11a449 | ||
|
33cf1b4718 | ||
|
c19bade451 | ||
|
a02b306243 | ||
|
4b8a9432cd | ||
|
df637bb0c4 | ||
|
c39b07eaa5 | ||
|
180a3fc0ac | ||
|
950b704495 | ||
|
db95630ef9 | ||
|
fd915dfbb9 | ||
|
5023d5cf33 | ||
|
1d2887c747 | ||
|
07e23b7851 | ||
|
cedb65670e | ||
|
31d4712c83 | ||
|
dae3133a1d | ||
|
98ee07f6a6 | ||
|
9a764d0eaf | ||
|
454046f830 | ||
|
507f49413c | ||
|
69df502cb9 | ||
|
5291876fe6 | ||
|
fd10d9ac20 | ||
|
8e738a8f19 | ||
|
83e81cfd9f | ||
|
47df28fdc6 | ||
|
8856fece58 | ||
|
e70303ba3f | ||
|
a713d44645 | ||
|
7ce28a9481 | ||
|
269b986cbe | ||
|
5bfd42770d | ||
|
8e795b035b | ||
|
2dbc4e4f0f | ||
|
f573c43ce0 | ||
|
382fc59a4f | ||
|
95453a8013 | ||
|
605acd1ffd | ||
|
cf1eca052a | ||
|
bf160e67a6 | ||
|
96eb181b40 | ||
|
0ddc538c87 | ||
|
3c6e85e07f | ||
|
c64bed8db5 | ||
|
aacad49aa4 | ||
|
ea0993c781 | ||
|
8319728f56 | ||
|
2ae5602bca | ||
|
3cd9952c69 | ||
|
795c693d13 | ||
|
377ad59134 | ||
|
91116306a1 | ||
|
637e2ee08a | ||
|
379b30a65e | ||
|
5cf11f2650 | ||
|
e87ff9af8e | ||
|
68ef21c679 | ||
|
e6d3bb7279 | ||
|
6a0c3d3247 | ||
|
960cf901fe | ||
|
6e53e22761 | ||
|
c0a99de20c | ||
|
19166a0c58 | ||
|
9af99ff2f5 | ||
|
deb52dba7f | ||
|
f5fc2cbc31 | ||
|
9c66b1ba5f | ||
|
e0fbb8faa9 | ||
|
3a0fde41b4 | ||
|
f89e40f9d9 | ||
|
c1e2859ff3 | ||
|
aed3ebe618 | ||
|
11eb98aa91 | ||
|
ae0e271b90 | ||
|
521a620e99 | ||
|
2bc21c8828 | ||
|
ec22ebbf04 | ||
|
5cb79c7f77 | ||
|
d068d14751 | ||
|
9b47f9b25b | ||
|
68211f2033 | ||
|
f4beb2f5a5 | ||
|
633bb76902 | ||
|
ef69f2bfec | ||
|
3ba380d2fe | ||
|
9e09d25e95 | ||
|
e70500a91c | ||
|
956245a523 | ||
|
b792232e72 | ||
|
0b650ad217 | ||
|
ad5bf18f71 | ||
|
cba153e2d7 | ||
|
3882b8f1c9 | ||
|
a218449b4a | ||
|
deb6350860 | ||
|
09792055fc | ||
|
25b68f6228 | ||
|
52a1b8a8f0 | ||
|
e527e52c70 | ||
|
192ff0620b | ||
|
d6bb43aceb | ||
|
d87b58da11 | ||
|
8fb17cef85 | ||
|
f957fafef1 | ||
|
d6b3042be4 | ||
|
d5a9321d65 | ||
|
a3aaeac2d3 | ||
|
30d5d85184 | ||
|
8267f6b2ff | ||
|
df3f4ccaff | ||
|
da1a6c3560 | ||
|
fd11069012 | ||
|
b2cddfca38 | ||
|
4c2e6cdf0d | ||
|
53a50e015f | ||
|
c11d4737e5 | ||
|
129e6a9ae4 | ||
|
ff74a1b298 | ||
|
5b8b41326e | ||
|
9840ccd202 | ||
|
42c7489c23 | ||
|
adabff20cb | ||
|
31bbbfb343 | ||
|
33fa9f4f26 | ||
|
d44ece14eb | ||
|
757426fd7c | ||
|
b8ad59a11d | ||
|
895182fdfe | ||
|
e75c5e92a7 | ||
|
2df3477cbc | ||
|
eaf506836a | ||
|
11414b9ac6 | ||
|
dc621e8272 | ||
|
9699bfb621 | ||
|
4285efb8c7 | ||
|
61b4452941 | ||
|
54e516399e | ||
|
5def13947b | ||
|
3f4bffd1ef | ||
|
62e01c46a6 | ||
|
1ec824f55a | ||
|
166495cdaf | ||
|
2aee1e583e | ||
|
30d082e417 | ||
|
a65915c84a | ||
|
fdc953a808 | ||
|
f15f4b333e | ||
|
02a66bec9a | ||
|
8aca616bd1 | ||
|
9661a32943 | ||
|
0d76a95de8 | ||
|
df71b8ce2f | ||
|
868ea9de25 | ||
|
9445e8e939 | ||
|
7baeacbc3b | ||
|
d1cdfc29d9 | ||
|
fd7a7157e0 | ||
|
c5564fca07 | ||
|
5684f0837c | ||
|
ce9d7369ab | ||
|
87d95f4299 | ||
|
d50172140e | ||
|
7507484d7c | ||
|
2554c6955d | ||
|
4e53facd7a | ||
|
bdb785abea | ||
|
5ed1d71da5 | ||
|
0d2e5cb9d9 | ||
|
366cb62a2a | ||
|
16b2df675f | ||
|
f6e4b95f16 | ||
|
745205f7cc | ||
|
7360af55c5 | ||
|
0ebc3a887f | ||
|
1cb16f2b18 |
85 changed files with 3572 additions and 685 deletions
1
debian-x86_64.sh
Symbolic link
1
debian-x86_64.sh
Symbolic link
|
@ -0,0 +1 @@
|
|||
debian9-x86_64.sh
|
1
debian.sh
Symbolic link
1
debian.sh
Symbolic link
|
@ -0,0 +1 @@
|
|||
debian9-x86_64.sh
|
23
debian/changelog
vendored
Normal file
23
debian/changelog
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
omr-server (0.1030) unstable; urgency=medium
|
||||
|
||||
* Many changes
|
||||
|
||||
-- OpenMPTCProuter <contact@openmptcprouter.com> Wed, 10 Apr 2024 19:35:34 +0200
|
||||
|
||||
omr-server (0.1028) unstable; urgency=medium
|
||||
|
||||
* Many changes
|
||||
|
||||
-- OpenMPTCProuter <contact@openmptcprouter.com> Fri, 14 Oct 2022 09:02:22 +0200
|
||||
|
||||
omr-server (0.1026) unstable; urgency=medium
|
||||
|
||||
* Many changes
|
||||
|
||||
-- OpenMPTCProuter <contact@openmptcprouter.com> Mon, 14 Jun 2021 07:43:42 +0200
|
||||
|
||||
omr-server (0.1025-test) unstable; urgency=medium
|
||||
|
||||
* Wireguard support and fixed
|
||||
|
||||
-- OpenMPTCProuter <contact@openmptcprouter.com> Thu, 04 Mar 2021 14:36:12 +0200
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
10
|
37
debian/control
vendored
Normal file
37
debian/control
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
Source: omr-server
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: OpenMPTCProuter <contact@openmptcprouter.com>
|
||||
Build-Depends: debhelper (>= 10)
|
||||
X-Python-Version: >= 3.2
|
||||
Standards-Version: 0.0.1
|
||||
Homepage: https://github.com/ysurac/openmptcprouter-vps
|
||||
|
||||
Package: omr-server
|
||||
Architecture: all
|
||||
Multi-Arch: foreign
|
||||
Depends:
|
||||
curl,
|
||||
rename,
|
||||
libcurl4,
|
||||
unzip,
|
||||
tracebox,
|
||||
omr-iperf3,
|
||||
omr-shadowsocks-libev (= 3.3.5-2),
|
||||
omr-vps-admin (= 0.3+20210508),
|
||||
omr-simple-obfs,
|
||||
omr-mlvpn (= 3.0.0+20201216.git.2263bab),
|
||||
omr-glorytun (= 0.3.4-4),
|
||||
omr-glorytun-tcp (= 0.0.35-3),
|
||||
omr-dsvpn (= 0.1.4-2),
|
||||
shorewall,
|
||||
shorewall6,
|
||||
iptables,
|
||||
v2ray-plugin (= 4.35.1),
|
||||
v2ray (=4.35.1),
|
||||
linux-image-5.4.100-mptcp (= 1.18+9d3f35b),
|
||||
${misc:Depends}
|
||||
Provides: omr-server
|
||||
Conflicts: omr-server
|
||||
Replaces: omr-server
|
||||
Description: OpenMPTCProuter Server script
|
16
debian/postinst
vendored
Normal file
16
debian/postinst
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
test $DEBIAN_SCRIPT_DEBUG && set -v -x
|
||||
|
||||
# use debconf
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
sed -i -e "s/^LOCALFILES=.*$/LOCALFILES=no/" -e "s/^SOURCES=.*$/SOURCES=no/" /usr/share/omr-server/debian9-x86_64.sh
|
||||
systemctl daemon-reload
|
||||
systemctl restart omr-update
|
||||
|
||||
db_stop
|
||||
|
||||
#DEBHELPER#
|
||||
exit 0
|
||||
# vim:set ai et sts=2 sw=2 tw=0:
|
18
debian/rules
vendored
Executable file
18
debian/rules
vendored
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/make -f
|
||||
#export DH_VERBOSE = 1
|
||||
|
||||
# Security Hardening
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_install:
|
||||
mkdir -p $(CURDIR)/debian/omr-server/usr/share/omr-server
|
||||
find . -type f -xtype f -not -iname '*/debian/*' -not -iname '*/.git/*' -exec cp '{}' "$(CURDIR)/debian/omr-server/usr/share/omr-server/{}" ';'
|
||||
cp -r ./shorewall4 $(CURDIR)/debian/omr-server/usr/share/omr-server/
|
||||
cp -r ./shorewall6 $(CURDIR)/debian/omr-server/usr/share/omr-server/
|
||||
cp -r ./bin $(CURDIR)/debian/omr-server/usr/share/omr-server/
|
||||
mkdir -p $(CURDIR)/debian/etc/openmptcprouter-vps-admin
|
||||
touch $(CURDIR)/debian/etc/openmptcprouter-vps-admin/update-bin
|
||||
|
1
debian11-x86_64.sh
Symbolic link
1
debian11-x86_64.sh
Symbolic link
|
@ -0,0 +1 @@
|
|||
debian9-x86_64.sh
|
1
debian12-x86_64.sh
Symbolic link
1
debian12-x86_64.sh
Symbolic link
|
@ -0,0 +1 @@
|
|||
debian9-x86_64.sh
|
2220
debian9-x86_64.sh
Normal file → Executable file
2220
debian9-x86_64.sh
Normal file → Executable file
File diff suppressed because it is too large
Load diff
12
dsvpn-run
12
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}
|
||||
${HOST:-auto} \
|
||||
${PORT} \
|
||||
${DEV} \
|
||||
${LOCALTUNIP} \
|
||||
${REMOTETUNIP}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[Unit]
|
||||
Description=Dead Simple VPN - Server
|
||||
After=network.target network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/sbin/dsvpn server /etc/dsvpn/dsvpn.key auto 65011 dsvpn0 10.255.251.1 10.255.251.2
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[Unit]
|
||||
Description=Dead Simple VPN - Server on %I
|
||||
After=network.target network-online.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/dsvpn-run /etc/dsvpn/%i
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
PORT=65401
|
||||
HOST=0.0.0.0
|
||||
DEV=dsvpn0
|
||||
MODE=server
|
||||
LOCALTUNIP=10.255.251.1
|
||||
REMOTETUNIP=10.255.251.2
|
||||
REMOTETUNIP=10.255.251.2
|
||||
|
|
10
fail2ban-filter-openvpn.conf
Normal file
10
fail2ban-filter-openvpn.conf
Normal file
|
@ -0,0 +1,10 @@
|
|||
[INCLUDES]
|
||||
before = common.conf
|
||||
|
||||
[Definition]
|
||||
_daemon = ovpn-server
|
||||
failregex =%(__prefix_line)s<HOST>:[0-9]{4,5} TLS Auth Error:.*
|
||||
%(__prefix_line)s<HOST>:[0-9]{4,5} VERIFY ERROR:.*
|
||||
%(__prefix_line)s<HOST>:[0-9]{4,5} TLS Error: TLS handshake failed.*
|
||||
%(__prefix_line)sTLS Error: cannot locate HMAC in incoming packet from \[AF_INET\]<HOST>:[0-9]{4,5}
|
||||
maxlines = 1
|
21
fail2ban-jail-openmptcprouter.conf
Normal file
21
fail2ban-jail-openmptcprouter.conf
Normal file
|
@ -0,0 +1,21 @@
|
|||
[DEFAULT]
|
||||
backend = systemd
|
||||
banaction = shorewall
|
||||
|
||||
[sshd]
|
||||
enabled = true
|
||||
|
||||
[openvpn_tcp]
|
||||
enabled = true
|
||||
port = 65301
|
||||
protocol = tcp
|
||||
filter = openvpn
|
||||
maxretry = 5
|
||||
|
||||
[openvpn_udp]
|
||||
enabled = true
|
||||
port = 65301
|
||||
protocol = udp
|
||||
filter = openvpn
|
||||
maxretry = 5
|
||||
|
|
@ -1,8 +1,14 @@
|
|||
#!/bin/sh
|
||||
[ ! -f $(readlink -f "$1") ] && exit 1
|
||||
. "$(readlink -f "$1")"
|
||||
|
||||
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}
|
||||
while [ -z "$(ip link show $INTF 2>/dev/null)" ]; do
|
||||
sleep 2
|
||||
done
|
||||
[ "$(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
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ fi
|
|||
|
||||
. "$(readlink -f "$1")"
|
||||
|
||||
DEV="gt${HOST:+c}-$(basename "$1")"
|
||||
DEV="gt-$(basename "$1")"
|
||||
|
||||
exec glorytun-tcp \
|
||||
${SERVER:+listener} \
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
#!/bin/sh
|
||||
[ ! -f $(readlink -f "$1") ] && exit 1
|
||||
. "$(readlink -f "$1")"
|
||||
|
||||
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}
|
||||
while [ -z "$(ip link show $INTF 2>/dev/null)" ]; do
|
||||
sleep 2
|
||||
done
|
||||
[ "$(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
|
||||
}
|
||||
tc qdisc replace dev $INTF root cake
|
||||
ip link set $INTF txqlen 100
|
||||
glorytun set dev gt-udp-tun0 kxtimeout 7d 2>&1 >/dev/null
|
|
@ -9,11 +9,10 @@ fi
|
|||
|
||||
. "$(readlink -f "$1")"
|
||||
|
||||
DEV="gt${HOST:+c}-udp-$(basename "$1")"
|
||||
DEV="gt-udp-$(basename "$1")"
|
||||
|
||||
exec glorytun \
|
||||
bind $BIND $BIND_PORT \
|
||||
bind to addr ${HOST:-::} port ${PORT:-5000} from addr $BIND port $BIND_PORT \
|
||||
keyfile "$1".key \
|
||||
${DEV:+dev "$DEV"} \
|
||||
${HOST:+to "$HOST" "$PORT"} \
|
||||
${OPTIONS:+$OPTIONS}
|
||||
|
|
3
iperf3.override.conf
Normal file
3
iperf3.override.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/iperf3 -s -p 65400 --authorized-users-path /etc/iperf3/users.csv --rsa-private-key-path /etc/iperf3/private.pem
|
|
@ -3,7 +3,7 @@ Description=iperf3
|
|||
Requires=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/iperf3 -s -p 65400 --authorized-users-path /etc/iperf3/users.csv --rsa-private-key-path /etc/iperf3/public.pem
|
||||
ExecStart=/usr/bin/iperf3 -s -p 65400 --authorized-users-path /etc/iperf3/users.csv --rsa-private-key-path /etc/iperf3/private.pem
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
],
|
||||
"method": "chacha20-ietf-poly1305",
|
||||
"fast_open": true,
|
||||
"timeout": 600,
|
||||
"timeout": 1000,
|
||||
"port_key": {
|
||||
"65101": "MySecretKey",
|
||||
},
|
||||
|
|
|
@ -5,7 +5,7 @@ interface_name = "mlvpn0"
|
|||
timeout = 30
|
||||
password = "MLVPN_PASS"
|
||||
reorder_buffer = yes
|
||||
reorder_buffer_size = 64
|
||||
reorder_buffer_size = 128
|
||||
loss_tolerence = 50
|
||||
|
||||
[wan1]
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
Description=MLVPN connection to %i
|
||||
PartOf=mlvpn.service
|
||||
ReloadPropagatedFrom=mlvpn.service
|
||||
After=network.target network-online.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
|
@ -9,7 +10,7 @@ NotifyAccess=main
|
|||
ExecStart=/usr/local/sbin/mlvpn --config /etc/mlvpn/%i.conf --name %i --user mlvpn --quiet
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
WorkingDirectory=/etc/mlvpn
|
||||
Restart=on-failure
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
147
multipath
Normal file → Executable file
147
multipath
Normal file → Executable file
|
@ -6,9 +6,8 @@
|
|||
# Released under GPL 3 or later
|
||||
|
||||
if [ -d "/proc/sys/net/mptcp" ]; then
|
||||
if [ `cat /proc/sys/net/mptcp/mptcp_enabled` = 0 ]; then
|
||||
if ([ -f /proc/sys/net/mptcp/mptcp_enabled ] && [ `cat /proc/sys/net/mptcp/mptcp_enabled` = 0 ]) || ([ -f /proc/sys/net/mptcp/enabled ] && [ `cat /proc/sys/net/mptcp/enabled` = 0 ]); then
|
||||
echo "MPTCP is disabled!"
|
||||
echo "Please set net.mptcp.mptcp_enabled = 1"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
|
@ -26,7 +25,7 @@ case $1 in
|
|||
echo " multipath device {on | off | backup | handover}"
|
||||
echo
|
||||
echo "show established conections: -c"
|
||||
echo "show mullmesh info: -f"
|
||||
echo "show fullmesh info: -f"
|
||||
echo "show kernel config: -k"
|
||||
echo
|
||||
echo "Flag on the device, to enable/disable MPTCP for this interface. The backup-flag"
|
||||
|
@ -43,12 +42,28 @@ case $1 in
|
|||
cat /proc/net/mptcp_fullmesh
|
||||
exit 0;;
|
||||
"-k")
|
||||
echo Enabled: `cat /proc/sys/net/mptcp/mptcp_enabled`
|
||||
echo Path Manager: `cat /proc/sys/net/mptcp/mptcp_path_manager`
|
||||
echo Use checksum: `cat /proc/sys/net/mptcp/mptcp_checksum`
|
||||
echo Scheduler: `cat /proc/sys/net/mptcp/mptcp_scheduler`
|
||||
echo Syn retries: `cat /proc/sys/net/mptcp/mptcp_syn_retries`
|
||||
echo Debugmode: `cat /proc/sys/net/mptcp/mptcp_debug`
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
|
||||
echo Enabled: `cat /proc/sys/net/mptcp/mptcp_enabled`
|
||||
elif [ -f /proc/sys/net/mptcp/enabled ]; then
|
||||
echo Enabled: `cat /proc/sys/net/mptcp/enabled`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_path_manager ]; then
|
||||
echo Path Manager: `cat /proc/sys/net/mptcp/mptcp_path_manager`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_checksum ]; then
|
||||
echo Use checksum: `cat /proc/sys/net/mptcp/mptcp_checksum`
|
||||
else
|
||||
echo Use checksum: `cat /proc/sys/net/mptcp/checksum_enabled`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_scheduler ]; then
|
||||
echo Scheduler: `cat /proc/sys/net/mptcp/mptcp_scheduler`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_syn_retries ]; then
|
||||
echo Syn retries: `cat /proc/sys/net/mptcp/mptcp_syn_retries`
|
||||
fi
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_debug ]; then
|
||||
echo Debugmode: `cat /proc/sys/net/mptcp/mptcp_debug`
|
||||
fi
|
||||
echo
|
||||
echo See http://multipath-tcp.org/ for details
|
||||
exit 0 ;;
|
||||
|
@ -65,38 +80,98 @@ TYPE="$2"
|
|||
#FLAG_PATH=`find /sys/devices/ -path "*/net/$DEVICE/flags"`
|
||||
|
||||
[ -d "/sys/class/net/$DEVICE/" ] || {
|
||||
echo "Device '$DEVICE' can't found!"
|
||||
echo "Use the hardware name like in ifconfig"
|
||||
#echo "Device '$DEVICE' can't found!"
|
||||
#echo "Use the hardware name like in ifconfig"
|
||||
exit 1
|
||||
}
|
||||
|
||||
FLAG_PATH="/sys/class/net/$DEVICE/flags"
|
||||
IFF=`cat $FLAG_PATH`
|
||||
if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
|
||||
FLAG_PATH="/sys/class/net/$DEVICE/flags"
|
||||
IFF=`cat $FLAG_PATH`
|
||||
|
||||
IFF_OFF="0x80000"
|
||||
IFF_ON="0x00"
|
||||
IFF_BACKUP="0x100000"
|
||||
IFF_HANDOVER="0x200000"
|
||||
IFF_MASK="0x380000"
|
||||
IFF_OFF="0x80000"
|
||||
IFF_ON="0x00"
|
||||
IFF_BACKUP="0x100000"
|
||||
IFF_HANDOVER="0x200000"
|
||||
IFF_MASK="0x380000"
|
||||
|
||||
case $TYPE in
|
||||
"off") FLAG=$IFF_OFF;;
|
||||
"on") FLAG=$IFF_ON;;
|
||||
"backup") FLAG=$IFF_BACKUP;;
|
||||
"handover") FLAG=$IFF_HANDOVER;;
|
||||
"")
|
||||
IFF=`printf "0x%02x" $(($IFF&$IFF_MASK))`
|
||||
case "$IFF" in
|
||||
$IFF_OFF) echo $DEVICE is deactivated;;
|
||||
$IFF_ON) echo $DEVICE is in default mode;;
|
||||
$IFF_BACKUP) echo $DEVICE is in backup mode;;
|
||||
$IFF_HANDOVER) echo $DEVICE is in handover mode;;
|
||||
*) echo "Unkown state!" && exit 1;;
|
||||
esac
|
||||
exit 0;;
|
||||
*) echo "Unkown flag! Use 'multipath -h' for help" && exit 1;;
|
||||
esac
|
||||
case $TYPE in
|
||||
"off") FLAG=$IFF_OFF;;
|
||||
"on") FLAG=$IFF_ON;;
|
||||
"backup") FLAG=$IFF_BACKUP;;
|
||||
"handover") FLAG=$IFF_HANDOVER;;
|
||||
"")
|
||||
IFF=`printf "0x%02x" $(($IFF&$IFF_MASK))`
|
||||
case "$IFF" in
|
||||
$IFF_OFF) echo $DEVICE is deactivated;;
|
||||
$IFF_ON) echo $DEVICE is in default mode;;
|
||||
$IFF_BACKUP) echo $DEVICE is in backup mode;;
|
||||
$IFF_HANDOVER) echo $DEVICE is in handover mode;;
|
||||
*) echo "Unkown state!" && exit 1;;
|
||||
esac
|
||||
exit 0;;
|
||||
*) echo "Unkown flag! Use 'multipath -h' for help" && exit 1;;
|
||||
esac
|
||||
|
||||
printf "0x%02x" $(($(($IFF^$(($IFF&$IFF_MASK))))|$FLAG)) > $FLAG_PATH
|
||||
printf "0x%02x" $(($(($IFF^$(($IFF&$IFF_MASK))))|$FLAG)) > $FLAG_PATH
|
||||
else
|
||||
ID=$(ip mptcp endpoint show | grep -m 1 "dev $DEVICE" | awk '{print $3}')
|
||||
IFF=$(ip mptcp endpoint show | grep -m 1 "dev $DEVICE" | awk '{print $4}')
|
||||
#IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
|
||||
[ -f /usr/bin/jsonfilter ] && IP=$(ip -j a show $DEVICE | jsonfilter -e '@[0].addr_info[*].local')
|
||||
[ -f /usr/bin/jq ] && IP=$(ip -j a show $DEVICE | jq -r '.[0].addr_info[].local')
|
||||
RMID=$(ip mptcp endpoint show | grep '::ffff' | awk '{ print $3 }')
|
||||
[ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null
|
||||
case $TYPE in
|
||||
"off")
|
||||
[ -n "$ID" ] && {
|
||||
for i in $ID; do
|
||||
ip mptcp endpoint delete id $i 2>&1 >/dev/null
|
||||
done
|
||||
}
|
||||
exit 0;;
|
||||
"on")
|
||||
[ -n "$ID" ] && {
|
||||
for i in $ID; do
|
||||
ip mptcp endpoint delete id $i 2>&1 >/dev/null
|
||||
done
|
||||
}
|
||||
for i in $IP; do
|
||||
ip mptcp endpoint add $i dev $DEVICE subflow fullmesh
|
||||
done
|
||||
exit 0;;
|
||||
"signal")
|
||||
[ -n "$ID" ] && {
|
||||
for i in $ID; do
|
||||
ip mptcp endpoint delete id $i 2>&1 >/dev/null
|
||||
done
|
||||
}
|
||||
for i in $IP; do
|
||||
ip mptcp endpoint add $i dev $DEVICE signal
|
||||
done
|
||||
exit 0;;
|
||||
"backup")
|
||||
[ -n "$ID" ] && {
|
||||
for i in $ID; do
|
||||
ip mptcp endpoint delete id $i 2>&1 >/dev/null
|
||||
done
|
||||
}
|
||||
for i in $IP; do
|
||||
ip mptcp endpoint add $i dev $DEVICE backup fullmesh
|
||||
done
|
||||
exit 0;;
|
||||
"")
|
||||
case "$IFF" in
|
||||
"") echo $DEVICE is deactivated;;
|
||||
"subflow") echo $DEVICE is in default mode;;
|
||||
"backup") echo $DEVICE is in backup mode;;
|
||||
"signal") echo $DEVICE is in signal mode;;
|
||||
"fullmesh") echo $DEVICE is in fullmesh mode;;
|
||||
*) echo "$DEVICE Unkown state!" && exit 1;;
|
||||
esac
|
||||
exit 0;;
|
||||
*) echo "Unkown flag! Use 'multipath -h' for help" && exit 1;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
|
|
25
old-v2ray.service
Normal file
25
old-v2ray.service
Normal file
|
@ -0,0 +1,25 @@
|
|||
[Unit]
|
||||
Description=V2Ray - A unified platform for anti-censorship
|
||||
Documentation=https://v2ray.com https://guide.v2fly.org
|
||||
After=network.target nss-lookup.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
# If the version of systemd is 240 or above, then uncommenting Type=exec and commenting out Type=simple
|
||||
#Type=exec
|
||||
Type=simple
|
||||
# Runs as root or add CAP_NET_BIND_SERVICE ability can bind 1 to 1024 port.
|
||||
# This service runs as root. You may consider to run it as another user for security concerns.
|
||||
# By uncommenting User=v2ray and commenting out User=root, the service will run as user v2ray.
|
||||
# More discussion at https://github.com/v2ray/v2ray-core/issues/1011
|
||||
User=root
|
||||
#User=v2ray
|
||||
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||
NoNewPrivileges=yes
|
||||
ExecStart=/usr/bin/v2ray -config /etc/v2ray/config.json
|
||||
Restart=on-failure
|
||||
# Don't restart in the case of configuration error
|
||||
RestartPreventExitStatus=23
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -3,7 +3,7 @@
|
|||
set -e
|
||||
|
||||
if [ ! -f "$2" ]; then
|
||||
echo "usage: $(basename "$0") FILE"
|
||||
echo "usage: $(basename "$0") start FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -16,6 +16,7 @@ if [ "$1" = "start" ]; then
|
|||
ip tunnel add ${DEV} mode sit remote ${REMOTEIP} local ${LOCALIP}
|
||||
ip -6 addr add ${LOCALIP6} dev ${DEV}
|
||||
ip link set ${DEV} up
|
||||
[ -n "$ULA" ] && [ "$ULA" != "auto" ] && ip route replace ${ULA} via $(echo ${REMOTEIP6} | cut -d/ -f1) dev ${DEV}
|
||||
fi
|
||||
if [ "$1" = "stop" ]; then
|
||||
ip tunnel del ${DEV}
|
||||
|
|
12
omr-admin-ipv6.service.in
Normal file
12
omr-admin-ipv6.service.in
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=OMR-Admin IPv6
|
||||
After=network.target network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
ExecStart=/usr/local/bin/omr-admin.py --host="::"
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_SYS_ADMIN CAP_IPC_LOCK CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE CAP_FOWNER CAP_SETFCAP
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -6,7 +6,7 @@ After=network.target network-online.target
|
|||
Type=simple
|
||||
Restart=always
|
||||
ExecStart=/usr/local/bin/omr-admin.py
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW CAP_SYS_ADMIN CAP_IPC_LOCK CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE CAP_FOWNER CAP_SETFCAP
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
82
omr-bypass
Executable file
82
omr-bypass
Executable file
|
@ -0,0 +1,82 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2023 Ycarus (Yannick Chabanois) <ycarus@zugaina.org> for OpenMPTCProuter
|
||||
# Released under GPL 3. See LICENSE for the full terms.
|
||||
|
||||
[ ! -f /etc/openmptcprouter-vps-admin/omr-bypass.json ] && exit 0
|
||||
|
||||
# Configuration
|
||||
INTERFACE="$(jq -M -r .bypass_intf /etc/openmptcprouter-vps-admin/omr-admin-config.json | tr -d '\n')"
|
||||
[ "$INTERFACE" = "null" ] && INTERFACE="vpn1"
|
||||
GATEWAY="$(ip r show dev ${INTERFACE} | awk '/via/ {print $3}' | tr -d '\n')"
|
||||
GATEWAY6="$(ip -6 r show dev ${INTERFACE} | awk '/via/ {print $3}' | tr -d '\n')"
|
||||
TABLE="991337"
|
||||
MARK="0x539"
|
||||
|
||||
CHECKSUM="$(md5sum /etc/openmptcprouter-vps-admin/omr-bypass.json | awk '{print $1}' | tr -d '\n')"
|
||||
PREVIOUS_CHECKSUM="$(jq -M -r .bypass_checksum /etc/openmptcprouter-vps-admin/omr-admin-config.json | tr -d '\n')"
|
||||
[ "$CHECKSUM" = "$PREVIOUS_CHECKSUM" ] && exit 0
|
||||
jq -M --arg c "$CHECKSUM" '.bypass_checksum = $c' /etc/openmptcprouter-vps-admin/omr-admin-config.json > /etc/openmptcprouter-vps-admin/omr-admin-config.json.tmp
|
||||
mv /etc/openmptcprouter-vps-admin/omr-admin-config.json.tmp /etc/openmptcprouter-vps-admin/omr-admin-config.json
|
||||
# Action
|
||||
ipset -q flush omr_dst_bypass_srv_${INTERFACE} 2>&1 > /dev/null
|
||||
ipset -q flush omr6_dst_bypass_srv_${INTERFACE} 2>&1 > /dev/null
|
||||
ipset -q --exist restore <<-EOF
|
||||
create omr_dst_bypass_srv_${INTERFACE} hash:net hashsize 64
|
||||
create omr6_dst_bypass_srv_${INTERFACE} hash:net family inet6 hashsize 64
|
||||
EOF
|
||||
ipv4=$(cat /etc/openmptcprouter-vps-admin/omr-bypass.json | jq -r .${INTERFACE}.ipv4[])
|
||||
for ip in $ipv4; do
|
||||
ipset -q add omr_dst_bypass_srv_${INTERFACE} $ip
|
||||
done
|
||||
ipv6=$(cat /etc/openmptcprouter-vps-admin/omr-bypass.json | jq -r .${INTERFACE}.ipv6[])
|
||||
for ip in $ipv6; do
|
||||
ipset -q add omr6_dst_bypass_srv_${INTERFACE} $ip
|
||||
done
|
||||
iptables-save --counters 2>/dev/null | grep -v omr-bypass | iptables-restore -w --counters 2>/dev/null
|
||||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
:omr-bypass -
|
||||
-A PREROUTING -j omr-bypass
|
||||
COMMIT
|
||||
EOF
|
||||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
:omr-bypass-local -
|
||||
-A OUTPUT -m addrtype ! --dst-type LOCAL -j omr-bypass-local
|
||||
COMMIT
|
||||
EOF
|
||||
iptables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
-A omr-bypass -m set --match-set omr_dst_bypass_srv_${INTERFACE} dst -j MARK --set-mark ${MARK}
|
||||
-A omr-bypass -m mark --mark ${MARK} -j RETURN
|
||||
-A omr-bypass-local -m set --match-set omr_dst_bypass_srv_${INTERFACE} dst -j MARK --set-mark ${MARK}
|
||||
-A omr-bypass-local -m mark --mark ${MARK} -j RETURN
|
||||
COMMIT
|
||||
EOF
|
||||
ip rule add prio 1 fwmark ${MARK} lookup ${TABLE} > /dev/null 2>&1
|
||||
ip route replace default via ${GATEWAY} dev ${INTERFACE} table ${TABLE}
|
||||
ip6tables-save --counters 2>/dev/null | grep -v omr-bypass | ip6tables-restore -w --counters 2>/dev/null
|
||||
ip6tables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
:omr-bypass -
|
||||
-A PREROUTING -j omr-bypass
|
||||
COMMIT
|
||||
EOF
|
||||
ip6tables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
:omr-bypass-local -
|
||||
-A OUTPUT -m addrtype ! --dst-type LOCAL -j omr-bypass-local
|
||||
COMMIT
|
||||
EOF
|
||||
ip6tables-restore -w --wait=60 --noflush <<-EOF
|
||||
*mangle
|
||||
-A omr-bypass -m set --match-set omr6_dst_bypass_srv_${INTERFACE} dst -j MARK --set-mark ${MARK}
|
||||
-A omr-bypass -m mark --mark ${MARK} -j RETURN
|
||||
-A omr-bypass-local -m set --match-set omr6_dst_bypass_srv_${INTERFACE} dst -j MARK --set-mark ${MARK}
|
||||
-A omr-bypass-local -m mark --mark ${MARK} -j RETURN
|
||||
COMMIT
|
||||
EOF
|
||||
if [ -n "$GATEWAY6" ]; then
|
||||
ip rule add prio 1 fwmark ${MARK} lookup ${TABLE} > /dev/null 2>&1
|
||||
ip route replace default via ${GATEWAY6} dev ${INTERFACE} table ${TABLE}
|
||||
fi
|
12
omr-bypass.service.in
Normal file
12
omr-bypass.service.in
Normal file
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=OMR-ByPass
|
||||
After=network.target network-online.target shorewall.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/omr-bypass
|
||||
KillSignal=9
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
8
omr-bypass.timer.in
Normal file
8
omr-bypass.timer.in
Normal file
|
@ -0,0 +1,8 @@
|
|||
[Unit]
|
||||
Description=Timer for omr-bypass
|
||||
|
||||
[Timer]
|
||||
OnUnitActiveSec=300
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
|
@ -8,6 +8,11 @@ if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "9" ]; then
|
|||
echo "This script doesn't work with Debian Stretch (9.x)"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "You must run the script as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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 "Don't apply Pi-hole firewall rules."
|
||||
|
@ -26,13 +31,14 @@ $SERVER["socket"] == "10.255.252.1:80" { }
|
|||
$SERVER["socket"] == "10.255.251.1:80" { }
|
||||
$SERVER["socket"] == "10.255.253.1:80" { }
|
||||
EOF
|
||||
systemctl -q restart lighttpd
|
||||
systemctl list-unit-files lighttpd.service &>/dev/null && systemctl -q restart lighttpd
|
||||
grep -v -e PIHOLE_INTERFACE -e IPV4_ADDRESS -e IPV6_ADDRESS /etc/pihole/setupVars.conf > /etc/pihole/setupVars.new.conf
|
||||
mv /etc/pihole/setupVars.new.conf /etc/pihole/setupVars.conf
|
||||
cat >> /etc/pihole/setupVars.conf <<-EOF
|
||||
PIHOLE_INTERFACE=gt-tun0
|
||||
IPV4_ADDRESS=10.255.0.0/16
|
||||
IPV6_ADDRESS=fe80::aff:ff01/64
|
||||
IPV6_ADDRESS=fd00::a00:/106
|
||||
RATE_LIMIT=0/0
|
||||
EOF
|
||||
|
||||
grep -v interface /etc/dnsmasq.d/01-pihole.conf > /etc/dnsmasq.d/01-pihole.new.conf
|
||||
|
|
325
omr-service
325
omr-service
|
@ -1,129 +1,232 @@
|
|||
#!/bin/bash
|
||||
# OpenMPTCProuter VPS service script
|
||||
# This script configure 6in4, multipath and firewall for current VPN
|
||||
|
||||
if [ "$1" = "stop" ] && [ "$(ip link show omr-6in4 up 2>/dev/null)" ]; then
|
||||
ip route del fd00::/8 via fe80::a00:2 dev omr-6in4
|
||||
ip link set omr-6in4 down
|
||||
ip tunnel del omr-6in4
|
||||
exit 0
|
||||
fi
|
||||
|
||||
_multipath() {
|
||||
# Force multipath status
|
||||
source /etc/shorewall/params.net
|
||||
for intf in `ls -1 /sys/class/net`; do
|
||||
if [ "$intf" = "$NET_IFACE" ]; then
|
||||
multipath $intf on
|
||||
else
|
||||
multipath $intf off
|
||||
if [ "$intf" != "bonding_masters" ]; then
|
||||
if ([ "$(ip a show dev lo | grep -v inet6 | grep global)" != "" ] && [ "$intf" = "lo" ]) || ([ "$intf" = "$NET_IFACE" ] && [ "$(ip a show dev lo | grep -v inet6 | grep global)" = "" ]); then
|
||||
[ -f /proc/sys/net/mptcp/mptcp_enabled ] && [ "$(multipath $intf | tr -d '\n')" != "$intf is in default mode" ] && multipath $intf on >/dev/null 2>&1
|
||||
[ -f /proc/sys/net/mptcp/enabled ] && [ "$(multipath $intf | tr -d '\n')" != "$intf is in signal mode" ] && {
|
||||
multipath $intf signal >/dev/null 2>&1
|
||||
ip mptcp limits set subflows 8 add_addr_accepted 8 >/dev/null 2>&1
|
||||
}
|
||||
else
|
||||
[ "$(multipath $intf | tr -d '\n')" != "$intf is deactivated" ] && multipath $intf off >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Add IPv6 tunnel
|
||||
if [ "$(ip link show omr-6in4 up 2>/dev/null)" ]; then
|
||||
ip tunnel change omr-6in4 mode sit remote 10.255.255.2 local 10.255.255.1
|
||||
else
|
||||
ip tunnel add omr-6in4 mode sit remote 10.255.255.2 local 10.255.255.1
|
||||
ip addr add fe80::a00:1/126 dev omr-6in4 >/dev/null 2>&1
|
||||
fi
|
||||
ip link set omr-6in4 up
|
||||
ip route replace fd00::/8 via fe80::a00:2 dev omr-6in4
|
||||
|
||||
_ping() {
|
||||
local host=$1
|
||||
ret=$(ping -4 "${host}" \
|
||||
-W 5 \
|
||||
-c 1 \
|
||||
-q
|
||||
)
|
||||
[ -n "$ret" ] && echo "$ret" | grep -s " 0% packet loss" > /dev/null && {
|
||||
return
|
||||
}
|
||||
false
|
||||
_glorytun_udp() {
|
||||
#if [ -n "$(systemctl -a | grep 'glorytun-udp')" ]; then
|
||||
if systemctl list-unit-files glorytun-udp@.service >/dev/null; then
|
||||
[ -z "$(glorytun show dev gt-udp-tun0 2>/dev/null | grep tunnel)" ] && {
|
||||
logger -t "OMR-Service" "Restart Glorytun-UDP"
|
||||
systemctl -q restart 'glorytun-udp@*'
|
||||
sleep 10
|
||||
}
|
||||
for intf in /etc/glorytun-udp/tun*; do
|
||||
[ "$(echo $intf | grep key)" = "" ] && /etc/glorytun-udp/post.sh ${intf}
|
||||
done
|
||||
#ip link set mtu 9000 dev gt-udp-tun0 >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
_ping_range() {
|
||||
local network=$1
|
||||
for i in {2..50} ;do
|
||||
_ping $network$i
|
||||
pingr=$?
|
||||
if $(exit $pingr); then
|
||||
ipd=$network$i
|
||||
return
|
||||
fi
|
||||
done
|
||||
false
|
||||
}
|
||||
|
||||
while true; do
|
||||
source /etc/shorewall/params.vpn
|
||||
iface=""
|
||||
currentaddr=$(ip addr show omr-6in4 | grep link/sit | awk '{print $2}' | tr -d "\n")
|
||||
currentpeer=$(ip addr show omr-6in4 | grep link/sit | awk '{print $4}' | tr -d "\n")
|
||||
if [ -n "$currentpeer" ]; then
|
||||
_ping $currentpeer
|
||||
status=$?
|
||||
if ! $(exit $status) || [ "$currentpeer" != "$OMR_ADDR" ]; then
|
||||
allip_tcp=$(ip -4 addr show gt-tun0 2>/dev/null | grep inet)
|
||||
allip_udp=$(ip -4 addr show gt-udp-tun0 2>/dev/null | grep inet)
|
||||
[ -d "/sys/class/net/mlvpn0" ] && allip_mlvpn=$(ip -4 addr show mlvpn0 2>/dev/null | grep inet)
|
||||
[ -d "/sys/class/net/tun0" ] && allip_openvpn=$(ip -4 addr show tun0 2>/dev/null | grep inet)
|
||||
[ -d "/sys/class/net/dsvpn0" ] && allip_dsvpn=$(ip -4 addr show dsvpn0 2>/dev/null | grep inet)
|
||||
if [ -f /etc/openmptcprouter-vps-admin/current-vpn ]; then
|
||||
current_vpn="$(cat /etc/openmptcprouter-vps-admin/current-vpn)"
|
||||
[ "$current_vpn" = "glorytun_tcp" ] && allip="$allip_tcp"
|
||||
[ "$current_vpn" = "glorytun_udp" ] && allip="$allip_udp"
|
||||
[ "$current_vpn" = "mlvpn" ] && allip="$allip_mlvpn"
|
||||
[ "$current_vpn" = "openvpn" ] && allip="$allip_openvpn"
|
||||
[ "$current_vpn" = "dsvpn" ] && allip="$allip_dsvpn"
|
||||
fi
|
||||
if [ -z "$allip" ]; then
|
||||
allip="$allip_tcp
|
||||
$allip_udp
|
||||
$allip_openvpn
|
||||
$allip_dsvpn
|
||||
$allip_mlvpn"
|
||||
fi
|
||||
while IFS= read -r inet; do
|
||||
ip=$(echo $inet | awk '{print $2}' | cut -d/ -f1 | tr -d "\n")
|
||||
if [ "$ip" != "" ]; then
|
||||
_ping_range $(echo $ip | sed 's/.1$/./' | tr -d "\n")
|
||||
statusr=$?
|
||||
if $(exit $statusr); then
|
||||
_ping $ipd
|
||||
statusp=$?
|
||||
if $(exit $statusp); then
|
||||
logger -t "OMR-Service" "Set new 6in4 tunnel IPs"
|
||||
ip tunnel change omr-6in4 mode sit remote $ipd local $ip
|
||||
echo "VPS_ADDR=$ip" > /etc/shorewall/params.vpn
|
||||
echo "OMR_ADDR=$ipd" >> /etc/shorewall/params.vpn
|
||||
iface=$(ip -4 addr | grep $ip/ | awk '{print $7}' | tr -d "\n")
|
||||
echo "VPS_IFACE=$iface" >> /etc/shorewall/params.vpn
|
||||
systemctl reload shorewall
|
||||
_multipath
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done < <(printf '%s\n' "$allip")
|
||||
[ -z "$iface" ] && [ -f /etc/openmptcprouter-vps-admin/current-vpn ] && {
|
||||
logger -t "OMR-Service" "Restart Glorytun and networkd"
|
||||
current_vpn="$(cat /etc/openmptcprouter-vps-admin/current-vpn)"
|
||||
[ "$current_vpn" = "glorytun_tcp" ] && systemctl -q restart glorytun-tcp@tun0
|
||||
[ "$current_vpn" = "glorytun_udp" ] && systemctl -q restart glorytun-udp@tun0
|
||||
systemctl -q restart systemd-networkd
|
||||
_multipath
|
||||
_glorytun_tcp() {
|
||||
#if [ -n "$(systemctl -a | grep 'glorytun-tcp')" ]; then
|
||||
if systemctl list-unit-files glorytun-tcp@.service >/dev/null; then
|
||||
for intf in /etc/glorytun-tcp/tun*; do
|
||||
[ "$(echo $intf | grep key)" = "" ] && timeout 10 /etc/glorytun-tcp/post.sh ${intf}
|
||||
done
|
||||
if [ -f /etc/openmptcprouter-vps-admin/current-vpn ] && [ "$(cat /etc/openmptcprouter-vps-admin/current-vpn)" = "glorytun_tcp" ]; then
|
||||
localip="$(cat /etc/glorytun-tcp/tun0 | grep LOCALIP | cut -d '=' -f2)"
|
||||
[ -z "$localip" ] && localip="10.255.255.1"
|
||||
remoteip="$(echo $localip | sed 's/\.1/\.2/')"
|
||||
if [ "$(ping -c 3 -w 10 $remoteip | grep '100%')" != "" ] && ([ -z "$(pgrep glorytun-tcp)" ] || [ "$(expr $(date +%s) - $(stat -c %Y /proc/$(pgrep glorytun-tcp)/exe ))" -gt "300" ]); then
|
||||
logger -t "OMR-Service" "No answer from VPN client end, restart Glorytun-TCP"
|
||||
systemctl restart glorytun-tcp@tun0
|
||||
sleep 10
|
||||
}
|
||||
fi
|
||||
fi
|
||||
#ip link set mtu 9000 dev gt-tun0 >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
_dsvpn() {
|
||||
#if [ -n "$(systemctl -a | grep 'dsvpn')" ]; then
|
||||
if systemctl list-unit-files dsvpn-server@.service >/dev/null; then
|
||||
[ -n "$(ip -6 r show 64:ff9b::/96 dev dsvpn0)" ] && ip -6 r del 64:ff9b::/96 dev dsvpn0 >/dev/null 2>&1
|
||||
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-server@dsvpn0
|
||||
fi
|
||||
#ip link set mtu 9000 dev dsvpn0 >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
#result="$(curl -Isk -m 30 https://127.0.0.1:65500/status | head -n 1 | grep 405)"
|
||||
#if [ "$result" = "" ]; then
|
||||
# logger -t "OMR-Service" "Restart OMR Admin"
|
||||
# systemctl -q restart omr-admin
|
||||
# sleep 10
|
||||
#fi
|
||||
}
|
||||
|
||||
_shadowsocks() {
|
||||
if systemctl list-unit-files shadowsocks-libev-manager@.service >/dev/null; then
|
||||
[ -z "$(pgrep ss-server)" ] && {
|
||||
logger -t "OMR-Service" "ss-server not detected, restart Shadowsocks libev"
|
||||
systemctl restart shadowsocks-libev-manager@manager
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
_shadowsocks_go() {
|
||||
if systemctl list-unit-files shadowsocks-go.service >/dev/null; then
|
||||
[ -z "$(pgrep shadowsocks-go)" ] && {
|
||||
logger -t "OMR-Service" "ss-server not detected, restart Shadowsocks go"
|
||||
systemctl restart shadowsocks-go
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
_xray() {
|
||||
if systemctl list-unit-files xray.service >/dev/null; then
|
||||
[ -z "$(pgrep xray)" ] && {
|
||||
logger -t "OMR-Service" "ss-server not detected, restart XRay"
|
||||
systemctl restart xray
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
_v2ray() {
|
||||
if systemctl list-unit-files v2ray.service >/dev/null; then
|
||||
[ -z "$(pgrep v2ray)" ] && {
|
||||
logger -t "OMR-Service" "ss-server not detected, restart V2Ray"
|
||||
systemctl restart v2ray
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
_wireguard() {
|
||||
#if [ -n "$(systemctl -a | grep 'wg')" ]; then
|
||||
if systemctl list-unit-files wg-quick@.service >/dev/null; then
|
||||
[ -z "$(ip a show dev wg0 | grep '10.255.247.1')" ] && ip a add 10.255.247.1/24 dev wg0 >/dev/null 2>&1
|
||||
[ -z "$(ip a show dev client-wg0 | grep '10.255.246.1')" ] && ip a add 10.255.246.1/24 dev client-wg0 >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
_omr_api() {
|
||||
[ -z "$(pgrep curl)" ] && [ -z "$(curl -s -k -m 30 https://127.0.0.1:65500/)" ] && {
|
||||
logger -t "OMR-Service" "Can't contact API, restart OMR-Admin"
|
||||
systemctl -q restart omr-admin
|
||||
}
|
||||
}
|
||||
|
||||
_lan_route() {
|
||||
jq -c '.users[0][]?' /etc/openmptcprouter-vps-admin/omr-admin-config.json |
|
||||
while IFS=$"\n" read -r c; do
|
||||
if [ -n "$c" ]; then
|
||||
vpnremoteip=$(echo "$c" | jq -r '.vpnremoteip')
|
||||
username=$(echo "$c" | jq -r '.username')
|
||||
if [ -n "$vpnremoteip" ] && [ "$vpnremoteip" != "null" ]; then
|
||||
echo "$c" | jq -c -r '.lanips[]? //empty' |
|
||||
while IFS=$"\n" read -r d; do
|
||||
if [ "$d" != "" ]; then
|
||||
network=$(ipcalc -n $d | grep Network | awk '{print $2}')
|
||||
networkonly=$(ipcalc -n $d | grep Network | awk '{print $2}' | cut -d/ -f1)
|
||||
netmask=$(ipcalc -n $d | grep Netmask | awk '{print $2}')
|
||||
[ -n "$network" ] && [ -z "$(ip r show $network via $vpnremoteip)" ] && ip r replace $network via $vpnremoteip >/dev/null 2>&1
|
||||
[ -n "$networkonly" ] && [ -n "$netmask" ] && ([ ! -f /etc/openvpn/ccd/${username} ] || [ -z "$(grep $networkonly /etc/openvpn/ccd/${username})" ]) && echo "iroute $networkonly $netmask" >> /etc/openvpn/ccd/${username}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
_gre_tunnels() {
|
||||
. "$(readlink -f "/etc/shorewall/params.vpn")"
|
||||
if [ -n "$OMR_ADDR" ]; then
|
||||
for intf in /etc/openmptcprouter-vps-admin/intf/*; do
|
||||
if [ -f "$intf" ]; then
|
||||
. "$(readlink -f "$intf")"
|
||||
iface="$(basename $intf)"
|
||||
if [ "$(ip tunnel show $iface 2>/dev/null | awk '{print $4}')" != "$OMR_ADDR" ]; then
|
||||
[ -n "$(ip tunnel show $iface 2>/dev/null)" ] && ip tunnel del $iface >/dev/null 2>&1
|
||||
ip tunnel add $iface mode gre local $INTFADDR remote $OMR_ADDR >/dev/null 2>&1
|
||||
ip link set $iface up >/dev/null 2>&1
|
||||
ip addr add $LOCALIP dev $iface >/dev/null 2>&1
|
||||
ip route add $NETWORK dev $iface >/dev/null 2>&1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
_openvpn_bonding() {
|
||||
if [ "$(ip link show ovpnbonding1 2>/dev/null)" != "" ] && ([ "$(ip link show ovpnbonding1 2>/dev/null | grep SLAVE)" = "" ] || [ "$(ip link show omr-bonding 2>/dev/null | grep DOWN)" != "" ] || [ "$(ip link show | grep ovpnbonding | grep -c SLAVE | tr -d '\n')" != "8" ]); then
|
||||
echo 0 > /sys/class/net/omr-bonding/bonding/mode >/dev/null 2>&1
|
||||
ip link set ovpnbonding1 master omr-bonding >/dev/null 2>&1
|
||||
ip link set ovpnbonding1 up >/dev/null 2>&1
|
||||
ip link set ovpnbonding2 master omr-bonding >/dev/null 2>&1
|
||||
ip link set ovpnbonding2 up >/dev/null 2>&1
|
||||
ip link set ovpnbonding3 master omr-bonding >/dev/null 2>&1
|
||||
ip link set ovpnbonding3 up >/dev/null 2>&1
|
||||
ip link set ovpnbonding4 master omr-bonding >/dev/null 2>&1
|
||||
ip link set ovpnbonding4 up >/dev/null 2>&1
|
||||
ip link set ovpnbonding5 master omr-bonding >/dev/null 2>&1
|
||||
ip link set ovpnbonding5 up >/dev/null 2>&1
|
||||
ip link set ovpnbonding6 master omr-bonding >/dev/null 2>&1
|
||||
ip link set ovpnbonding6 up >/dev/null 2>&1
|
||||
ip link set ovpnbonding7 master omr-bonding >/dev/null 2>&1
|
||||
ip link set ovpnbonding7 up >/dev/null 2>&1
|
||||
ip link set ovpnbonding8 master omr-bonding >/dev/null 2>&1
|
||||
ip link set ovpnbonding8 up >/dev/null 2>&1
|
||||
ip link set omr-bonding up mtu 1440 >/dev/null 2>&1
|
||||
ip a add 10.255.248.1 dev omr-bonding >/dev/null 2>&1
|
||||
ip r add 10.255.248.0/24 dev omr-bonding >/dev/null 2>&1
|
||||
ip r add 10.255.248.2 dev omr-bonding src 10.255.248.1 >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
_vpn1() {
|
||||
vpn1route=$(ip r show dev vpn1 2>/dev/null | grep '0.0.0.0')
|
||||
[ -z "$vpn1route" ] && vpn1route=$(ip r show dev vpn1 2>/dev/null | grep 'default')
|
||||
if [ -n "$vpn1route" ]; then
|
||||
ip r del $vpn1route
|
||||
vpn1gw="$(echo \"$vpn1route\" | awk '{ print $3 }')"
|
||||
ip r a default via $vpngw dev vpn1 table 991337
|
||||
for route in $(ip r show dev vpn1); do
|
||||
ip r a $route table 991337
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
sysctl -p /etc/sysctl.d/90-shadowsocks.conf >/dev/null 2>&1
|
||||
modprobe bonding >/dev/null 2>&1
|
||||
ip link add omr-bonding type bond >/dev/null 2>&1
|
||||
#[ -n "$(uname -r | grep '6.1')" ] && {
|
||||
# stap -g /usr/share/systemtap-mptcp/mptcp-app.stap 2>&1 &
|
||||
#}
|
||||
|
||||
gre_tunnels="$(jq -c '.gre_tunnels' /etc/openmptcprouter-vps-admin/omr-admin-config.json)"
|
||||
lan_routes="$(jq -c '.lan_routes' /etc/openmptcprouter-vps-admin/omr-admin-config.json)"
|
||||
|
||||
while true; do
|
||||
_glorytun_udp
|
||||
_glorytun_tcp
|
||||
_shadowsocks
|
||||
_shadowsocks_go
|
||||
_xray
|
||||
_v2ray
|
||||
_dsvpn
|
||||
_wireguard
|
||||
_multipath
|
||||
_omr_api
|
||||
[ "$lan_routes" != "false" ] && _lan_route
|
||||
[ "$gre_tunnels" != "false" ] && _gre_tunnels
|
||||
_openvpn_bonding
|
||||
_vpn1
|
||||
sleep 10
|
||||
done
|
||||
|
|
55
omr-test-speed
Normal file
55
omr-test-speed
Normal file
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||
HETZNER=false
|
||||
if [ "$1" = "hetzner" ]; then
|
||||
HETZNER=true
|
||||
INTERFACE="$2"
|
||||
else
|
||||
INTERFACE="$1"
|
||||
fi
|
||||
|
||||
[ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && {
|
||||
echo "You must use a real interface. You wan find them using 'ip a' for example"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ "$HETZNER" = false ]; then
|
||||
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 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"
|
||||
for pinghost in $HOSTLST; do
|
||||
domain=$(echo $pinghost | awk -F/ '{print $3}')
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
ping=$(ping -c1 -w2 $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
||||
else
|
||||
ping=$(ping -c1 -w2 -I $INTERFACE -B $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
||||
fi
|
||||
echo "host: $domain - ping: $ping"
|
||||
if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then
|
||||
bestping=$ping
|
||||
HOST=$pinghost
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
[ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin"
|
||||
|
||||
echo "Best server is $HOST, running test:"
|
||||
trap : HUP INT TERM
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
curl -4 -o /dev/null $HOST || echo
|
||||
else
|
||||
domain=$(echo $HOST | awk -F/ '{print $3}')
|
||||
hostip=$(dig +nocmd +noall +answer A $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ')
|
||||
if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then
|
||||
for ip in $hostip; do
|
||||
ipset add ss_rules_dst_bypass_all $ip
|
||||
done
|
||||
fi
|
||||
curl -4 -o /dev/null --interface $INTERFACE $HOST || echo
|
||||
if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then
|
||||
for ip in $hostip; do
|
||||
ipset del ss_rules_dst_bypass_all $ip
|
||||
done
|
||||
fi
|
||||
fi
|
56
omr-test-speedv6
Normal file
56
omr-test-speedv6
Normal file
|
@ -0,0 +1,56 @@
|
|||
#!/bin/sh
|
||||
# vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 :
|
||||
HETZNER=false
|
||||
if [ "$1" = "hetzner" ]; then
|
||||
HETZNER=true
|
||||
INTERFACE="$2"
|
||||
else
|
||||
INTERFACE="$1"
|
||||
fi
|
||||
|
||||
[ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && {
|
||||
echo "You must use a real interface. You wan find them using 'ip a' for example"
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
if [ "$HETZNER" = false ]; then
|
||||
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 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"
|
||||
for pinghost in $HOSTLST; do
|
||||
domain=$(echo $pinghost | awk -F/ '{print $3}')
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
ping=$(ping -6 -c1 -w2 $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
||||
else
|
||||
ping=$(ping -6 -c1 -w2 -I $INTERFACE -B $domain | cut -d "/" -s -f5 | cut -d "." -f1)
|
||||
fi
|
||||
echo "host: $domain - ping: $ping"
|
||||
if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then
|
||||
bestping=$ping
|
||||
HOST=$pinghost
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
[ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin"
|
||||
|
||||
echo "Best server is $HOST, running test:"
|
||||
trap : HUP INT TERM
|
||||
if [ -z "$INTERFACE" ]; then
|
||||
curl -6 $HOST >/dev/null || echo
|
||||
else
|
||||
domain=$(echo $HOST | awk -F/ '{print $3}')
|
||||
hostip=$(dig +nocmd +noall +answer AAAA $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ')
|
||||
if [ -n "$(ipset list 2>/dev/null | grep ss_rules6)" ]; then
|
||||
for ip in $hostip; do
|
||||
ipset add ss_rules6_dst_bypass_all $ip
|
||||
done
|
||||
fi
|
||||
curl -6 --interface $INTERFACE $HOST >/dev/null || echo
|
||||
if [ -n "$(ipset list 2>/dev/null | grep ss_rules6)" ]; then
|
||||
for ip in $hostip; do
|
||||
ipset del ss_rules6_dst_bypass_all $ip
|
||||
done
|
||||
fi
|
||||
fi
|
11
omr-update
Executable file
11
omr-update
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
if [ -f /etc/openmptcprouter-vps-admin/update ]; then
|
||||
wget -O - http://www.openmptcprouter.com/server/debian.sh | sh
|
||||
rm -f /etc/openmptcprouter-vps-admin/update
|
||||
reboot
|
||||
fi
|
||||
if [ -f /etc/openmptcprouter-vps-admin/update-bin ]; then
|
||||
LOCALFILES=yes SOURCES=yes REINSTALL=no /usr/share/omr-server/debian9-x86_64.sh
|
||||
rm -f /etc/openmptcprouter-vps-admin/update-bin
|
||||
#reboot
|
||||
fi
|
15
omr-update.service.in
Normal file
15
omr-update.service.in
Normal file
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=OMR Update
|
||||
After=network.target network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=no
|
||||
ExecStart=/usr/bin/omr-update
|
||||
#ExecStart=/usr/share/omr-server/debian9-x86_64.sh
|
||||
AmbientCapabilities=
|
||||
StandardOutput=file:/var/log/omr-update.log
|
||||
StandardError=file:/var/log/omr-update.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,12 +1,12 @@
|
|||
[Unit]
|
||||
Description=OMR
|
||||
After=network.target network-online.target glorytun-tcp@.service glorytun-udp@.service
|
||||
After=network.target network-online.target glorytun-tcp@.service glorytun-udp@.service shorewall.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
ExecStart=/usr/local/bin/omr-service
|
||||
ExecStop=/usr/local/bin/omr-service stop
|
||||
KillSignal=9
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW
|
||||
|
||||
[Install]
|
||||
|
|
|
@ -5,7 +5,8 @@ After=network.target network-online.target
|
|||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/omr-6in4-run start /etc/openmptcprouter-vps-admin/omr-6in4/%i
|
||||
ExecStop=/usr/local/bin/omr-6in4-run start /etc/openmptcprouter-vps-admin/omr-6in4/%i
|
||||
RemainAfterExit=true
|
||||
ExecStop=/usr/local/bin/omr-6in4-run stop /etc/openmptcprouter-vps-admin/omr-6in4/%i
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
Binary file not shown.
Binary file not shown.
18
openvpn-bonding1.conf
Normal file
18
openvpn-bonding1.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
dev ovpnbonding1
|
||||
dev-type tap
|
||||
cipher AES-256-CBC
|
||||
proto udp
|
||||
proto udp6
|
||||
port 65351
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
verb 3
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 100 2400
|
||||
mode server
|
||||
tls-server
|
18
openvpn-bonding2.conf
Normal file
18
openvpn-bonding2.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
dev ovpnbonding2
|
||||
dev-type tap
|
||||
cipher AES-256-CBC
|
||||
proto udp
|
||||
proto udp6
|
||||
port 65352
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
verb 3
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 100 2400
|
||||
mode server
|
||||
tls-server
|
18
openvpn-bonding3.conf
Normal file
18
openvpn-bonding3.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
dev ovpnbonding3
|
||||
dev-type tap
|
||||
cipher AES-256-CBC
|
||||
proto udp
|
||||
proto udp6
|
||||
port 65353
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
verb 3
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 100 2400
|
||||
mode server
|
||||
tls-server
|
18
openvpn-bonding4.conf
Normal file
18
openvpn-bonding4.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
dev ovpnbonding4
|
||||
dev-type tap
|
||||
cipher AES-256-CBC
|
||||
proto udp
|
||||
proto udp6
|
||||
port 65354
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
verb 3
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 100 2400
|
||||
mode server
|
||||
tls-server
|
18
openvpn-bonding5.conf
Normal file
18
openvpn-bonding5.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
dev ovpnbonding5
|
||||
dev-type tap
|
||||
cipher AES-256-CBC
|
||||
proto udp
|
||||
proto udp6
|
||||
port 65355
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
verb 3
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 100 2400
|
||||
mode server
|
||||
tls-server
|
18
openvpn-bonding6.conf
Normal file
18
openvpn-bonding6.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
dev ovpnbonding6
|
||||
dev-type tap
|
||||
cipher AES-256-CBC
|
||||
proto udp
|
||||
proto udp6
|
||||
port 65356
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
verb 3
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 100 2400
|
||||
mode server
|
||||
tls-server
|
18
openvpn-bonding7.conf
Normal file
18
openvpn-bonding7.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
dev ovpnbonding7
|
||||
dev-type tap
|
||||
cipher AES-256-CBC
|
||||
proto udp
|
||||
proto udp6
|
||||
port 65357
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
verb 3
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 100 2400
|
||||
mode server
|
||||
tls-server
|
18
openvpn-bonding8.conf
Normal file
18
openvpn-bonding8.conf
Normal file
|
@ -0,0 +1,18 @@
|
|||
dev ovpnbonding8
|
||||
dev-type tap
|
||||
cipher AES-256-CBC
|
||||
proto udp
|
||||
proto udp6
|
||||
port 65358
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
verb 3
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 100 2400
|
||||
mode server
|
||||
tls-server
|
34
openvpn-tun0.6.1.conf
Normal file
34
openvpn-tun0.6.1.conf
Normal file
|
@ -0,0 +1,34 @@
|
|||
topology subnet
|
||||
dev tun0
|
||||
user nobody
|
||||
group nogroup
|
||||
data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305
|
||||
disable-dco
|
||||
proto tcp-server
|
||||
proto tcp6-server
|
||||
port 65301
|
||||
persist-tun
|
||||
persist-key
|
||||
duplicate-cn
|
||||
verb 3
|
||||
server 10.255.252.0 255.255.255.0
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 10 240
|
||||
txqueuelen 1000
|
||||
sndbuf 262144
|
||||
push "sndbuf 262144"
|
||||
rcvbuf 262144
|
||||
push "rcvbuf 262144"
|
||||
tun-mtu 1420
|
||||
tls-server
|
||||
tls-version-min 1.2
|
||||
#push "route 10.255.252.1 255.255.255.255"
|
||||
client-config-dir ccd
|
||||
ifconfig-pool-persist ccd/ipp_tcp.txt
|
||||
passtos
|
||||
management 127.0.0.1 65302
|
||||
tcp-nodelay
|
|
@ -6,6 +6,7 @@ proto tcp
|
|||
port 65301
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
duplicate-cn
|
||||
verb 3
|
||||
server 10.255.252.0 255.255.255.0
|
||||
|
@ -14,11 +15,15 @@ cert /etc/openvpn/ca/pki/issued/server.crt
|
|||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 10 120
|
||||
keepalive 10 240
|
||||
sndbuf 0
|
||||
rcvbuf 0
|
||||
txqueuelen 2000
|
||||
tun-mtu 1400
|
||||
mssfix 1360
|
||||
tls-server
|
||||
tls-version-min 1.2
|
||||
#compress lzo
|
||||
push "route 10.255.252.1 255.255.255.255"
|
||||
#push "route 10.255.252.1 255.255.255.255"
|
||||
client-config-dir ccd
|
||||
management localhost 65302
|
||||
|
|
30
openvpn-tun1.6.1.conf
Normal file
30
openvpn-tun1.6.1.conf
Normal file
|
@ -0,0 +1,30 @@
|
|||
topology subnet
|
||||
dev tun1
|
||||
data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305
|
||||
proto udp
|
||||
proto udp6
|
||||
port 65301
|
||||
persist-tun
|
||||
persist-key
|
||||
duplicate-cn
|
||||
verb 3
|
||||
server 10.255.250.0 255.255.255.0
|
||||
ca /etc/openvpn/ca/pki/ca.crt
|
||||
cert /etc/openvpn/ca/pki/issued/server.crt
|
||||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 10 240
|
||||
txqueuelen 1000
|
||||
sndbuf 262144
|
||||
push "sndbuf 262144"
|
||||
rcvbuf 262144
|
||||
push "rcvbuf 262144"
|
||||
tun-mtu 1420
|
||||
tls-server
|
||||
tls-version-min 1.2
|
||||
push "route 10.255.250.1 255.255.255.255"
|
||||
#client-config-dir ccd
|
||||
#ifconfig-pool-persist ccd/ipp_udp.txt
|
||||
#fast-io
|
||||
passtos
|
|
@ -4,6 +4,7 @@ proto udp
|
|||
port 65301
|
||||
persist-tun
|
||||
persist-key
|
||||
reneg-sec 0
|
||||
duplicate-cn
|
||||
#ncp-disable
|
||||
#mssfix 1300
|
||||
|
@ -14,4 +15,4 @@ cert /etc/openvpn/ca/pki/issued/server.crt
|
|||
key /etc/openvpn/ca/pki/private/server.key
|
||||
dh /etc/openvpn/server/dh2048.pem
|
||||
crl-verify /etc/openvpn/ca/pki/crl.pem
|
||||
keepalive 10 120
|
||||
keepalive 10 240
|
||||
|
|
37
shadowsocks-go.server.json
Normal file
37
shadowsocks-go.server.json
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"servers": [
|
||||
{
|
||||
"name": "ss-2022",
|
||||
"protocol": "2022-blake3-aes-256-gcm",
|
||||
"tcpListeners": [
|
||||
{
|
||||
"network": "tcp",
|
||||
"address": ":65280",
|
||||
"fastOpen": false,
|
||||
"reusePort": false,
|
||||
"multipath": true
|
||||
}
|
||||
],
|
||||
"enableTCP": true,
|
||||
"listenerTFO": true,
|
||||
"enableUDP": true,
|
||||
"mtu": 1500,
|
||||
"psk": "PSK",
|
||||
"uPSKStorePath": "/etc/shadowsocks-go/upsks.json"
|
||||
}
|
||||
],
|
||||
"stats": {
|
||||
"enabled": true
|
||||
},
|
||||
"api": {
|
||||
"enabled": true,
|
||||
"debugPprof": false,
|
||||
"trustedProxies": [],
|
||||
"listeners": [
|
||||
{
|
||||
"network": "tcp",
|
||||
"address": "127.0.0.1:65279"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -6,7 +6,10 @@ After=network-online.target
|
|||
Type=simple
|
||||
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
ExecStart=/usr/bin/ss-manager -c /etc/shadowsocks-libev/%i.json
|
||||
LimitNOFILE=99999
|
||||
LimitNPROC=99999
|
||||
ExecStart=/usr/bin/ss-manager -c /etc/shadowsocks-libev/%i.json --manager-address 127.0.0.1:8839
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
77
shadowsocks.6.1.conf
Normal file
77
shadowsocks.6.1.conf
Normal file
|
@ -0,0 +1,77 @@
|
|||
# local sysctl settings can be stored in this directory
|
||||
# max open files
|
||||
fs.file-max = 512000
|
||||
# max read buffer
|
||||
net.core.rmem_max = 7500000
|
||||
# max write buffer
|
||||
net.core.wmem_max = 7500000
|
||||
#net.core.optmem_max = 33554432
|
||||
# default read buffer
|
||||
#net.core.rmem_default = 16777216
|
||||
# default write buffer
|
||||
#net.core.wmem_default = 16777216
|
||||
# max processor input queue
|
||||
net.core.netdev_max_backlog = 10000
|
||||
# max backlog
|
||||
net.core.somaxconn = 16384
|
||||
|
||||
# resist SYN flood attacks
|
||||
net.ipv4.tcp_syncookies = 1
|
||||
# reuse timewait sockets when safe
|
||||
net.ipv4.tcp_tw_reuse = 1
|
||||
# turn off fast timewait sockets recycling
|
||||
#net.ipv4.tcp_tw_recycle = 0
|
||||
# short FIN timeout
|
||||
net.ipv4.tcp_fin_timeout = 30
|
||||
# Increase max orphans
|
||||
net.ipv4.tcp_max_orphans = 16384
|
||||
# short keepalive time
|
||||
net.ipv4.tcp_keepalive_time = 7200
|
||||
# outbound port range
|
||||
net.ipv4.ip_local_port_range = 9999 65000
|
||||
# max SYN backlog
|
||||
net.ipv4.tcp_max_syn_backlog = 4096
|
||||
# max timewait sockets held by system simultaneously
|
||||
net.ipv4.tcp_max_tw_buckets = 16384
|
||||
# turn on TCP Fast Open on both client and server side
|
||||
net.ipv4.tcp_fastopen = 3
|
||||
# TCP buffer
|
||||
net.ipv4.tcp_mem = 409600 819200 1638400
|
||||
# UDP buffer
|
||||
net.ipv4.udp_mem = 4096 87380 16777216
|
||||
# TCP receive buffer
|
||||
net.ipv4.tcp_rmem = 4096 87380 16777216
|
||||
# TCP write buffer
|
||||
net.ipv4.tcp_wmem = 4096 87380 16777216
|
||||
# turn on path MTU discovery
|
||||
net.ipv4.tcp_mtu_probing = 0
|
||||
# 1/8 * available memory in receive buffer
|
||||
net.ipv4.tcp_adv_win_scale=-3
|
||||
# limits the size of unsent bytes in the write queue
|
||||
net.ipv4.tcp_notsent_lowat = 131072
|
||||
|
||||
# for low-latency network, use cubic instead
|
||||
net.core.default_qdisc = fq
|
||||
# Default conntrack is too small
|
||||
net.netfilter.nf_conntrack_max = 524288
|
||||
net.netfilter.nf_conntrack_buckets=131072
|
||||
net.netfilter.nf_conntrack_tcp_timeout_established = 86400
|
||||
|
||||
net.ipv4.conf.all.log_martians = 0
|
||||
net.ipv4.conf.default.log_martians = 0
|
||||
|
||||
# MPTCP settings
|
||||
net.ipv4.tcp_ecn = 2
|
||||
net.mptcp.checksum_enabled = 0
|
||||
net.mptcp.add_addr_timeout = 120
|
||||
net.mptcp.allow_join_initial_addr_port = 1
|
||||
net.mptcp.enabled = 1
|
||||
net.mptcp.pm_type = 0
|
||||
net.mptcp.stale_loss_cnt = 4
|
||||
net.mptcp.mptcp_checksum=0
|
||||
net.mptcp.mptcp_path_manager=fullmesh
|
||||
net.mptcp.mptcp_scheduler=mptcp_burst
|
||||
net.mptcp.mptcp_syn_retries=4
|
||||
net.mptcp.mptcp_version=1
|
||||
net.mptcp.checksum_enabled=0
|
||||
net.ipv4.tcp_congestion_control=bbr
|
|
@ -2,10 +2,10 @@
|
|||
# max open files
|
||||
fs.file-max = 512000
|
||||
# max read buffer
|
||||
net.core.rmem_max = 150000000
|
||||
net.core.rmem_max = 67108864
|
||||
# max write buffer
|
||||
net.core.wmem_max = 75000000
|
||||
net.core.optmem_max = 75000000
|
||||
net.core.wmem_max = 67108864
|
||||
net.core.optmem_max = 33554432
|
||||
# default read buffer
|
||||
net.core.rmem_default = 131072
|
||||
# default write buffer
|
||||
|
@ -22,25 +22,27 @@ net.ipv4.tcp_tw_reuse = 1
|
|||
# turn off fast timewait sockets recycling
|
||||
#net.ipv4.tcp_tw_recycle = 0
|
||||
# short FIN timeout
|
||||
net.ipv4.tcp_fin_timeout = 80
|
||||
net.ipv4.tcp_fin_timeout = 30
|
||||
# Increase max orphans
|
||||
net.ipv4.tcp_max_orphans = 16384
|
||||
# short keepalive time
|
||||
net.ipv4.tcp_keepalive_time = 7200
|
||||
# outbound port range
|
||||
net.ipv4.ip_local_port_range = 9999 65000
|
||||
# max SYN backlog
|
||||
net.ipv4.tcp_max_syn_backlog = 4096
|
||||
net.ipv4.tcp_max_syn_backlog = 10240
|
||||
# max timewait sockets held by system simultaneously
|
||||
net.ipv4.tcp_max_tw_buckets = 10000
|
||||
# turn on TCP Fast Open on both client and server side
|
||||
net.ipv4.tcp_fastopen = 3
|
||||
# TCP buffer
|
||||
net.ipv4.tcp_mem = 768174 75000000 150000000
|
||||
net.ipv4.tcp_mem = 8092 131072 67108864
|
||||
# UDP buffer
|
||||
net.ipv4.udp_mem = 768174 75000000 150000000
|
||||
net.ipv4.udp_mem = 8092 131072 67108864
|
||||
# TCP receive buffer
|
||||
net.ipv4.tcp_rmem = 4096 524288 75000000
|
||||
net.ipv4.tcp_rmem = 4096 87380 33554432
|
||||
# TCP write buffer
|
||||
net.ipv4.tcp_wmem = 4096 524288 75000000
|
||||
net.ipv4.tcp_wmem = 4096 65536 33554432
|
||||
# turn on path MTU discovery
|
||||
net.ipv4.tcp_mtu_probing = 0
|
||||
|
||||
|
@ -48,9 +50,15 @@ net.ipv4.tcp_mtu_probing = 0
|
|||
net.ipv4.tcp_congestion_control = bbr
|
||||
net.core.default_qdisc = fq
|
||||
# Default conntrack is too small
|
||||
net.netfilter.nf_conntrack_max = 131072
|
||||
net.netfilter.nf_conntrack_max = 524288
|
||||
net.netfilter.nf_conntrack_buckets=131072
|
||||
net.netfilter.nf_conntrack_tcp_timeout_established = 86400
|
||||
|
||||
net.ipv4.conf.all.log_martians = 0
|
||||
net.ipv4.conf.default.log_martians = 0
|
||||
|
||||
# MPTCP settings
|
||||
net.mptcp.mptcp_checksum = 0
|
||||
net.mptcp.mptcp_syn_retries = 1
|
||||
net.ipv4.tcp_ecn=1
|
||||
net.mptcp.mptcp_syn_retries = 4
|
||||
net.mptcp.mptcp_scheduler = blest
|
||||
net.ipv4.tcp_ecn = 2
|
||||
|
|
|
@ -15,9 +15,12 @@
|
|||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net $NET_IFACE dhcp,tcpflags,routefilter,nosmurfs,sourceroute=0
|
||||
vpn gt-tun+ nosmurfs,routefilter,tcpflags
|
||||
vpn gt-udp-tun+ nosmurfs,routefilter,tcpflags
|
||||
vpn mlvpn+ nosmurfs,routefilter,tcpflags
|
||||
vpn tun+ nosmurfs,routefilter,tcpflags
|
||||
vpn dsvpn+ nosmurfs,routefilter,tcpflags
|
||||
|
||||
vpn gt-tun+ nosmurfs,tcpflags
|
||||
vpn gt-udp-tun+ nosmurfs,tcpflags
|
||||
vpn mlvpn+ nosmurfs,tcpflags
|
||||
vpn tun+ nosmurfs,tcpflags
|
||||
vpn wg+ nosmurfs,tcpflags
|
||||
vpncl client-wg+ nosmurfs,tcpflags
|
||||
vpn dsvpn+ nosmurfs,tcpflags
|
||||
vpn gre-user+ nosmurfs,tcpflags
|
||||
vpn omr-bonding nosmurfs,tcpflags
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
VPS_ADDR=10.255.255.1
|
||||
OMR_ADDR=10.255.255.2
|
||||
VPS_IFACE=gt-tun0
|
||||
VPS_ADDR=10.255.252.1
|
||||
OMR_ADDR=10.255.252.2
|
||||
VPS_IFACE=tun0
|
||||
|
|
|
@ -17,8 +17,10 @@ vpn net ACCEPT
|
|||
vpn fw ACCEPT
|
||||
fw vpn ACCEPT
|
||||
fw net ACCEPT
|
||||
net all DROP info
|
||||
net all DROP
|
||||
vpn vpn DROP
|
||||
vpncl vpn ACCEPT
|
||||
vpn vpncl ACCEPT
|
||||
# THE FOLLOWING POLICY MUST BE LAST
|
||||
all all REJECT info
|
||||
all all REJECT
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ INVALID_LOG_LEVEL=
|
|||
|
||||
LOG_BACKEND=
|
||||
|
||||
LOG_MARTIANS=Yes
|
||||
LOG_MARTIANS=No
|
||||
|
||||
LOG_VERBOSITY=2
|
||||
|
||||
|
@ -108,10 +108,11 @@ TC=
|
|||
###############################################################################
|
||||
|
||||
ACCEPT_DEFAULT=none
|
||||
DROP_DEFAULT=Drop
|
||||
BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
|
||||
DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
NFQUEUE_DEFAULT=none
|
||||
QUEUE_DEFAULT=none
|
||||
REJECT_DEFAULT=Reject
|
||||
REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)"
|
||||
|
||||
###############################################################################
|
||||
# R S H / R C P C O M M A N D S
|
||||
|
@ -144,17 +145,17 @@ BASIC_FILTERS=No
|
|||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=Yes
|
||||
#CHAIN_SCRIPTS=Yes
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
CLEAR_TC=Yes
|
||||
CLEAR_TC=No
|
||||
|
||||
COMPLETE=No
|
||||
|
||||
DEFER_DNS_RESOLUTION=Yes
|
||||
|
||||
DELETE_THEN_ADD=Yes
|
||||
DELETE_THEN_ADD=No
|
||||
|
||||
DETECT_DNAT_IPADDRS=No
|
||||
|
||||
|
@ -180,7 +181,7 @@ IGNOREUNKNOWNVARIABLES=No
|
|||
|
||||
IMPLICIT_CONTINUE=No
|
||||
|
||||
INLINE_MATCHES=No
|
||||
#INLINE_MATCHES=No
|
||||
|
||||
IPSET_WARNINGS=Yes
|
||||
|
||||
|
@ -188,7 +189,7 @@ IP_FORWARDING=On
|
|||
|
||||
KEEP_RT_TABLES=No
|
||||
|
||||
LOAD_HELPERS_ONLY=Yes
|
||||
#LOAD_HELPERS_ONLY=Yes
|
||||
|
||||
MACLIST_TABLE=filter
|
||||
|
||||
|
@ -196,13 +197,13 @@ MACLIST_TTL=
|
|||
|
||||
MANGLE_ENABLED=Yes
|
||||
|
||||
MAPOLDACTIONS=No
|
||||
#MAPOLDACTIONS=No
|
||||
|
||||
MARK_IN_FORWARD_CHAIN=No
|
||||
|
||||
MINIUPNPD=No
|
||||
|
||||
MODULE_SUFFIX=ko
|
||||
#MODULE_SUFFIX=ko
|
||||
|
||||
MULTICAST=No
|
||||
|
||||
|
@ -232,7 +233,7 @@ SAVE_ARPTABLES=No
|
|||
|
||||
SAVE_IPSETS=No
|
||||
|
||||
TC_ENABLED=Simple
|
||||
TC_ENABLED=No
|
||||
|
||||
TC_EXPERT=No
|
||||
|
||||
|
|
|
@ -15,7 +15,14 @@
|
|||
###########################################################################################################################################
|
||||
#ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY
|
||||
#
|
||||
MASQUERADE 10.255.0.0/16,\
|
||||
MASQUERADE 10.255.247.0/24,\
|
||||
10.255.248.0/24,\
|
||||
10.255.250.0/24,\
|
||||
10.255.251.0/24,\
|
||||
10.255.252.0/24,\
|
||||
10.255.253.0/24,\
|
||||
10.255.254.0/24,\
|
||||
10.255.255.0/24,\
|
||||
169.254.0.0/16,\
|
||||
172.16.0.0/12,\
|
||||
192.168.0.0/16 $NET_IFACE
|
||||
|
|
|
@ -23,4 +23,8 @@ ACCEPT dsvpn+ -
|
|||
ACCEPT - dsvpn+
|
||||
ACCEPT tun+ -
|
||||
ACCEPT - tun+
|
||||
ACCEPT wg+ -
|
||||
ACCEPT - wg+
|
||||
ACCEPT client-wg+ -
|
||||
ACCEPT - client-wg+
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#INTERFACE TYPE IN-BANDWIDTH OUT-BANDWIDTH
|
||||
$NET_IFACE External
|
||||
$VPS_IFACE Internal
|
||||
#$VPS_IFACE Internal
|
|
@ -16,4 +16,5 @@
|
|||
fw firewall
|
||||
net ipv4
|
||||
vpn ipv4
|
||||
vpncl ipv4
|
||||
|
||||
|
|
|
@ -15,5 +15,5 @@
|
|||
###############################################################################
|
||||
#ZONE INTERFACE OPTIONS
|
||||
net $NET_IFACE dhcp,tcpflags,rpfilter,forward=1,routeback
|
||||
vpn omr-6in4 tcpflags,forward=1,routeback
|
||||
vpn omr-6in4-user+ tcpflags,forward=1,routeback
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
OMR_ADDR=fe80::a00:2
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
vpn all ACCEPT
|
||||
fw all ACCEPT
|
||||
net all DROP info
|
||||
net all DROP
|
||||
# THE FOLLOWING POLICY MUST BE LAST
|
||||
all all REJECT info
|
||||
all all REJECT
|
||||
|
||||
|
|
|
@ -105,10 +105,11 @@ TC=
|
|||
###############################################################################
|
||||
|
||||
ACCEPT_DEFAULT=none
|
||||
DROP_DEFAULT=Drop
|
||||
BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL"
|
||||
DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
|
||||
NFQUEUE_DEFAULT=none
|
||||
QUEUE_DEFAULT=none
|
||||
REJECT_DEFAULT=Reject
|
||||
REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)"
|
||||
|
||||
###############################################################################
|
||||
# R S H / R C P C O M M A N D S
|
||||
|
@ -137,7 +138,7 @@ BASIC_FILTERS=No
|
|||
|
||||
BLACKLIST="NEW,INVALID,UNTRACKED"
|
||||
|
||||
CHAIN_SCRIPTS=Yes
|
||||
#CHAIN_SCRIPTS=Yes
|
||||
|
||||
CLAMPMSS=No
|
||||
|
||||
|
@ -167,7 +168,7 @@ IGNOREUNKNOWNVARIABLES=No
|
|||
|
||||
IMPLICIT_CONTINUE=No
|
||||
|
||||
INLINE_MATCHES=No
|
||||
#INLINE_MATCHES=No
|
||||
|
||||
IPSET_WARNINGS=Yes
|
||||
|
||||
|
@ -175,7 +176,7 @@ IP_FORWARDING=On
|
|||
|
||||
KEEP_RT_TABLES=Yes
|
||||
|
||||
LOAD_HELPERS_ONLY=Yes
|
||||
#LOAD_HELPERS_ONLY=Yes
|
||||
|
||||
MACLIST_TABLE=filter
|
||||
|
||||
|
|
|
@ -18,4 +18,4 @@
|
|||
MASQUERADE fe80::/10,\
|
||||
fd00::/8 $NET_IFACE
|
||||
# SNAT from VPN server for all VPN clients
|
||||
SNAT(fe80::a00:1) ::/0 omr-6in4
|
||||
#SNAT(fe80::a00:1) ::/0 omr-6in4-user+
|
||||
|
|
|
@ -13,6 +13,6 @@
|
|||
###############################################################################
|
||||
#ACTION SOURCE DEST PROTO DEST SOURCE
|
||||
# PORT(S) PORT(S)
|
||||
ACCEPT omr-6in4 -
|
||||
ACCEPT - omr-6in4
|
||||
#ACCEPT omr-6in4 -
|
||||
#ACCEPT - omr-6in4
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
PORT=65001
|
||||
HOST=0.0.0.0
|
||||
DEV=tun0
|
||||
SERVER=true
|
||||
MPTCP=true
|
||||
IPV6=true
|
||||
OPTIONS="chacha20 retry count -1 const 5000000 timeout 10000 keepalive count 5 idle 20 interval 2 buffer-size 32768 multiqueue"
|
||||
OPTIONS="chacha20 retry count -1 const 5000000 timeout 5000 keepalive count 5 idle 20 interval 2 buffer-size 65536 multiqueue"
|
|
@ -1,4 +1,6 @@
|
|||
BIND=0.0.0.0
|
||||
BIND_PORT=65001
|
||||
HOST=0.0.0.0
|
||||
PORT=5000
|
||||
DEV=tun0
|
||||
OPTIONS="chacha persist"
|
||||
|
|
17
ubond.network
Normal file
17
ubond.network
Normal file
|
@ -0,0 +1,17 @@
|
|||
[Match]
|
||||
Name=ubond*
|
||||
|
||||
[Network]
|
||||
Description=UBOND tunnel
|
||||
Address=10.255.248.1/24
|
||||
DHCPServer=yes
|
||||
IPMasquerade=yes
|
||||
|
||||
[DHCPServer]
|
||||
PoolOffset=2
|
||||
PoolSize=50
|
||||
EmitDNS=no
|
||||
EmitNTP=no
|
||||
DNS=9.9.9.9
|
||||
DefaultLeaseTimeSec=12h
|
||||
MaxLeaseTimeSec=24h
|
42
ubond0.conf
Normal file
42
ubond0.conf
Normal file
|
@ -0,0 +1,42 @@
|
|||
[general]
|
||||
tuntap = "tun"
|
||||
mode = "server"
|
||||
interface_name = "ubond0"
|
||||
timeout = 30
|
||||
password = "UBOND_PASS"
|
||||
reorder_buffer = yes
|
||||
reorder_buffer_size = 64
|
||||
loss_tolerence = 50
|
||||
|
||||
[wan1]
|
||||
bindport = 65251
|
||||
bindhost = "0.0.0.0"
|
||||
|
||||
[wan2]
|
||||
bindport = 65252
|
||||
bindhost = "0.0.0.0"
|
||||
|
||||
[wan3]
|
||||
bindport = 65253
|
||||
bindhost = "0.0.0.0"
|
||||
|
||||
[wan4]
|
||||
bindport = 65254
|
||||
bindhost = "0.0.0.0"
|
||||
|
||||
[wan5]
|
||||
bindport = 65255
|
||||
bindhost = "0.0.0.0"
|
||||
|
||||
[wan6]
|
||||
bindport = 65256
|
||||
bindhost = "0.0.0.0"
|
||||
|
||||
[wan7]
|
||||
bindport = 65257
|
||||
bindhost = "0.0.0.0"
|
||||
|
||||
[wan8]
|
||||
bindport = 65258
|
||||
bindhost = "0.0.0.0"
|
||||
|
16
ubond@.service.in
Normal file
16
ubond@.service.in
Normal file
|
@ -0,0 +1,16 @@
|
|||
[Unit]
|
||||
Description=UBOND connection to %i
|
||||
PartOf=ubond.service
|
||||
ReloadPropagatedFrom=ubond.service
|
||||
After=network.target network-online.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
NotifyAccess=main
|
||||
ExecStart=/usr/local/sbin/ubond --config /etc/ubond/%i.conf --name %i --user ubond --quiet
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
WorkingDirectory=/etc/ubond
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
1
ubuntu19.04-x86_64.sh
Symbolic link
1
ubuntu19.04-x86_64.sh
Symbolic link
|
@ -0,0 +1 @@
|
|||
debian9-x86_64.sh
|
1
ubuntu20.04-x86_64.sh
Symbolic link
1
ubuntu20.04-x86_64.sh
Symbolic link
|
@ -0,0 +1 @@
|
|||
debian9-x86_64.sh
|
220
v2ray-server.json
Normal file
220
v2ray-server.json
Normal file
|
@ -0,0 +1,220 @@
|
|||
{
|
||||
"log": {
|
||||
"loglevel": "error",
|
||||
"error": "/tmp/v2rayError.log"
|
||||
},
|
||||
"transport": {
|
||||
"tcpSettings": {},
|
||||
"wsSettings": {},
|
||||
"kcpSettings": {
|
||||
"mtu": 1460,
|
||||
"tti": 10,
|
||||
"uplinkCapacity": 100,
|
||||
"downlinkCapacity": 100,
|
||||
"congestion": false,
|
||||
"readBufferSize": 8,
|
||||
"writeBufferSize": 8
|
||||
}
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"tag": "omrin-tunnel",
|
||||
"port": 65228,
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"decryption": "none",
|
||||
"clients": [
|
||||
{
|
||||
"id": "V2RAY_UUID",
|
||||
"level": 0,
|
||||
"alterId": 0,
|
||||
"email": "openmptcprouter"
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"mptcp": true,
|
||||
"mark": 0
|
||||
},
|
||||
"network": "tcp",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/openvpn/ca/pki/issued/server.crt",
|
||||
"keyFile": "/etc/openvpn/ca/pki/private/server.key"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "omrin-vmess-tunnel",
|
||||
"port": 65230,
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"decryption": "none",
|
||||
"clients": [
|
||||
{
|
||||
"id": "V2RAY_UUID",
|
||||
"level": 0,
|
||||
"alterId": 0,
|
||||
"email": "openmptcprouter"
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"mptcp": true,
|
||||
"mark": 0
|
||||
},
|
||||
"network": "tcp",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/openvpn/ca/pki/issued/server.crt",
|
||||
"keyFile": "/etc/openvpn/ca/pki/private/server.key"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "omrin-socks-tunnel",
|
||||
"port": 65231,
|
||||
"protocol": "socks",
|
||||
"settings": {
|
||||
"auth": "password",
|
||||
"accounts": [
|
||||
{
|
||||
"pass": "V2RAY_UUID",
|
||||
"user": "openmptcprouter"
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"mptcp": true,
|
||||
"mark": 0
|
||||
},
|
||||
"network": "tcp",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/openvpn/ca/pki/issued/server.crt",
|
||||
"keyFile": "/etc/openvpn/ca/pki/private/server.key"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "omrin-trojan-tunnel",
|
||||
"port": 65229,
|
||||
"protocol": "trojan",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"password": "V2RAY_UUID",
|
||||
"email": "openmptcprouter",
|
||||
"level": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"mptcp": true,
|
||||
"mark": 0
|
||||
},
|
||||
"network": "tcp",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/openvpn/ca/pki/issued/server.crt",
|
||||
"keyFile": "/etc/openvpn/ca/pki/private/server.key"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"listen": "127.0.0.1",
|
||||
"port": 10085,
|
||||
"protocol": "dokodemo-door",
|
||||
"settings": {
|
||||
"address": "127.0.0.1"
|
||||
},
|
||||
"tag": "api"
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"settings": {
|
||||
"userLevel": 0
|
||||
},
|
||||
"tag": "direct"
|
||||
}
|
||||
],
|
||||
"routing": {
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"inboundTag": [
|
||||
"omrin-tunnel",
|
||||
"omrin-vmess-tunnel",
|
||||
"omrin-socks-tunnel",
|
||||
"omrin-trojan-tunnel"
|
||||
],
|
||||
"outboundTag": "OMRLan",
|
||||
"domain": [
|
||||
"full:omr.lan"
|
||||
]
|
||||
},
|
||||
{
|
||||
"inboundTag": [
|
||||
"api"
|
||||
],
|
||||
"outboundTag": "api",
|
||||
"type": "field"
|
||||
}
|
||||
]
|
||||
},
|
||||
"reverse": {
|
||||
"portals": [
|
||||
{
|
||||
"tag": "OMRLan",
|
||||
"domain": "omr.lan"
|
||||
}
|
||||
]
|
||||
},
|
||||
"stats": {},
|
||||
"api": {
|
||||
"tag": "api",
|
||||
"services": [
|
||||
"HandlerService",
|
||||
"LoggerService",
|
||||
"StatsService"
|
||||
]
|
||||
},
|
||||
"policy": {
|
||||
"levels": {
|
||||
"0": {
|
||||
"uplinkOnly": 0,
|
||||
"downlinkOnly": 0,
|
||||
"bufferSize": 512,
|
||||
"connIdle": 2400,
|
||||
"statsUserUplink": true,
|
||||
"statsUserDownlink": true
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
"statsInboundUplink": true,
|
||||
"statsInboundDownlink": true
|
||||
}
|
||||
}
|
||||
}
|
18
v2ray.service
Normal file
18
v2ray.service
Normal file
|
@ -0,0 +1,18 @@
|
|||
[Unit]
|
||||
Description=V2Ray Service
|
||||
Documentation=https://www.v2fly.org/
|
||||
After=network.target nss-lookup.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||
NoNewPrivileges=true
|
||||
ExecStart=/usr/bin/v2ray run -config /etc/v2ray/v2ray-server.json
|
||||
Restart=always
|
||||
RestartPreventExitStatus=23
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
232
xray-server.json
Normal file
232
xray-server.json
Normal file
|
@ -0,0 +1,232 @@
|
|||
{
|
||||
"log": {
|
||||
"loglevel": "error",
|
||||
"error": "/tmp/v2rayError.log"
|
||||
},
|
||||
"inbounds": [
|
||||
{
|
||||
"tag": "omrin-tunnel",
|
||||
"port": 65248,
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"decryption": "none",
|
||||
"clients": [
|
||||
{
|
||||
"id": "V2RAY_UUID",
|
||||
"level": 0,
|
||||
"alterId": 0,
|
||||
"email": "openmptcprouter"
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"tcpMptcp": true,
|
||||
"mark": 0
|
||||
},
|
||||
"network": "tcp",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/openvpn/ca/pki/issued/server.crt",
|
||||
"keyFile": "/etc/openvpn/ca/pki/private/server.key"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "omrin-vmess-tunnel",
|
||||
"port": 65250,
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"decryption": "none",
|
||||
"clients": [
|
||||
{
|
||||
"id": "V2RAY_UUID",
|
||||
"level": 0,
|
||||
"alterId": 0,
|
||||
"email": "openmptcprouter"
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"tcpMptcp": true,
|
||||
"mark": 0
|
||||
},
|
||||
"network": "tcp",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/openvpn/ca/pki/issued/server.crt",
|
||||
"keyFile": "/etc/openvpn/ca/pki/private/server.key"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "omrin-socks-tunnel",
|
||||
"port": 65251,
|
||||
"protocol": "socks",
|
||||
"settings": {
|
||||
"auth": "password",
|
||||
"accounts": [
|
||||
{
|
||||
"pass": "V2RAY_UUID",
|
||||
"user": "openmptcprouter"
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"tcpMptcp": true,
|
||||
"mark": 0
|
||||
},
|
||||
"network": "tcp",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/openvpn/ca/pki/issued/server.crt",
|
||||
"keyFile": "/etc/openvpn/ca/pki/private/server.key"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "omrin-trojan-tunnel",
|
||||
"port": 65249,
|
||||
"protocol": "trojan",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"password": "V2RAY_UUID",
|
||||
"email": "openmptcprouter",
|
||||
"level": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"tcpMptcp": true,
|
||||
"mark": 0
|
||||
},
|
||||
"network": "tcp",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/openvpn/ca/pki/issued/server.crt",
|
||||
"keyFile": "/etc/openvpn/ca/pki/private/server.key"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"tag": "omrin-shadowsocks-tunnel",
|
||||
"port": 65252,
|
||||
"protocol": "shadowsocks",
|
||||
"settings": {
|
||||
"password": "XRAY_PSK",
|
||||
"method": "2022-blake3-aes-256-gcm",
|
||||
"network": "tcp,udp",
|
||||
"clients": [
|
||||
{
|
||||
"password": "XRAY_UPSK",
|
||||
"email": "openmptcprouter"
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"tcpMptcp": true,
|
||||
"mark": 0
|
||||
},
|
||||
"network": "tcp"
|
||||
}
|
||||
},
|
||||
{
|
||||
"listen": "127.0.0.1",
|
||||
"port": 10086,
|
||||
"protocol": "dokodemo-door",
|
||||
"settings": {
|
||||
"address": "127.0.0.1"
|
||||
},
|
||||
"tag": "api"
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"settings": {
|
||||
"userLevel": 0
|
||||
},
|
||||
"tag": "direct"
|
||||
}
|
||||
],
|
||||
"routing": {
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"inboundTag": [
|
||||
"omrin-tunnel",
|
||||
"omrin-vless-reality",
|
||||
"omrin-vmess-tunnel",
|
||||
"omrin-socks-tunnel",
|
||||
"omrin-trojan-tunnel"
|
||||
],
|
||||
"outboundTag": "OMRLan",
|
||||
"domain": [
|
||||
"full:omr.lan"
|
||||
]
|
||||
},
|
||||
{
|
||||
"inboundTag": [
|
||||
"api"
|
||||
],
|
||||
"outboundTag": "api",
|
||||
"type": "field"
|
||||
}
|
||||
]
|
||||
},
|
||||
"reverse": {
|
||||
"portals": [
|
||||
{
|
||||
"tag": "OMRLan",
|
||||
"domain": "omr.lan"
|
||||
}
|
||||
]
|
||||
},
|
||||
"stats": {},
|
||||
"api": {
|
||||
"tag": "api",
|
||||
"listen": "127.0.0.1:65080",
|
||||
"services": [
|
||||
"HandlerService",
|
||||
"LoggerService",
|
||||
"StatsService"
|
||||
]
|
||||
},
|
||||
"policy": {
|
||||
"levels": {
|
||||
"0": {
|
||||
"uplinkOnly": 0,
|
||||
"downlinkOnly": 0,
|
||||
"bufferSize": 512,
|
||||
"connIdle": 2400,
|
||||
"statsUserUplink": true,
|
||||
"statsUserDownlink": true
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
"statsInboundUplink": true,
|
||||
"statsInboundDownlink": true
|
||||
}
|
||||
}
|
||||
}
|
47
xray-vless-reality.json
Normal file
47
xray-vless-reality.json
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"inbounds": [
|
||||
{
|
||||
"port": 443,
|
||||
"tag": "omrin-vless-reality",
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "XRAY_UUID",
|
||||
"flow": "xtls-rprx-vision"
|
||||
}
|
||||
],
|
||||
"decryption": "none"
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "tcp",
|
||||
"security": "reality",
|
||||
"realitySettings": {
|
||||
"dest": "1.1.1.1:443",
|
||||
"serverNames": [
|
||||
""
|
||||
],
|
||||
"privateKey": "XRAY_X25519_PRIVATE_KEY",
|
||||
"publicKey": "XRAY_X25519_PUBLIC_KEY",
|
||||
"shortIds": [
|
||||
""
|
||||
]
|
||||
},
|
||||
"sockopt": {
|
||||
"tcpMptcp": true,
|
||||
"mark": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"routing": {
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"inboundTag": [
|
||||
"omrin-vless-reality"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
18
xray.service
Normal file
18
xray.service
Normal file
|
@ -0,0 +1,18 @@
|
|||
[Unit]
|
||||
Description=XRay Service
|
||||
Documentation=https://xtls.github.io/
|
||||
After=network.target nss-lookup.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW
|
||||
NoNewPrivileges=true
|
||||
ExecStart=/usr/bin/xray run -config /etc/xray/xray-server.json
|
||||
Restart=always
|
||||
RestartPreventExitStatus=23
|
||||
StartLimitInterval=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Add table
Add a link
Reference in a new issue