├── debian ├── compat ├── postinst ├── changelog ├── rules └── control ├── debian.sh ├── debian-x86_64.sh ├── debian10-x86_64.sh ├── debian11-x86_64.sh ├── debian12-x86_64.sh ├── shorewall4 ├── params.net ├── params.vpn ├── tcinterfaces ├── params ├── zones ├── policy ├── conntrack ├── interfaces ├── snat ├── stoppedrules ├── rules └── shorewall.conf ├── shorewall6 ├── params.net ├── params.vpn ├── params ├── zones ├── stoppedrules ├── interfaces ├── policy ├── snat ├── conntrack ├── rules └── shorewall6.conf ├── ubuntu18.04-x86_64.sh ├── ubuntu19.04-x86_64.sh ├── ubuntu20.04-x86_64.sh ├── openmptcprouter-shorewall.tar.gz ├── openmptcprouter-shorewall6.tar.gz ├── tun0.glorytun-udp ├── dsvpn0-config ├── omr-bypass.timer.in ├── bin └── v2ray-plugin-linux-amd64-v1.2.0-2-g68e2207.tar.gz ├── iperf3.override.conf ├── tun0.glorytun ├── dsvpn-server@.service.in ├── iperf3.service.in ├── mlvpn.network ├── ubond.network ├── openvpn.network ├── omr-bypass.service.in ├── dsvpn-run ├── dsvpn-server.service.in ├── glorytun-udp.network ├── glorytun.network ├── omr.service.in ├── omr6in4@.service.in ├── glorytun-tcp@.service.in ├── omr-admin.service.in ├── glorytun-udp-run ├── omr-update.service.in ├── config.json ├── omr-admin-ipv6.service.in ├── glorytun-udp@.service.in ├── glorytun-tcp-run ├── openvpn-bonding1.conf ├── openvpn-bonding2.conf ├── openvpn-bonding3.conf ├── openvpn-bonding4.conf ├── openvpn-bonding5.conf ├── openvpn-bonding6.conf ├── openvpn-bonding7.conf ├── openvpn-bonding8.conf ├── fail2ban-filter-openvpn.conf ├── openvpn-tun1.conf ├── ubond@.service.in ├── omr-update ├── fail2ban-jail-openmptcprouter.conf ├── shadowsocks-libev-manager@.service.in ├── mlvpn@.service.in ├── manager.json ├── xray.service ├── v2ray.service ├── glorytun-tcp-post.sh ├── openvpn-tun0.conf ├── glorytun-udp-post.sh ├── omr-6in4-run ├── mlvpn0.conf ├── ubond0.conf ├── omr-6in4 ├── openvpn-tun1.6.1.conf ├── update-grub.sh ├── openvpn-tun0.6.1.conf ├── shadowsocks-go.server.json ├── old-v2ray.service ├── xray-vless-reality.json ├── README.md ├── debian9-x86_64-bin.sh ├── shadowsocks.conf ├── shadowsocks.6.1.conf ├── omr-pihole.sh ├── omr-test-speed ├── omr-test-speedv6 ├── omr-bypass ├── v2ray-server.json ├── xray-server.json ├── multipath ├── omr-service └── LICENSE /debian/compat: -------------------------------------------------------------------------------- 1 | 10 -------------------------------------------------------------------------------- /debian.sh: -------------------------------------------------------------------------------- 1 | debian9-x86_64.sh -------------------------------------------------------------------------------- /debian-x86_64.sh: -------------------------------------------------------------------------------- 1 | debian9-x86_64.sh -------------------------------------------------------------------------------- /debian10-x86_64.sh: -------------------------------------------------------------------------------- 1 | debian9-x86_64.sh -------------------------------------------------------------------------------- /debian11-x86_64.sh: -------------------------------------------------------------------------------- 1 | debian9-x86_64.sh -------------------------------------------------------------------------------- /debian12-x86_64.sh: -------------------------------------------------------------------------------- 1 | debian9-x86_64.sh -------------------------------------------------------------------------------- /shorewall4/params.net: -------------------------------------------------------------------------------- 1 | NET_IFACE=eth0 -------------------------------------------------------------------------------- /shorewall6/params.net: -------------------------------------------------------------------------------- 1 | NET_IFACE=eth0 -------------------------------------------------------------------------------- /ubuntu18.04-x86_64.sh: -------------------------------------------------------------------------------- 1 | debian9-x86_64.sh -------------------------------------------------------------------------------- /ubuntu19.04-x86_64.sh: -------------------------------------------------------------------------------- 1 | debian9-x86_64.sh -------------------------------------------------------------------------------- /ubuntu20.04-x86_64.sh: -------------------------------------------------------------------------------- 1 | debian9-x86_64.sh -------------------------------------------------------------------------------- /shorewall6/params.vpn: -------------------------------------------------------------------------------- 1 | OMR_ADDR=fe80::a00:2 2 | -------------------------------------------------------------------------------- /shorewall4/params.vpn: -------------------------------------------------------------------------------- 1 | VPS_ADDR=10.255.252.1 2 | OMR_ADDR=10.255.252.2 3 | VPS_IFACE=tun0 4 | -------------------------------------------------------------------------------- /openmptcprouter-shorewall.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ysurac/openmptcprouter-vps/HEAD/openmptcprouter-shorewall.tar.gz -------------------------------------------------------------------------------- /openmptcprouter-shorewall6.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ysurac/openmptcprouter-vps/HEAD/openmptcprouter-shorewall6.tar.gz -------------------------------------------------------------------------------- /tun0.glorytun-udp: -------------------------------------------------------------------------------- 1 | BIND=0.0.0.0 2 | BIND_PORT=65001 3 | HOST=0.0.0.0 4 | PORT=5000 5 | DEV=tun0 6 | OPTIONS="chacha persist" 7 | -------------------------------------------------------------------------------- /dsvpn0-config: -------------------------------------------------------------------------------- 1 | PORT=65401 2 | HOST=0.0.0.0 3 | DEV=dsvpn0 4 | MODE=server 5 | LOCALTUNIP=10.255.251.1 6 | REMOTETUNIP=10.255.251.2 7 | -------------------------------------------------------------------------------- /shorewall4/tcinterfaces: -------------------------------------------------------------------------------- 1 | #INTERFACE TYPE IN-BANDWIDTH OUT-BANDWIDTH 2 | $NET_IFACE External 3 | #$VPS_IFACE Internal -------------------------------------------------------------------------------- /omr-bypass.timer.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Timer for omr-bypass 3 | 4 | [Timer] 5 | OnUnitActiveSec=300 6 | 7 | [Install] 8 | WantedBy=timers.target 9 | -------------------------------------------------------------------------------- /bin/v2ray-plugin-linux-amd64-v1.2.0-2-g68e2207.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ysurac/openmptcprouter-vps/HEAD/bin/v2ray-plugin-linux-amd64-v1.2.0-2-g68e2207.tar.gz -------------------------------------------------------------------------------- /iperf3.override.conf: -------------------------------------------------------------------------------- 1 | [Service] 2 | ExecStart= 3 | ExecStart=/usr/bin/iperf3 -s -p 65400 --authorized-users-path /etc/iperf3/users.csv --rsa-private-key-path /etc/iperf3/private.pem -------------------------------------------------------------------------------- /tun0.glorytun: -------------------------------------------------------------------------------- 1 | PORT=65001 2 | HOST=0.0.0.0 3 | DEV=tun0 4 | SERVER=true 5 | MPTCP=true 6 | IPV6=true 7 | OPTIONS="chacha20 retry count -1 const 5000000 timeout 5000 keepalive count 5 idle 20 interval 2 buffer-size 65536 multiqueue" -------------------------------------------------------------------------------- /dsvpn-server@.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Dead Simple VPN - Server on %I 3 | After=network.target network-online.target 4 | 5 | [Service] 6 | ExecStart=/usr/local/bin/dsvpn-run /etc/dsvpn/%i 7 | Restart=always 8 | RestartSec=15 9 | 10 | [Install] 11 | WantedBy=network.target -------------------------------------------------------------------------------- /iperf3.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=iperf3 3 | Requires=network.target 4 | 5 | [Service] 6 | ExecStart=/usr/bin/iperf3 -s -p 65400 --authorized-users-path /etc/iperf3/users.csv --rsa-private-key-path /etc/iperf3/private.pem 7 | Restart=on-failure 8 | 9 | [Install] 10 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /mlvpn.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=mlvpn* 3 | 4 | [Network] 5 | Description=MLVPN tunnel 6 | Address=10.255.253.1/24 7 | DHCPServer=yes 8 | IPMasquerade=yes 9 | 10 | [DHCPServer] 11 | PoolOffset=2 12 | PoolSize=50 13 | EmitDNS=no 14 | EmitNTP=no 15 | DNS=9.9.9.9 16 | DefaultLeaseTimeSec=12h 17 | MaxLeaseTimeSec=24h -------------------------------------------------------------------------------- /ubond.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=ubond* 3 | 4 | [Network] 5 | Description=UBOND tunnel 6 | Address=10.255.248.1/24 7 | DHCPServer=yes 8 | IPMasquerade=yes 9 | 10 | [DHCPServer] 11 | PoolOffset=2 12 | PoolSize=50 13 | EmitDNS=no 14 | EmitNTP=no 15 | DNS=9.9.9.9 16 | DefaultLeaseTimeSec=12h 17 | MaxLeaseTimeSec=24h -------------------------------------------------------------------------------- /openvpn.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=tun0 3 | 4 | [Network] 5 | Description=OpenVPN tunnel 6 | Address=10.255.252.1/24 7 | DHCPServer=yes 8 | IPMasquerade=yes 9 | 10 | [DHCPServer] 11 | PoolOffset=2 12 | PoolSize=50 13 | EmitDNS=no 14 | EmitNTP=no 15 | DNS=9.9.9.9 16 | DefaultLeaseTimeSec=12h 17 | MaxLeaseTimeSec=24h -------------------------------------------------------------------------------- /omr-bypass.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OMR-ByPass 3 | After=network.target network-online.target shorewall.service 4 | 5 | [Service] 6 | Type=simple 7 | ExecStart=/usr/local/bin/omr-bypass 8 | KillSignal=9 9 | CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /dsvpn-run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ ! -f "$1" ]; then 6 | echo "usage: $(basename "$0") FILE" 7 | exit 1 8 | fi 9 | 10 | . "$(readlink -f "$1")" 11 | 12 | exec dsvpn \ 13 | ${MODE} \ 14 | "$1".key \ 15 | ${HOST:-auto} \ 16 | ${PORT} \ 17 | ${DEV} \ 18 | ${LOCALTUNIP} \ 19 | ${REMOTETUNIP} 20 | -------------------------------------------------------------------------------- /dsvpn-server.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Dead Simple VPN - Server 3 | After=network.target network-online.target 4 | 5 | [Service] 6 | ExecStart=/usr/local/sbin/dsvpn server /etc/dsvpn/dsvpn.key auto 65011 dsvpn0 10.255.251.1 10.255.251.2 7 | Restart=always 8 | RestartSec=15 9 | 10 | [Install] 11 | WantedBy=network.target -------------------------------------------------------------------------------- /glorytun-udp.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=gt-udp-tun* 3 | 4 | [Network] 5 | Description=Glorytun server device 6 | Address=10.255.254.1/24 7 | DHCPServer=yes 8 | IPMasquerade=yes 9 | 10 | [DHCPServer] 11 | PoolOffset=2 12 | PoolSize=50 13 | EmitDNS=no 14 | EmitNTP=no 15 | DNS=9.9.9.9 16 | DefaultLeaseTimeSec=2h 17 | MaxLeaseTimeSec=4h -------------------------------------------------------------------------------- /glorytun.network: -------------------------------------------------------------------------------- 1 | [Match] 2 | Name=gt-tun* 3 | 4 | [Link] 5 | MTUBytes=1500 6 | 7 | [Network] 8 | Description=Glorytun server device 9 | Address=10.255.255.1/24 10 | DHCPServer=yes 11 | IPMasquerade=yes 12 | 13 | [DHCPServer] 14 | PoolOffset=1 15 | PoolSize=50 16 | EmitDNS=no 17 | EmitNTP=no 18 | DNS=9.9.9.9 19 | DefaultLeaseTimeSec=2h 20 | MaxLeaseTimeSec=4h -------------------------------------------------------------------------------- /omr.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OMR 3 | After=network.target network-online.target glorytun-tcp@.service glorytun-udp@.service shorewall.service 4 | 5 | [Service] 6 | Type=simple 7 | Restart=always 8 | ExecStart=/usr/local/bin/omr-service 9 | KillSignal=9 10 | CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /omr6in4@.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OMR6IN4 on %I 3 | After=network.target network-online.target 4 | 5 | [Service] 6 | Type=oneshot 7 | ExecStart=/usr/local/bin/omr-6in4-run start /etc/openmptcprouter-vps-admin/omr-6in4/%i 8 | RemainAfterExit=true 9 | ExecStop=/usr/local/bin/omr-6in4-run stop /etc/openmptcprouter-vps-admin/omr-6in4/%i 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /debian/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | test $DEBIAN_SCRIPT_DEBUG && set -v -x 4 | 5 | # use debconf 6 | . /usr/share/debconf/confmodule 7 | 8 | sed -i -e "s/^LOCALFILES=.*$/LOCALFILES=no/" -e "s/^SOURCES=.*$/SOURCES=no/" /usr/share/omr-server/debian9-x86_64.sh 9 | systemctl daemon-reload 10 | systemctl restart omr-update 11 | 12 | db_stop 13 | 14 | #DEBHELPER# 15 | exit 0 16 | # vim:set ai et sts=2 sw=2 tw=0: -------------------------------------------------------------------------------- /glorytun-tcp@.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Glorytun TCP on %I 3 | After=network.target network-online.target 4 | 5 | [Service] 6 | Type=simple 7 | Restart=always 8 | ExecStart=/usr/local/bin/glorytun-tcp-run /etc/glorytun-tcp/%i 9 | ExecStartPost=-/etc/glorytun-tcp/post.sh /etc/glorytun-tcp/%i 10 | CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_RAW 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | -------------------------------------------------------------------------------- /omr-admin.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OMR-Admin 3 | After=network.target network-online.target 4 | 5 | [Service] 6 | Type=simple 7 | Restart=always 8 | ExecStart=/usr/local/bin/omr-admin.py 9 | 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 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /glorytun-udp-run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ ! -f "$1" ]; then 6 | echo "usage: $(basename "$0") FILE" 7 | exit 1 8 | fi 9 | 10 | . "$(readlink -f "$1")" 11 | 12 | DEV="gt-udp-$(basename "$1")" 13 | 14 | exec glorytun \ 15 | bind to addr ${HOST:-::} port ${PORT:-5000} from addr $BIND port $BIND_PORT \ 16 | keyfile "$1".key \ 17 | ${DEV:+dev "$DEV"} \ 18 | ${OPTIONS:+$OPTIONS} 19 | -------------------------------------------------------------------------------- /omr-update.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OMR Update 3 | After=network.target network-online.target 4 | 5 | [Service] 6 | Type=simple 7 | Restart=no 8 | ExecStart=/usr/bin/omr-update 9 | #ExecStart=/usr/share/omr-server/debian9-x86_64.sh 10 | AmbientCapabilities= 11 | StandardOutput=file:/var/log/omr-update.log 12 | StandardError=file:/var/log/omr-update.log 13 | 14 | [Install] 15 | WantedBy=multi-user.target 16 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "server":["[::0]", "0.0.0.0"], 3 | "server_port":65101, 4 | "local_port":1081, 5 | "mode":"tcp_and_udp", 6 | "key":"MySecretKey", 7 | "timeout":600, 8 | "method":"chacha20-ietf-poly1305", 9 | "verbose":0, 10 | "prefer_ipv6": false, 11 | "fast_open": true, 12 | "no_delay": true, 13 | "reuse_port": true, 14 | "ipv6_first": true, 15 | "mptcp": true 16 | } -------------------------------------------------------------------------------- /omr-admin-ipv6.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=OMR-Admin IPv6 3 | After=network.target network-online.target 4 | 5 | [Service] 6 | Type=simple 7 | Restart=always 8 | ExecStart=/usr/local/bin/omr-admin.py --host="::" 9 | 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 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /glorytun-udp@.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Glorytun UDP on %I 3 | After=network.target network-online.target 4 | 5 | [Service] 6 | Type=simple 7 | Restart=always 8 | EnvironmentFile=/etc/glorytun-udp/%i 9 | ExecStart=/usr/local/bin/glorytun-udp-run /etc/glorytun-udp/%i 10 | ExecStartPost=-/etc/glorytun-udp/post.sh /etc/glorytun-udp/%i 11 | CapabilityBoundingSet=CAP_NET_ADMIN 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | -------------------------------------------------------------------------------- /glorytun-tcp-run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ ! -f "$1" ]; then 6 | echo "usage: $(basename "$0") FILE" 7 | exit 1 8 | fi 9 | 10 | . "$(readlink -f "$1")" 11 | 12 | DEV="gt-$(basename "$1")" 13 | 14 | exec glorytun-tcp \ 15 | ${SERVER:+listener} \ 16 | keyfile "$1".key \ 17 | ${DEV:+dev "$DEV"} \ 18 | ${HOST:+host "$HOST"} \ 19 | ${PORT:+port "$PORT"} \ 20 | ${MPTCP:+mptcp} \ 21 | ${OPTIONS:+$OPTIONS} 22 | -------------------------------------------------------------------------------- /openvpn-bonding1.conf: -------------------------------------------------------------------------------- 1 | dev ovpnbonding1 2 | dev-type tap 3 | cipher AES-256-CBC 4 | proto udp 5 | proto udp6 6 | port 65351 7 | persist-tun 8 | persist-key 9 | reneg-sec 0 10 | verb 3 11 | ca /etc/openvpn/ca/pki/ca.crt 12 | cert /etc/openvpn/ca/pki/issued/server.crt 13 | key /etc/openvpn/ca/pki/private/server.key 14 | dh /etc/openvpn/server/dh2048.pem 15 | crl-verify /etc/openvpn/ca/pki/crl.pem 16 | keepalive 100 2400 17 | mode server 18 | tls-server 19 | -------------------------------------------------------------------------------- /openvpn-bonding2.conf: -------------------------------------------------------------------------------- 1 | dev ovpnbonding2 2 | dev-type tap 3 | cipher AES-256-CBC 4 | proto udp 5 | proto udp6 6 | port 65352 7 | persist-tun 8 | persist-key 9 | reneg-sec 0 10 | verb 3 11 | ca /etc/openvpn/ca/pki/ca.crt 12 | cert /etc/openvpn/ca/pki/issued/server.crt 13 | key /etc/openvpn/ca/pki/private/server.key 14 | dh /etc/openvpn/server/dh2048.pem 15 | crl-verify /etc/openvpn/ca/pki/crl.pem 16 | keepalive 100 2400 17 | mode server 18 | tls-server 19 | -------------------------------------------------------------------------------- /openvpn-bonding3.conf: -------------------------------------------------------------------------------- 1 | dev ovpnbonding3 2 | dev-type tap 3 | cipher AES-256-CBC 4 | proto udp 5 | proto udp6 6 | port 65353 7 | persist-tun 8 | persist-key 9 | reneg-sec 0 10 | verb 3 11 | ca /etc/openvpn/ca/pki/ca.crt 12 | cert /etc/openvpn/ca/pki/issued/server.crt 13 | key /etc/openvpn/ca/pki/private/server.key 14 | dh /etc/openvpn/server/dh2048.pem 15 | crl-verify /etc/openvpn/ca/pki/crl.pem 16 | keepalive 100 2400 17 | mode server 18 | tls-server 19 | -------------------------------------------------------------------------------- /openvpn-bonding4.conf: -------------------------------------------------------------------------------- 1 | dev ovpnbonding4 2 | dev-type tap 3 | cipher AES-256-CBC 4 | proto udp 5 | proto udp6 6 | port 65354 7 | persist-tun 8 | persist-key 9 | reneg-sec 0 10 | verb 3 11 | ca /etc/openvpn/ca/pki/ca.crt 12 | cert /etc/openvpn/ca/pki/issued/server.crt 13 | key /etc/openvpn/ca/pki/private/server.key 14 | dh /etc/openvpn/server/dh2048.pem 15 | crl-verify /etc/openvpn/ca/pki/crl.pem 16 | keepalive 100 2400 17 | mode server 18 | tls-server 19 | -------------------------------------------------------------------------------- /openvpn-bonding5.conf: -------------------------------------------------------------------------------- 1 | dev ovpnbonding5 2 | dev-type tap 3 | cipher AES-256-CBC 4 | proto udp 5 | proto udp6 6 | port 65355 7 | persist-tun 8 | persist-key 9 | reneg-sec 0 10 | verb 3 11 | ca /etc/openvpn/ca/pki/ca.crt 12 | cert /etc/openvpn/ca/pki/issued/server.crt 13 | key /etc/openvpn/ca/pki/private/server.key 14 | dh /etc/openvpn/server/dh2048.pem 15 | crl-verify /etc/openvpn/ca/pki/crl.pem 16 | keepalive 100 2400 17 | mode server 18 | tls-server 19 | -------------------------------------------------------------------------------- /openvpn-bonding6.conf: -------------------------------------------------------------------------------- 1 | dev ovpnbonding6 2 | dev-type tap 3 | cipher AES-256-CBC 4 | proto udp 5 | proto udp6 6 | port 65356 7 | persist-tun 8 | persist-key 9 | reneg-sec 0 10 | verb 3 11 | ca /etc/openvpn/ca/pki/ca.crt 12 | cert /etc/openvpn/ca/pki/issued/server.crt 13 | key /etc/openvpn/ca/pki/private/server.key 14 | dh /etc/openvpn/server/dh2048.pem 15 | crl-verify /etc/openvpn/ca/pki/crl.pem 16 | keepalive 100 2400 17 | mode server 18 | tls-server 19 | -------------------------------------------------------------------------------- /openvpn-bonding7.conf: -------------------------------------------------------------------------------- 1 | dev ovpnbonding7 2 | dev-type tap 3 | cipher AES-256-CBC 4 | proto udp 5 | proto udp6 6 | port 65357 7 | persist-tun 8 | persist-key 9 | reneg-sec 0 10 | verb 3 11 | ca /etc/openvpn/ca/pki/ca.crt 12 | cert /etc/openvpn/ca/pki/issued/server.crt 13 | key /etc/openvpn/ca/pki/private/server.key 14 | dh /etc/openvpn/server/dh2048.pem 15 | crl-verify /etc/openvpn/ca/pki/crl.pem 16 | keepalive 100 2400 17 | mode server 18 | tls-server 19 | -------------------------------------------------------------------------------- /openvpn-bonding8.conf: -------------------------------------------------------------------------------- 1 | dev ovpnbonding8 2 | dev-type tap 3 | cipher AES-256-CBC 4 | proto udp 5 | proto udp6 6 | port 65358 7 | persist-tun 8 | persist-key 9 | reneg-sec 0 10 | verb 3 11 | ca /etc/openvpn/ca/pki/ca.crt 12 | cert /etc/openvpn/ca/pki/issued/server.crt 13 | key /etc/openvpn/ca/pki/private/server.key 14 | dh /etc/openvpn/server/dh2048.pem 15 | crl-verify /etc/openvpn/ca/pki/crl.pem 16 | keepalive 100 2400 17 | mode server 18 | tls-server 19 | -------------------------------------------------------------------------------- /fail2ban-filter-openvpn.conf: -------------------------------------------------------------------------------- 1 | [INCLUDES] 2 | before = common.conf 3 | 4 | [Definition] 5 | _daemon = ovpn-server 6 | failregex =%(__prefix_line)s:[0-9]{4,5} TLS Auth Error:.* 7 | %(__prefix_line)s:[0-9]{4,5} VERIFY ERROR:.* 8 | %(__prefix_line)s:[0-9]{4,5} TLS Error: TLS handshake failed.* 9 | %(__prefix_line)sTLS Error: cannot locate HMAC in incoming packet from \[AF_INET\]:[0-9]{4,5} 10 | maxlines = 1 11 | -------------------------------------------------------------------------------- /openvpn-tun1.conf: -------------------------------------------------------------------------------- 1 | dev tun1 2 | cipher AES-256-CBC 3 | proto udp 4 | port 65301 5 | persist-tun 6 | persist-key 7 | reneg-sec 0 8 | duplicate-cn 9 | #ncp-disable 10 | #mssfix 1300 11 | verb 3 12 | server 10.255.250.0 255.255.255.0 13 | ca /etc/openvpn/ca/pki/ca.crt 14 | cert /etc/openvpn/ca/pki/issued/server.crt 15 | key /etc/openvpn/ca/pki/private/server.key 16 | dh /etc/openvpn/server/dh2048.pem 17 | crl-verify /etc/openvpn/ca/pki/crl.pem 18 | keepalive 10 240 19 | -------------------------------------------------------------------------------- /ubond@.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=UBOND connection to %i 3 | PartOf=ubond.service 4 | ReloadPropagatedFrom=ubond.service 5 | After=network.target network-online.target 6 | 7 | [Service] 8 | Type=notify 9 | NotifyAccess=main 10 | ExecStart=/usr/local/sbin/ubond --config /etc/ubond/%i.conf --name %i --user ubond --quiet 11 | ExecReload=/bin/kill -HUP $MAINPID 12 | WorkingDirectory=/etc/ubond 13 | Restart=always 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /omr-update: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ -f /etc/openmptcprouter-vps-admin/update ]; then 3 | wget -O - http://www.openmptcprouter.com/server/debian.sh | sh 4 | rm -f /etc/openmptcprouter-vps-admin/update 5 | reboot 6 | fi 7 | if [ -f /etc/openmptcprouter-vps-admin/update-bin ]; then 8 | LOCALFILES=yes SOURCES=yes REINSTALL=no /usr/share/omr-server/debian9-x86_64.sh 9 | rm -f /etc/openmptcprouter-vps-admin/update-bin 10 | #reboot 11 | fi 12 | -------------------------------------------------------------------------------- /fail2ban-jail-openmptcprouter.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | backend = systemd 3 | banaction = shorewall 4 | 5 | [sshd] 6 | enabled = true 7 | 8 | [openvpn_tcp] 9 | enabled = true 10 | port = 65301 11 | protocol = tcp 12 | filter = openvpn 13 | maxretry = 10 14 | journalmatch = _SYSTEMD_UNIT=openvpn@tun0.service 15 | 16 | [openvpn_udp] 17 | enabled = true 18 | port = 65301 19 | protocol = udp 20 | filter = openvpn 21 | maxretry = 10 22 | journalmatch = _SYSTEMD_UNIT=openvpn@tun1.service 23 | -------------------------------------------------------------------------------- /shadowsocks-libev-manager@.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Shadowsocks-Libev Custom Manager Service for %I 3 | After=network-online.target 4 | 5 | [Service] 6 | Type=simple 7 | CapabilityBoundingSet=CAP_NET_BIND_SERVICE 8 | AmbientCapabilities=CAP_NET_BIND_SERVICE 9 | LimitNOFILE=99999 10 | LimitNPROC=99999 11 | ExecStart=/usr/bin/ss-manager -c /etc/shadowsocks-libev/%i.json --manager-address 127.0.0.1:8839 12 | Restart=always 13 | 14 | [Install] 15 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /mlvpn@.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=MLVPN connection to %i 3 | PartOf=mlvpn.service 4 | ReloadPropagatedFrom=mlvpn.service 5 | After=network.target network-online.target 6 | 7 | [Service] 8 | Type=notify 9 | NotifyAccess=main 10 | ExecStart=/usr/local/sbin/mlvpn --config /etc/mlvpn/%i.conf --name %i --user mlvpn --quiet 11 | ExecReload=/bin/kill -HUP $MAINPID 12 | WorkingDirectory=/etc/mlvpn 13 | Restart=always 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | 18 | 19 | -------------------------------------------------------------------------------- /manager.json: -------------------------------------------------------------------------------- 1 | { 2 | "mptcp": true, 3 | "ipv6_first": true, 4 | "no_delay": true, 5 | "ebpf": false, 6 | "server": [ 7 | "[::0]", 8 | "0.0.0.0" 9 | ], 10 | "method": "chacha20-ietf-poly1305", 11 | "fast_open": true, 12 | "timeout": 1000, 13 | "port_key": { 14 | "65101": "MySecretKey", 15 | }, 16 | "local_port": 1081, 17 | "verbose": 0, 18 | "acl": "/etc/shadowsocks-libev/local.acl", 19 | "mode": "tcp_and_udp", 20 | "reuse_port": true, 21 | "prefer_ipv6": false 22 | } -------------------------------------------------------------------------------- /xray.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=XRay Service 3 | Documentation=https://xtls.github.io/ 4 | After=network.target nss-lookup.target 5 | Wants=network-online.target 6 | 7 | [Service] 8 | User=root 9 | CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW 10 | AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW 11 | NoNewPrivileges=true 12 | ExecStart=/usr/bin/xray run -config /etc/xray/xray-server.json 13 | Restart=always 14 | RestartPreventExitStatus=23 15 | StartLimitInterval=0 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | -------------------------------------------------------------------------------- /v2ray.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=V2Ray Service 3 | Documentation=https://www.v2fly.org/ 4 | After=network.target nss-lookup.target 5 | Wants=network-online.target 6 | 7 | [Service] 8 | User=root 9 | CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW 10 | AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW 11 | NoNewPrivileges=true 12 | ExecStart=/usr/bin/v2ray run -config /etc/v2ray/v2ray-server.json 13 | Restart=always 14 | RestartPreventExitStatus=23 15 | StartLimitInterval=0 16 | 17 | [Install] 18 | WantedBy=multi-user.target 19 | -------------------------------------------------------------------------------- /glorytun-tcp-post.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ ! -f $(readlink -f "$1") ] && exit 1 3 | . "$(readlink -f "$1")" 4 | 5 | INTF=gt-${DEV} 6 | [ -z "$LOCALIP" ] && LOCALIP="10.255.255.1" 7 | [ -z "$BROADCASTIP" ] && BROADCASTIP="10.255.255.3" 8 | while [ -z "$(ip link show $INTF 2>/dev/null)" ]; do 9 | sleep 2 10 | done 11 | [ "$(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" ] && { 12 | ip link set dev ${INTF} up 2>&1 >/dev/null 13 | ip addr add ${LOCALIP}/30 brd ${BROADCASTIP} dev ${INTF} 2>&1 >/dev/null 14 | } 15 | -------------------------------------------------------------------------------- /openvpn-tun0.conf: -------------------------------------------------------------------------------- 1 | dev tun0 2 | user nobody 3 | group nogroup 4 | cipher AES-256-CBC 5 | proto tcp 6 | port 65301 7 | persist-tun 8 | persist-key 9 | reneg-sec 0 10 | duplicate-cn 11 | verb 3 12 | server 10.255.252.0 255.255.255.0 13 | ca /etc/openvpn/ca/pki/ca.crt 14 | cert /etc/openvpn/ca/pki/issued/server.crt 15 | key /etc/openvpn/ca/pki/private/server.key 16 | dh /etc/openvpn/server/dh2048.pem 17 | crl-verify /etc/openvpn/ca/pki/crl.pem 18 | keepalive 10 240 19 | sndbuf 0 20 | rcvbuf 0 21 | txqueuelen 2000 22 | tun-mtu 1400 23 | mssfix 1360 24 | tls-server 25 | tls-version-min 1.2 26 | #compress lzo 27 | #push "route 10.255.252.1 255.255.255.255" 28 | client-config-dir ccd 29 | management localhost 65302 30 | -------------------------------------------------------------------------------- /glorytun-udp-post.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | [ ! -f $(readlink -f "$1") ] && exit 1 3 | . "$(readlink -f "$1")" 4 | 5 | INTF=gt-udp-${DEV} 6 | [ -z "$LOCALIP" ] && LOCALIP="10.255.254.1" 7 | [ -z "$BROADCASTIP" ] && BROADCASTIP="10.255.254.3" 8 | while [ -z "$(ip link show $INTF 2>/dev/null)" ]; do 9 | sleep 2 10 | done 11 | [ "$(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" ] && { 12 | ip link set dev ${INTF} up 2>&1 >/dev/null 13 | ip addr add ${LOCALIP}/30 brd ${BROADCASTIP} dev ${INTF} 2>&1 >/dev/null 14 | } 15 | tc qdisc replace dev $INTF root cake 16 | ip link set $INTF txqlen 100 17 | glorytun set dev gt-udp-tun0 kxtimeout 7d 2>&1 >/dev/null -------------------------------------------------------------------------------- /omr-6in4-run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ ! -f "$2" ]; then 6 | echo "usage: $(basename "$0") start FILE" 7 | exit 1 8 | fi 9 | 10 | . "$(readlink -f "$2")" 11 | 12 | DEV="omr-6in4-$(basename "$2")" 13 | 14 | if [ "$1" = "start" ]; then 15 | [ -n "$(ip tunnel show ${DEV})" ] && ip tunnel del ${DEV} 2>&1 >/dev/null 16 | ip tunnel add ${DEV} mode sit remote ${REMOTEIP} local ${LOCALIP} 17 | ip -6 addr add ${LOCALIP6} dev ${DEV} 18 | ip link set ${DEV} up 19 | [ -n "$ULA" ] && [ "$ULA" != "auto" ] && ip route replace ${ULA} via $(echo ${REMOTEIP6} | cut -d/ -f1) dev ${DEV} 20 | fi 21 | if [ "$1" = "stop" ]; then 22 | ip tunnel del ${DEV} 23 | fi 24 | -------------------------------------------------------------------------------- /shorewall6/params: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall6 -- /etc/shorewall6/params 3 | # 4 | # Assign any variables that you need here. 5 | # 6 | # It is suggested that variable names begin with an upper case letter 7 | # to distinguish them from variables used internally within the 8 | # Shorewall6 programs 9 | # 10 | # Example: 11 | # 12 | # NET_IF=eth0 13 | # NET_OPTIONS=dhcp,nosmurfs 14 | # 15 | # Example (/etc/shorewall6/interfaces record): 16 | # 17 | # net $NET_IF - $NET_OPTIONS 18 | # 19 | # The result will be the same as if the record had been written 20 | # 21 | # net eth0 - dhcp,nosmurfs 22 | # 23 | ############################################################################### 24 | INCLUDE params.net 25 | INCLUDE params.vpn 26 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | omr-server (0.1030) unstable; urgency=medium 2 | 3 | * Many changes 4 | 5 | -- OpenMPTCProuter Wed, 10 Apr 2024 19:35:34 +0200 6 | 7 | omr-server (0.1028) unstable; urgency=medium 8 | 9 | * Many changes 10 | 11 | -- OpenMPTCProuter Fri, 14 Oct 2022 09:02:22 +0200 12 | 13 | omr-server (0.1026) unstable; urgency=medium 14 | 15 | * Many changes 16 | 17 | -- OpenMPTCProuter Mon, 14 Jun 2021 07:43:42 +0200 18 | 19 | omr-server (0.1025-test) unstable; urgency=medium 20 | 21 | * Wireguard support and fixed 22 | 23 | -- OpenMPTCProuter Thu, 04 Mar 2021 14:36:12 +0200 24 | -------------------------------------------------------------------------------- /mlvpn0.conf: -------------------------------------------------------------------------------- 1 | [general] 2 | tuntap = "tun" 3 | mode = "server" 4 | interface_name = "mlvpn0" 5 | timeout = 30 6 | password = "MLVPN_PASS" 7 | reorder_buffer = yes 8 | reorder_buffer_size = 128 9 | loss_tolerence = 50 10 | 11 | [wan1] 12 | bindport = 65201 13 | bindhost = "0.0.0.0" 14 | 15 | [wan2] 16 | bindport = 65202 17 | bindhost = "0.0.0.0" 18 | 19 | [wan3] 20 | bindport = 65203 21 | bindhost = "0.0.0.0" 22 | 23 | [wan4] 24 | bindport = 65204 25 | bindhost = "0.0.0.0" 26 | 27 | [wan5] 28 | bindport = 65205 29 | bindhost = "0.0.0.0" 30 | 31 | [wan6] 32 | bindport = 65206 33 | bindhost = "0.0.0.0" 34 | 35 | [wan7] 36 | bindport = 65207 37 | bindhost = "0.0.0.0" 38 | 39 | [wan8] 40 | bindport = 65208 41 | bindhost = "0.0.0.0" 42 | 43 | -------------------------------------------------------------------------------- /ubond0.conf: -------------------------------------------------------------------------------- 1 | [general] 2 | tuntap = "tun" 3 | mode = "server" 4 | interface_name = "ubond0" 5 | timeout = 30 6 | password = "UBOND_PASS" 7 | reorder_buffer = yes 8 | reorder_buffer_size = 64 9 | loss_tolerence = 50 10 | 11 | [wan1] 12 | bindport = 65251 13 | bindhost = "0.0.0.0" 14 | 15 | [wan2] 16 | bindport = 65252 17 | bindhost = "0.0.0.0" 18 | 19 | [wan3] 20 | bindport = 65253 21 | bindhost = "0.0.0.0" 22 | 23 | [wan4] 24 | bindport = 65254 25 | bindhost = "0.0.0.0" 26 | 27 | [wan5] 28 | bindport = 65255 29 | bindhost = "0.0.0.0" 30 | 31 | [wan6] 32 | bindport = 65256 33 | bindhost = "0.0.0.0" 34 | 35 | [wan7] 36 | bindport = 65257 37 | bindhost = "0.0.0.0" 38 | 39 | [wan8] 40 | bindport = 65258 41 | bindhost = "0.0.0.0" 42 | 43 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | #export DH_VERBOSE = 1 3 | 4 | # Security Hardening 5 | export DEB_BUILD_MAINT_OPTIONS = hardening=+all 6 | 7 | %: 8 | dh $@ 9 | 10 | override_dh_auto_install: 11 | mkdir -p $(CURDIR)/debian/omr-server/usr/share/omr-server 12 | find . -type f -xtype f -not -iname '*/debian/*' -not -iname '*/.git/*' -exec cp '{}' "$(CURDIR)/debian/omr-server/usr/share/omr-server/{}" ';' 13 | cp -r ./shorewall4 $(CURDIR)/debian/omr-server/usr/share/omr-server/ 14 | cp -r ./shorewall6 $(CURDIR)/debian/omr-server/usr/share/omr-server/ 15 | cp -r ./bin $(CURDIR)/debian/omr-server/usr/share/omr-server/ 16 | mkdir -p $(CURDIR)/debian/etc/openmptcprouter-vps-admin 17 | touch $(CURDIR)/debian/etc/openmptcprouter-vps-admin/update-bin 18 | 19 | -------------------------------------------------------------------------------- /shorewall4/params: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall -- /etc/shorewall/params 3 | # 4 | # Assign any variables that you need here. 5 | # 6 | # It is suggested that variable names begin with an upper case letter 7 | # to distinguish them from variables used internally within the 8 | # Shorewall programs 9 | # 10 | # Example: 11 | # 12 | # NET_IF=eth0 13 | # NET_BCAST=130.252.100.255 14 | # NET_OPTIONS=routefilter,norfc1918 15 | # 16 | # Example (/etc/shorewall/interfaces record): 17 | # 18 | # net $NET_IF $NET_BCAST $NET_OPTIONS 19 | # 20 | # The result will be the same as if the record had been written 21 | # 22 | # net eth0 130.252.100.255 routefilter,norfc1918 23 | # 24 | ############################################################################### 25 | INCLUDE params.net 26 | INCLUDE params.vpn -------------------------------------------------------------------------------- /omr-6in4: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ ! -f "$1" ]; then 6 | echo "usage: $(basename "$0") FILE" 7 | exit 1 8 | fi 9 | [ ! -f $(readlink -f "$1") ] && exit 0 10 | 11 | . "$(readlink -f "$1")" 12 | 13 | if [ "$2" = "start" ]; then 14 | if [ "$IPV6" = true ]; then 15 | # Add IPv6 tunnel 16 | if [ "$(ip link show omr-6in4 up)" ]; then 17 | ip tunnel change omr-6in4 mode sit remote 10.0.0.2 local 10.0.0.1 18 | else 19 | ip tunnel add omr-6in4 mode sit remote 10.0.0.2 local 10.0.0.1 20 | fi 21 | ip link set omr-6in4 up 22 | ip route replace fd00::/8 via fe80::a00:2 dev omr-6in4 23 | fi 24 | elif [ "$(ip link show omr-6in4 up)" ]; then 25 | ip route del fd00::/8 via fe80::a00:2 dev omr-6in4 26 | ip link set omr-6in4 down 27 | ip tunnel del omr-6in4 28 | fi -------------------------------------------------------------------------------- /openvpn-tun1.6.1.conf: -------------------------------------------------------------------------------- 1 | topology subnet 2 | dev tun1 3 | data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 4 | proto udp 5 | proto udp6 6 | port 65301 7 | persist-tun 8 | persist-key 9 | duplicate-cn 10 | verb 3 11 | server 10.255.250.0 255.255.255.0 12 | ca /etc/openvpn/ca/pki/ca.crt 13 | cert /etc/openvpn/ca/pki/issued/server.crt 14 | key /etc/openvpn/ca/pki/private/server.key 15 | dh /etc/openvpn/server/dh2048.pem 16 | crl-verify /etc/openvpn/ca/pki/crl.pem 17 | keepalive 10 240 18 | txqueuelen 1000 19 | sndbuf 262144 20 | push "sndbuf 262144" 21 | rcvbuf 262144 22 | push "rcvbuf 262144" 23 | tun-mtu 1420 24 | tls-server 25 | tls-version-min 1.2 26 | push "route 10.255.250.1 255.255.255.255" 27 | #client-config-dir ccd 28 | #ifconfig-pool-persist ccd/ipp_udp.txt 29 | #fast-io 30 | passtos 31 | -------------------------------------------------------------------------------- /update-grub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | kernel=$1 3 | [ -z "$kernel" ] && exit 0 4 | 5 | config_file="$(find /boot/grub* -maxdepth 1 -name grub.cfg 2>/dev/null)" 6 | [ $config_file ] || exit 0 7 | 8 | deflt_file="$(find /etc/default \( -name grub -o -name grub2 \) 2>/dev/null)" 9 | [ $deflt_file ] || exit 0 10 | 11 | #if [ -z "$(grep -m 1 vmlinuz $config_file | grep $kernel)" ]; then 12 | x=0 13 | sed -n -e 's@\([^'\"\'']*\)['\"\'']\([^'\"\'']*\).*@\1\2@' -e '/\(menuentry\) /p' <$config_file | \ 14 | while IFS= read ln 15 | do 16 | if [ -n "$(echo $ln | grep $kernel)" ]; then 17 | x=$(expr $x - 1) 18 | sed -i "s@^\(GRUB_DEFAULT=\).*@\1\"1>$x\"@" $deflt_file 19 | [ -f /boot/grub/grub.cfg ] && grub-mkconfig -o /boot/grub/grub.cfg >/dev/null 2>&1 20 | exit 0 21 | fi 22 | x=$(expr $x + 1) 23 | done | sed 's@\(menuentry\) @@' 24 | #fi -------------------------------------------------------------------------------- /openvpn-tun0.6.1.conf: -------------------------------------------------------------------------------- 1 | topology subnet 2 | dev tun0 3 | user nobody 4 | group nogroup 5 | data-ciphers AES-256-GCM:AES-128-GCM:CHACHA20-POLY1305 6 | disable-dco 7 | proto tcp-server 8 | proto tcp6-server 9 | port 65301 10 | persist-tun 11 | persist-key 12 | duplicate-cn 13 | verb 3 14 | server 10.255.252.0 255.255.255.0 15 | ca /etc/openvpn/ca/pki/ca.crt 16 | cert /etc/openvpn/ca/pki/issued/server.crt 17 | key /etc/openvpn/ca/pki/private/server.key 18 | dh /etc/openvpn/server/dh2048.pem 19 | crl-verify /etc/openvpn/ca/pki/crl.pem 20 | keepalive 10 240 21 | txqueuelen 2048 22 | sndbuf 262144 23 | push "sndbuf 262144" 24 | rcvbuf 262144 25 | push "rcvbuf 262144" 26 | tun-mtu 1420 27 | tls-server 28 | tls-version-min 1.2 29 | #push "route 10.255.252.1 255.255.255.255" 30 | client-config-dir ccd 31 | ifconfig-pool-persist ccd/ipp_tcp.txt 32 | passtos 33 | management 127.0.0.1 65302 34 | tcp-nodelay 35 | tcp-queue-limit 2048 36 | bcast-buffers 4096 -------------------------------------------------------------------------------- /shorewall6/zones: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.0 - Sample Zones File for two-interface configuration. 3 | # Copyright (C) 2006-2014 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-zones" 13 | ############################################################################### 14 | #ZONE TYPE OPTIONS IN OUT 15 | # OPTIONS OPTIONS 16 | fw firewall 17 | net ipv6 18 | vpn ipv6 19 | 20 | -------------------------------------------------------------------------------- /shorewall4/zones: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.0 - Sample Zones File for two-interface configuration. 3 | # Copyright (C) 2006-2014 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-zones" 13 | ############################################################################### 14 | #ZONE TYPE OPTIONS IN OUT 15 | # OPTIONS OPTIONS 16 | fw firewall 17 | net ipv4 18 | vpn ipv4 19 | vpncl ipv4 20 | 21 | -------------------------------------------------------------------------------- /shorewall6/stoppedrules: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.5 - Sample Stoppedrules File for two-interface configuration. 3 | # Copyright (C) 2012 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-stoppedrules" 13 | ############################################################################### 14 | #ACTION SOURCE DEST PROTO DEST SOURCE 15 | # PORT(S) PORT(S) 16 | #ACCEPT omr-6in4 - 17 | #ACCEPT - omr-6in4 18 | 19 | -------------------------------------------------------------------------------- /shadowsocks-go.server.json: -------------------------------------------------------------------------------- 1 | { 2 | "servers": [ 3 | { 4 | "name": "ss-2022", 5 | "protocol": "2022-blake3-aes-256-gcm", 6 | "tcpListeners": [ 7 | { 8 | "network": "tcp", 9 | "address": ":65280", 10 | "fastOpen": false, 11 | "reusePort": false, 12 | "multipath": true 13 | } 14 | ], 15 | "listenerTFO": true, 16 | "enableUDP": true, 17 | "mtu": 1500, 18 | "psk": "PSK", 19 | "uPSKStorePath": "/etc/shadowsocks-go/upsks.json" 20 | } 21 | ], 22 | "stats": { 23 | "enabled": true 24 | }, 25 | "api": { 26 | "enabled": true, 27 | "debugPprof": false, 28 | "trustedProxies": [], 29 | "listeners": [ 30 | { 31 | "network": "tcp", 32 | "address": "127.0.0.1:65279" 33 | } 34 | ] 35 | } 36 | } -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: omr-server 2 | Section: net 3 | Priority: optional 4 | Maintainer: OpenMPTCProuter 5 | Build-Depends: debhelper (>= 10) 6 | X-Python-Version: >= 3.2 7 | Standards-Version: 0.0.1 8 | Homepage: https://github.com/ysurac/openmptcprouter-vps 9 | 10 | Package: omr-server 11 | Architecture: all 12 | Multi-Arch: foreign 13 | Depends: 14 | curl, 15 | rename, 16 | libcurl4, 17 | unzip, 18 | tracebox, 19 | omr-iperf3, 20 | omr-shadowsocks-libev (= 3.3.5-2), 21 | omr-vps-admin (= 0.3+20210508), 22 | omr-simple-obfs, 23 | omr-mlvpn (= 3.0.0+20201216.git.2263bab), 24 | omr-glorytun (= 0.3.4-4), 25 | omr-glorytun-tcp (= 0.0.35-3), 26 | omr-dsvpn (= 0.1.4-2), 27 | shorewall, 28 | shorewall6, 29 | iptables, 30 | v2ray-plugin (= 4.35.1), 31 | v2ray (=4.35.1), 32 | linux-image-5.4.100-mptcp (= 1.18+9d3f35b), 33 | ${misc:Depends} 34 | Provides: omr-server 35 | Conflicts: omr-server 36 | Replaces: omr-server 37 | Description: OpenMPTCProuter Server script -------------------------------------------------------------------------------- /shorewall6/interfaces: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.0 - Sample Interfaces File for two-interface configuration. 3 | # Copyright (C) 2006-2014 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-interfaces" 13 | ############################################################################### 14 | ?FORMAT 2 15 | ############################################################################### 16 | #ZONE INTERFACE OPTIONS 17 | net $NET_IFACE dhcp,tcpflags,rpfilter,forward=1,routeback 18 | vpn omr-6in4-user+ tcpflags,forward=1,routeback 19 | 20 | -------------------------------------------------------------------------------- /shorewall6/policy: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.0 - Sample Policy File for two-interface configuration. 3 | # Copyright (C) 2006-2014 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-policy" 13 | ############################################################################### 14 | #SOURCE DEST POLICY LOG LEVEL LIMIT:BURST 15 | 16 | vpn all ACCEPT 17 | fw all ACCEPT 18 | net all DROP 19 | # THE FOLLOWING POLICY MUST BE LAST 20 | all all REJECT 21 | 22 | -------------------------------------------------------------------------------- /old-v2ray.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=V2Ray - A unified platform for anti-censorship 3 | Documentation=https://v2ray.com https://guide.v2fly.org 4 | After=network.target nss-lookup.target 5 | Wants=network-online.target 6 | 7 | [Service] 8 | # If the version of systemd is 240 or above, then uncommenting Type=exec and commenting out Type=simple 9 | #Type=exec 10 | Type=simple 11 | # Runs as root or add CAP_NET_BIND_SERVICE ability can bind 1 to 1024 port. 12 | # This service runs as root. You may consider to run it as another user for security concerns. 13 | # By uncommenting User=v2ray and commenting out User=root, the service will run as user v2ray. 14 | # More discussion at https://github.com/v2ray/v2ray-core/issues/1011 15 | User=root 16 | #User=v2ray 17 | CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_NET_RAW 18 | NoNewPrivileges=yes 19 | ExecStart=/usr/bin/v2ray -config /etc/v2ray/config.json 20 | Restart=on-failure 21 | # Don't restart in the case of configuration error 22 | RestartPreventExitStatus=23 23 | 24 | [Install] 25 | WantedBy=multi-user.target 26 | -------------------------------------------------------------------------------- /shorewall6/snat: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall - Sample SNAT/Masqueradee File for two-interface configuration. 3 | # Copyright (C) 2006-2016 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-snat" 13 | # 14 | # See http://shorewall.net/manpages/shorewall-snat.html for more information 15 | ########################################################################################################################################### 16 | #ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY 17 | # 18 | MASQUERADE fe80::/10,\ 19 | fd00::/8 $NET_IFACE 20 | # SNAT from VPN server for all VPN clients 21 | #SNAT(fe80::a00:1) ::/0 omr-6in4-user+ 22 | -------------------------------------------------------------------------------- /shorewall4/policy: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.0 - Sample Policy File for two-interface configuration. 3 | # Copyright (C) 2006-2014 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-policy" 13 | ############################################################################### 14 | #SOURCE DEST POLICY LOG LEVEL LIMIT:BURST 15 | 16 | vpn net ACCEPT 17 | vpn fw ACCEPT 18 | fw vpn ACCEPT 19 | fw net ACCEPT 20 | net all DROP 21 | vpn vpn DROP 22 | vpncl vpn ACCEPT 23 | vpn vpncl ACCEPT 24 | # THE FOLLOWING POLICY MUST BE LAST 25 | all all REJECT 26 | 27 | -------------------------------------------------------------------------------- /shorewall6/conntrack: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall6 -- /etc/shorewall6/conntrack 3 | # 4 | # For information about entries in this file, type "man shorewall6-conntrack" 5 | # 6 | ?FORMAT 3 7 | ############################################################################################## 8 | #ACTION SOURCE DEST PROTO DPORT SPORT USER SWITCH 9 | 10 | ?if $AUTOHELPERS && __CT_TARGET 11 | 12 | ?if __AMANDA_HELPER 13 | CT:helper:amanda:PO - - udp 10080 14 | ?endif 15 | 16 | ?if __FTP_HELPER 17 | CT:helper:ftp:PO - - tcp 21 18 | ?endif 19 | 20 | ?if __H323_HELPER 21 | CT:helper:RAS:PO - - udp 1719 22 | CT:helper:Q.931:PO - - tcp 1720 23 | ?endif 24 | 25 | ?if __IRC_HELPER 26 | CT:helper:irc:PO - - tcp 6667 27 | ?endif 28 | 29 | ?if __NETBIOS_NS_HELPER 30 | CT:helper:netbios-ns:PO - - udp 137 31 | ?endif 32 | 33 | ?if __PPTP_HELPER 34 | CT:helper:pptp:PO - - tcp 1723 35 | ?endif 36 | 37 | ?if __SANE_HELPER 38 | CT:helper:sane:PO - - tcp 6566 39 | ?endif 40 | 41 | ?if __SIP_HELPER 42 | CT:helper:sip:PO - - udp 5060 43 | ?endif 44 | 45 | ?if __SNMP_HELPER 46 | CT:helper:snmp:PO - - udp 161 47 | ?endif 48 | 49 | ?if __TFTP_HELPER 50 | CT:helper:tftp:PO - - udp 69 51 | ?endif 52 | 53 | ?endif 54 | -------------------------------------------------------------------------------- /shorewall4/conntrack: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall -- /etc/shorewall/conntrack 3 | # 4 | # For information about entries in this file, type "man shorewall-conntrack" 5 | # 6 | ?FORMAT 3 7 | ###################################################################################################### 8 | #ACTION SOURCE DEST PROTO DPORT SPORT USER SWITCH 9 | 10 | ?if $AUTOHELPERS && __CT_TARGET 11 | 12 | ?if __AMANDA_HELPER 13 | CT:helper:amanda:PO - - udp 10080 14 | ?endif 15 | 16 | ?if __FTP_HELPER 17 | CT:helper:ftp:PO - - tcp 21 18 | ?endif 19 | 20 | ?if __H323_HELPER 21 | CT:helper:RAS:PO - - udp 1719 22 | CT:helper:Q.931:PO - - tcp 1720 23 | ?endif 24 | 25 | ?if __IRC_HELPER 26 | CT:helper:irc:PO - - tcp 6667 27 | ?endif 28 | 29 | ?if __NETBIOS_NS_HELPER 30 | CT:helper:netbios-ns:PO - - udp 137 31 | ?endif 32 | 33 | ?if __PPTP_HELPER 34 | CT:helper:pptp:PO - - tcp 1723 35 | ?endif 36 | 37 | ?if __SANE_HELPER 38 | CT:helper:sane:PO - - tcp 6566 39 | ?endif 40 | 41 | ?if __SIP_HELPER 42 | CT:helper:sip:PO - - udp 5060 43 | ?endif 44 | 45 | ?if __SNMP_HELPER 46 | CT:helper:snmp:PO - - udp 161 47 | ?endif 48 | 49 | ?if __TFTP_HELPER 50 | CT:helper:tftp:PO - - udp 69 51 | ?endif 52 | 53 | ?endif 54 | -------------------------------------------------------------------------------- /shorewall4/interfaces: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.0 - Sample Interfaces File for two-interface configuration. 3 | # Copyright (C) 2006-2014 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-interfaces" 13 | ############################################################################### 14 | ?FORMAT 2 15 | ############################################################################### 16 | #ZONE INTERFACE OPTIONS 17 | net $NET_IFACE dhcp,tcpflags,routefilter,nosmurfs,sourceroute=0 18 | vpn gt-tun+ nosmurfs,tcpflags 19 | vpn gt-udp-tun+ nosmurfs,tcpflags 20 | vpn mlvpn+ nosmurfs,tcpflags 21 | vpn tun+ nosmurfs,tcpflags 22 | vpn wg+ nosmurfs,tcpflags 23 | vpncl client-wg+ nosmurfs,tcpflags 24 | vpn dsvpn+ nosmurfs,tcpflags 25 | vpn gre-user+ nosmurfs,tcpflags 26 | vpn omr-bonding nosmurfs,tcpflags 27 | vpn tap_softether nosmurfs,tcpflags 28 | -------------------------------------------------------------------------------- /shorewall4/snat: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall - Sample SNAT/Masqueradee File for two-interface configuration. 3 | # Copyright (C) 2006-2016 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-snat" 13 | # 14 | # See http://shorewall.net/manpages/shorewall-snat.html for more information 15 | ########################################################################################################################################### 16 | #ACTION SOURCE DEST PROTO PORT IPSEC MARK USER SWITCH ORIGDEST PROBABILITY 17 | # 18 | MASQUERADE 10.255.247.0/24,\ 19 | 10.255.210.0/24,\ 20 | 10.255.248.0/24,\ 21 | 10.255.250.0/24,\ 22 | 10.255.251.0/24,\ 23 | 10.255.252.0/24,\ 24 | 10.255.253.0/24,\ 25 | 10.255.254.0/24,\ 26 | 10.255.255.0/24,\ 27 | 169.254.0.0/16,\ 28 | 172.16.0.0/12,\ 29 | 192.168.0.0/16 $NET_IFACE 30 | # SNAT from VPN server for all VPN clients 31 | #SNAT($VPS_ADDR) 0.0.0.0/0 $VPS_IFACE 32 | -------------------------------------------------------------------------------- /xray-vless-reality.json: -------------------------------------------------------------------------------- 1 | { 2 | "inbounds": [ 3 | { 4 | "port": 443, 5 | "tag": "omrin-vless-reality", 6 | "protocol": "vless", 7 | "settings": { 8 | "clients": [ 9 | { 10 | "id": "XRAY_UUID", 11 | "flow": "xtls-rprx-vision" 12 | } 13 | ], 14 | "decryption": "none" 15 | }, 16 | "streamSettings": { 17 | "network": "tcp", 18 | "security": "reality", 19 | "realitySettings": { 20 | "dest": "1.1.1.1:443", 21 | "serverNames": [ 22 | "" 23 | ], 24 | "privateKey": "XRAY_X25519_PRIVATE_KEY", 25 | "publicKey": "XRAY_X25519_PUBLIC_KEY", 26 | "shortIds": [ 27 | "" 28 | ] 29 | }, 30 | "sockopt": { 31 | "tcpMptcp": true, 32 | "mark": 0 33 | } 34 | } 35 | } 36 | ], 37 | "routing": { 38 | "rules": [ 39 | { 40 | "type": "field", 41 | "inboundTag": [ 42 | "omrin-vless-reality" 43 | ] 44 | } 45 | ] 46 | } 47 | } -------------------------------------------------------------------------------- /shorewall4/stoppedrules: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.5 - Sample Stoppedrules File for two-interface configuration. 3 | # Copyright (C) 2012 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-stoppedrules" 13 | ############################################################################### 14 | #ACTION SOURCE DEST PROTO DEST SOURCE 15 | # PORT(S) PORT(S) 16 | ACCEPT gt-tun+ - 17 | ACCEPT - gt-tun+ 18 | ACCEPT gt-udp-tun+ - 19 | ACCEPT - gt-udp-tun+ 20 | ACCEPT mlvpn+ - 21 | ACCEPT - mlvpn+ 22 | ACCEPT dsvpn+ - 23 | ACCEPT - dsvpn+ 24 | ACCEPT tun+ - 25 | ACCEPT - tun+ 26 | ACCEPT wg+ - 27 | ACCEPT - wg+ 28 | ACCEPT client-wg+ - 29 | ACCEPT - client-wg+ 30 | ACCEPT tap_softether - 31 | ACCEPT - tap_softether 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenMPTCProuter VPS scripts 2 | 3 | All scripts needed to install OpenMPTCProuter VPS. 4 | 5 | This is the VPS part of [OpenMPTCProuter](https://www.openmptcprouter.com/), a solution to aggregate multiple internet connections. 6 | 7 | * ```debian9-x86_64.sh```: The main script install ShadowSocks, Glorytun TCP, Glorytun UDP, Shorewall, the MPTCP kernel and can install OpenVPN 8 | * ```debian9-x86_64-mlvpn.sh```: Script to install MLVPN 9 | * ```config.json```: shadowsocks config 10 | * ```/shorewall4```: shorewall default configuration 11 | * ```/shorewall6```: shorewall6 default configuration 12 | * ```glorytun-tcp-run```: script to run glorytun with configuration parameters 13 | * ```glorytun-tcp@.service.in```: glorytun systemd service 14 | * ```glorytun.network```: glorytun systemd network (for DHCP) 15 | * ```glorytun-udp-run```: script to run glorytun UDP with configuration parameters 16 | * ```glorytun-udp.network```: glorytun UDP systemd network (for DHCP) 17 | * ```glorytun-udp@.service.in```: glorytun UDP systemd service 18 | * ```mlvpn.network```: MLVPN systemd network (for DHCP) 19 | * ```mlvpn0.conf```: MLVPN default config 20 | * ```omr-6in4-service```: Script used to make 6in4 tunnel always up and detect ip used by OpenMPTCProuter to config Shorewall 21 | * ```omr-6in4.service.in```: Systemd service to run the script 22 | * ```openvpn-tun0.cnf```: OpenVPN default config 23 | * ```openvpn.network```: OpenVPN systemd network (for DHCP) 24 | * ```shadowsocks.conf```: shadowsocks sysctl.d optimization and mptcp config 25 | * ```tun0.glorytun```: glorytun default configuration 26 | * ```tun0.glorytun-udp```: glorytun default configuration 27 | * ```update-grub.sh```: Script used to check if MPTCP kernel is the default 28 | 29 | -------------------------------------------------------------------------------- /debian9-x86_64-bin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | umask 0022 4 | export LC_ALL=C 5 | 6 | #rm -f /var/lib/dpkg/lock 7 | #rm -f /var/cache/apt/archives/lock 8 | 9 | # Check Linux version 10 | if test -f /etc/os-release ; then 11 | . /etc/os-release 12 | else 13 | . /usr/lib/os-release 14 | fi 15 | if [ "$ID" = "debian" ] && [ "$VERSION_ID" != "9" ]; then 16 | echo "This script only work with Debian Stretch (9.x)" 17 | exit 1 18 | elif [ "$ID" != "debian" ]; then 19 | echo "This script only work with Debian Stretch (9.x)" 20 | exit 1 21 | fi 22 | 23 | apt-get update 24 | apt-get -y install apt-transport-https 25 | 26 | echo 'deb https://repo.openmptcprouter.com stretch main' > /etc/apt/sources.list.d/openmptcprouter.list 27 | cat < /etc/apt/sources.list.d/stretch-backports.list 35 | wget -O - http://repo.openmptcprouter.com/openmptcprouter.gpg.key | apt-key add - 36 | apt-get update 37 | apt-get -y install dirmngr patch rename curl 38 | # Rename bzImage to vmlinuz, needed when custom kernel was used 39 | cd /boot 40 | rename 's/^bzImage/vmlinuz/s' * >/dev/null 2>&1 41 | #rm -f /var/lib/dpkg/lock 42 | #rm -f /var/cache/apt/archives/lock 43 | rm -f /etc/kernel-img.conf 44 | echo "Install all" 45 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-overwrite" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install omr-vps 46 | 47 | systemctl -q enable shorewall 48 | systemctl -q enable shorewall6 49 | 50 | # Change SSH port to 65222 51 | sed -i 's:#Port 22:Port 65222:g' /etc/ssh/sshd_config 52 | sed -i 's:Port 22:Port 65222:g' /etc/ssh/sshd_config 53 | 54 | echo "OpenMPTCProuter VPS is now installed !" 55 | cat /root/openmptcprouter_config.txt 56 | -------------------------------------------------------------------------------- /shadowsocks.conf: -------------------------------------------------------------------------------- 1 | # local sysctl settings can be stored in this directory 2 | # max open files 3 | fs.file-max = 512000 4 | # max read buffer 5 | net.core.rmem_max = 67108864 6 | # max write buffer 7 | net.core.wmem_max = 67108864 8 | net.core.optmem_max = 33554432 9 | # default read buffer 10 | net.core.rmem_default = 131072 11 | # default write buffer 12 | net.core.wmem_default = 131072 13 | # max processor input queue 14 | net.core.netdev_max_backlog = 4096 15 | # max backlog 16 | net.core.somaxconn = 4096 17 | 18 | # resist SYN flood attacks 19 | net.ipv4.tcp_syncookies = 1 20 | # reuse timewait sockets when safe 21 | net.ipv4.tcp_tw_reuse = 1 22 | # turn off fast timewait sockets recycling 23 | #net.ipv4.tcp_tw_recycle = 0 24 | # short FIN timeout 25 | net.ipv4.tcp_fin_timeout = 30 26 | # Increase max orphans 27 | net.ipv4.tcp_max_orphans = 16384 28 | # short keepalive time 29 | net.ipv4.tcp_keepalive_time = 7200 30 | # outbound port range 31 | net.ipv4.ip_local_port_range = 9999 65000 32 | # max SYN backlog 33 | net.ipv4.tcp_max_syn_backlog = 10240 34 | # max timewait sockets held by system simultaneously 35 | net.ipv4.tcp_max_tw_buckets = 10000 36 | # turn on TCP Fast Open on both client and server side 37 | net.ipv4.tcp_fastopen = 3 38 | # TCP buffer 39 | net.ipv4.tcp_mem = 8092 131072 67108864 40 | # UDP buffer 41 | net.ipv4.udp_mem = 8092 131072 67108864 42 | # TCP receive buffer 43 | net.ipv4.tcp_rmem = 4096 87380 33554432 44 | # TCP write buffer 45 | net.ipv4.tcp_wmem = 4096 65536 33554432 46 | # turn on path MTU discovery 47 | net.ipv4.tcp_mtu_probing = 0 48 | 49 | # for low-latency network, use cubic instead 50 | net.ipv4.tcp_congestion_control = bbr 51 | net.core.default_qdisc = fq 52 | # Default conntrack is too small 53 | net.netfilter.nf_conntrack_max = 524288 54 | net.netfilter.nf_conntrack_buckets=131072 55 | net.netfilter.nf_conntrack_tcp_timeout_established = 86400 56 | 57 | net.ipv4.conf.all.log_martians = 0 58 | net.ipv4.conf.default.log_martians = 0 59 | 60 | # MPTCP settings 61 | net.mptcp.mptcp_checksum = 0 62 | net.mptcp.mptcp_syn_retries = 4 63 | net.mptcp.mptcp_scheduler = blest 64 | net.ipv4.tcp_ecn = 2 65 | -------------------------------------------------------------------------------- /shorewall6/rules: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.0 - Sample Rules File for two-interface configuration. 3 | # Copyright (C) 2006-2014,2007 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-rules" 13 | ###################################################################################################################################################################################################### 14 | #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER 15 | # PORT PORT(S) DEST LIMIT GROUP 16 | ?SECTION ALL 17 | ?SECTION ESTABLISHED 18 | ?SECTION RELATED 19 | ?SECTION INVALID 20 | ?SECTION UNTRACKED 21 | ?SECTION NEW 22 | 23 | # Don't allow connection pickup from the net 24 | # 25 | Invalid(DROP) net all tcp 26 | # 27 | # Accept DNS connections from the firewall to the network 28 | # 29 | DNS(ACCEPT) $FW net 30 | # 31 | # Allow Ping from/to the VPN 32 | # 33 | ACCEPT vpn $FW ipv6-icmp 34 | ACCEPT vpn net ipv6-icmp 35 | ACCEPT $FW vpn ipv6-icmp 36 | # 37 | # Allow Ping from the firewall to the network 38 | # 39 | ACCEPT $FW net ipv6-icmp 40 | # 41 | # Drop Ping from the "bad" net zone.. and prevent your log from being flooded.. 42 | # 43 | #DROP net $FW ipv6-icmp 44 | ACCEPT net $FW ipv6-icmp 45 | # 46 | # Accept connection from port > 65000 for shadowsocks and glorytun on the firewall 47 | # 48 | ACCEPT net $FW tcp 65000-65535 49 | ACCEPT net $FW udp 65000-65535 50 | # 51 | # Accept connection from SSH to the firewall 52 | # 53 | ACCEPT net $FW tcp 65222 54 | # 55 | # DHCP forward to the VPN from the firewall 56 | # 57 | ACCEPT $FW vpn udp 53 58 | ACCEPT vpn net udp 53 59 | # 60 | # Redirect all port from 1 to 64999 to the VPN client from the network 61 | # 62 | #DNAT net vpn:10.0.0.2 tcp 1-64999 63 | -------------------------------------------------------------------------------- /shorewall4/rules: -------------------------------------------------------------------------------- 1 | # 2 | # Shorewall version 4.0 - Sample Rules File for two-interface configuration. 3 | # Copyright (C) 2006-2014,2007 by the Shorewall Team 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2.1 of the License, or (at your option) any later version. 9 | # 10 | # See the file README.txt for further details. 11 | #------------------------------------------------------------------------------ 12 | # For information about entries in this file, type "man shorewall-rules" 13 | ###################################################################################################################################################################################################### 14 | #ACTION SOURCE DEST PROTO DEST SOURCE ORIGINAL RATE USER/ MARK CONNLIMIT TIME HEADERS SWITCH HELPER 15 | # PORT PORT(S) DEST LIMIT GROUP 16 | ?SECTION ALL 17 | ?SECTION ESTABLISHED 18 | ?SECTION RELATED 19 | ?SECTION INVALID 20 | ?SECTION UNTRACKED 21 | ?SECTION NEW 22 | 23 | # Don't allow connection pickup from the net 24 | # 25 | Invalid(DROP) net all tcp 26 | # 27 | # Accept DNS connections from the firewall to the network 28 | # 29 | DNS(ACCEPT) $FW net 30 | # 31 | # Allow Ping from/to the VPN 32 | # 33 | Ping(ACCEPT) vpn $FW 34 | Ping(ACCEPT) $FW vpn 35 | # 36 | # Allow Ping from the firewall to the network 37 | # 38 | Ping(ACCEPT) $FW net 39 | # 40 | # Drop Ping from the "bad" net zone.. and prevent your log from being flooded.. 41 | # 42 | #Ping(DROP) net $FW 43 | Ping(ACCEPT) net $FW 44 | # 45 | # Accept connection from port > 65000 for shadowsocks and glorytun on the firewall 46 | # 47 | ACCEPT net $FW tcp 65000-65535 48 | ACCEPT net $FW udp 65000-65535 49 | # 50 | # Accept connection from SSH to the firewall 51 | # 52 | ACCEPT net $FW tcp 65222 53 | # 54 | # DHCP forward to the VPN from the firewall 55 | # 56 | DHCPfwd(ACCEPT) $FW vpn 57 | # 58 | # Redirect all port from 1 to 64999 to the VPN client from the network 59 | # 60 | #DNAT net vpn:$OMR_ADDR tcp 1-64999 61 | #DNAT net vpn:$OMR_ADDR udp 1-64999 62 | -------------------------------------------------------------------------------- /shadowsocks.6.1.conf: -------------------------------------------------------------------------------- 1 | # local sysctl settings can be stored in this directory 2 | # max open files 3 | fs.file-max = 512000 4 | # max read buffer 5 | net.core.rmem_max = 7500000 6 | # max write buffer 7 | net.core.wmem_max = 7500000 8 | #net.core.optmem_max = 33554432 9 | # default read buffer 10 | #net.core.rmem_default = 16777216 11 | # default write buffer 12 | #net.core.wmem_default = 16777216 13 | # max processor input queue 14 | net.core.netdev_max_backlog = 10000 15 | # max backlog 16 | net.core.somaxconn = 16384 17 | 18 | # resist SYN flood attacks 19 | net.ipv4.tcp_syncookies = 1 20 | # reuse timewait sockets when safe 21 | net.ipv4.tcp_tw_reuse = 1 22 | # turn off fast timewait sockets recycling 23 | #net.ipv4.tcp_tw_recycle = 0 24 | # short FIN timeout 25 | net.ipv4.tcp_fin_timeout = 30 26 | # Increase max orphans 27 | net.ipv4.tcp_max_orphans = 16384 28 | # short keepalive time 29 | net.ipv4.tcp_keepalive_time = 7200 30 | # outbound port range 31 | net.ipv4.ip_local_port_range = 9999 65000 32 | # max SYN backlog 33 | net.ipv4.tcp_max_syn_backlog = 4096 34 | # max timewait sockets held by system simultaneously 35 | net.ipv4.tcp_max_tw_buckets = 16384 36 | # turn on TCP Fast Open on both client and server side 37 | net.ipv4.tcp_fastopen = 3 38 | # TCP buffer 39 | net.ipv4.tcp_mem = 409600 819200 1638400 40 | # UDP buffer 41 | net.ipv4.udp_mem = 4096 87380 16777216 42 | # TCP receive buffer 43 | net.ipv4.tcp_rmem = 4096 87380 16777216 44 | # TCP write buffer 45 | net.ipv4.tcp_wmem = 4096 87380 16777216 46 | # turn on path MTU discovery 47 | net.ipv4.tcp_mtu_probing = 0 48 | # 1/8 * available memory in receive buffer 49 | net.ipv4.tcp_adv_win_scale=-3 50 | # limits the size of unsent bytes in the write queue 51 | net.ipv4.tcp_notsent_lowat = 131072 52 | 53 | # for low-latency network, use cubic instead 54 | net.core.default_qdisc = fq 55 | # Default conntrack is too small 56 | net.netfilter.nf_conntrack_max = 524288 57 | net.netfilter.nf_conntrack_buckets=131072 58 | net.netfilter.nf_conntrack_tcp_timeout_established = 86400 59 | 60 | net.ipv4.conf.all.log_martians = 0 61 | net.ipv4.conf.default.log_martians = 0 62 | 63 | # MPTCP settings 64 | net.ipv4.tcp_ecn = 2 65 | net.mptcp.checksum_enabled = 0 66 | net.mptcp.add_addr_timeout = 120 67 | net.mptcp.allow_join_initial_addr_port = 1 68 | net.mptcp.enabled = 1 69 | net.mptcp.pm_type = 0 70 | net.mptcp.stale_loss_cnt = 4 71 | net.mptcp.mptcp_checksum=0 72 | net.mptcp.mptcp_path_manager=fullmesh 73 | net.mptcp.mptcp_scheduler=mptcp_burst 74 | net.mptcp.mptcp_syn_retries=4 75 | net.mptcp.mptcp_version=1 76 | net.mptcp.checksum_enabled=0 77 | net.ipv4.tcp_congestion_control=bbr 78 | net.ipv4.tcp_low_latency=1 79 | net.ipv4.tcp_slow_start_after_idle=0 -------------------------------------------------------------------------------- /omr-pihole.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ -f /etc/os-release ]; then 3 | . /etc/os-release 4 | else 5 | . /usr/lib/os-release 6 | fi 7 | if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "9" ]; then 8 | echo "This script doesn't work with Debian Stretch (9.x)" 9 | exit 1 10 | fi 11 | if [ "$(id -u)" -ne 0 ]; then 12 | echo "You must run the script as root" 13 | exit 1 14 | fi 15 | 16 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 17 | echo "You can select any interface and set any IPs during Pi-hole configuration, this will be modified for OpenMPTCProuter at the end." 18 | echo "Don't apply Pi-hole firewall rules." 19 | echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 20 | [ "`tty`" != "not a tty" ] && read -n 1 -s -r -p "Press any key to continue" || sleep 5 21 | 22 | echo "Run Pi-hole install script..." 23 | curl -sSL https://install.pi-hole.net | bash 24 | echo "Done" 25 | echo "-------------------------------------------------------------------------------------------------------------------------------" 26 | echo "OMR Pi-hole configuration..." 27 | cat > /etc/lighttpd/external.conf << 'EOF' 28 | server.bind="10.255.255.1" 29 | $SERVER["socket"] == "10.255.254.1:80" { } 30 | $SERVER["socket"] == "10.255.252.1:80" { } 31 | $SERVER["socket"] == "10.255.251.1:80" { } 32 | $SERVER["socket"] == "10.255.253.1:80" { } 33 | EOF 34 | systemctl list-unit-files lighttpd.service &>/dev/null && systemctl -q restart lighttpd 35 | grep -v -e PIHOLE_INTERFACE -e IPV4_ADDRESS -e IPV6_ADDRESS /etc/pihole/setupVars.conf > /etc/pihole/setupVars.new.conf 36 | mv /etc/pihole/setupVars.new.conf /etc/pihole/setupVars.conf 37 | cat >> /etc/pihole/setupVars.conf <<-EOF 38 | PIHOLE_INTERFACE=gt-tun0 39 | IPV4_ADDRESS=10.255.0.0/16 40 | IPV6_ADDRESS=fd00::a00:/106 41 | RATE_LIMIT=0/0 42 | EOF 43 | 44 | grep -v interface /etc/dnsmasq.d/01-pihole.conf > /etc/dnsmasq.d/01-pihole.new.conf 45 | mv /etc/dnsmasq.d/01-pihole.new.conf /etc/dnsmasq.d/01-pihole.conf 46 | cat > /etc/dnsmasq.d/99-omr.conf <<-EOF 47 | interface=gt-tun0 48 | interface=gt-udp-tun0 49 | interface=tun0 50 | interface=mlvpn0 51 | interface=dsvpn0 52 | EOF 53 | systemctl -q restart pihole-FTL 54 | echo "Done" 55 | echo "======================================================================================================================================" 56 | echo "To use Pi-hole in OpenMPTCProuter, you need to 'Save & Apply' the wizard again in System->OpenMPTCProuter then reboot OpenMPTCProuter." 57 | echo "Web interface will be available on 10.255.255.1 if you use Glorytun TCP, 10.255.254.1 if you use Glorytun UDP." 58 | echo "======================================================================================================================================" 59 | exit 0 -------------------------------------------------------------------------------- /omr-test-speed: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 : 3 | HETZNER=false 4 | if [ "$1" = "hetzner" ]; then 5 | HETZNER=true 6 | INTERFACE="$2" 7 | else 8 | INTERFACE="$1" 9 | fi 10 | 11 | [ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && { 12 | echo "You must use a real interface. You wan find them using 'ip a' for example" 13 | exit 0 14 | } 15 | 16 | if [ "$HETZNER" = false ]; then 17 | echo "Select best test server..." 18 | 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" 19 | bestping="9999" 20 | for pinghost in $HOSTLST; do 21 | domain=$(echo $pinghost | awk -F/ '{print $3}') 22 | if [ -z "$INTERFACE" ]; then 23 | ping=$(ping -c1 -w2 $domain | cut -d "/" -s -f5 | cut -d "." -f1) 24 | else 25 | ping=$(ping -c1 -w2 -I $INTERFACE -B $domain | cut -d "/" -s -f5 | cut -d "." -f1) 26 | fi 27 | echo "host: $domain - ping: $ping" 28 | if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then 29 | bestping=$ping 30 | HOST=$pinghost 31 | fi 32 | done 33 | fi 34 | 35 | [ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin" 36 | 37 | echo "Best server is $HOST, running test:" 38 | trap : HUP INT TERM 39 | if [ -z "$INTERFACE" ]; then 40 | curl -4 -o /dev/null $HOST || echo 41 | else 42 | domain=$(echo $HOST | awk -F/ '{print $3}') 43 | hostip=$(dig +nocmd +noall +answer A $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ') 44 | if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then 45 | for ip in $hostip; do 46 | ipset add ss_rules_dst_bypass_all $ip 47 | done 48 | fi 49 | curl -4 -o /dev/null --interface $INTERFACE $HOST || echo 50 | if [ -n "$(ipset list 2>/dev/null | grep ss_rules)" ]; then 51 | for ip in $hostip; do 52 | ipset del ss_rules_dst_bypass_all $ip 53 | done 54 | fi 55 | fi 56 | -------------------------------------------------------------------------------- /omr-test-speedv6: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # vim: set noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 : 3 | HETZNER=false 4 | if [ "$1" = "hetzner" ]; then 5 | HETZNER=true 6 | INTERFACE="$2" 7 | else 8 | INTERFACE="$1" 9 | fi 10 | 11 | [ -n "$INTERFACE" ] && [ ! -d "/sys/class/net/$INTERFACE" ] && { 12 | echo "You must use a real interface. You wan find them using 'ip a' for example" 13 | exit 0 14 | } 15 | 16 | 17 | if [ "$HETZNER" = false ]; then 18 | echo "Select best test server..." 19 | 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" 20 | bestping="9999" 21 | for pinghost in $HOSTLST; do 22 | domain=$(echo $pinghost | awk -F/ '{print $3}') 23 | if [ -z "$INTERFACE" ]; then 24 | ping=$(ping -6 -c1 -w2 $domain | cut -d "/" -s -f5 | cut -d "." -f1) 25 | else 26 | ping=$(ping -6 -c1 -w2 -I $INTERFACE -B $domain | cut -d "/" -s -f5 | cut -d "." -f1) 27 | fi 28 | echo "host: $domain - ping: $ping" 29 | if [ -n "$ping" ] && [ "$ping" -lt "$bestping" ]; then 30 | bestping=$ping 31 | HOST=$pinghost 32 | fi 33 | done 34 | fi 35 | 36 | [ -z "$HOST" ] && HOST="https://speed.hetzner.de/10GB.bin" 37 | 38 | echo "Best server is $HOST, running test:" 39 | trap : HUP INT TERM 40 | if [ -z "$INTERFACE" ]; then 41 | curl -6 $HOST >/dev/null || echo 42 | else 43 | domain=$(echo $HOST | awk -F/ '{print $3}') 44 | hostip=$(dig +nocmd +noall +answer AAAA $domain | grep -v CNAME | awk '{print $5}' | tr '\n' ' ') 45 | if [ -n "$(ipset list 2>/dev/null | grep ss_rules6)" ]; then 46 | for ip in $hostip; do 47 | ipset add ss_rules6_dst_bypass_all $ip 48 | done 49 | fi 50 | curl -6 --interface $INTERFACE $HOST >/dev/null || echo 51 | if [ -n "$(ipset list 2>/dev/null | grep ss_rules6)" ]; then 52 | for ip in $hostip; do 53 | ipset del ss_rules6_dst_bypass_all $ip 54 | done 55 | fi 56 | fi 57 | -------------------------------------------------------------------------------- /omr-bypass: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Ycarus (Yannick Chabanois) for OpenMPTCProuter 3 | # Released under GPL 3. See LICENSE for the full terms. 4 | 5 | [ ! -f /etc/openmptcprouter-vps-admin/omr-bypass.json ] && exit 0 6 | 7 | # Configuration 8 | INTERFACE="$(jq -M -r .bypass_intf /etc/openmptcprouter-vps-admin/omr-admin-config.json | tr -d '\n')" 9 | [ "$INTERFACE" = "null" ] && INTERFACE="vpn1" 10 | GATEWAY="$(ip r show dev ${INTERFACE} | awk '/via/ {print $3}' | tr -d '\n')" 11 | GATEWAY6="$(ip -6 r show dev ${INTERFACE} | awk '/via/ {print $3}' | tr -d '\n')" 12 | TABLE="991337" 13 | MARK="0x539" 14 | 15 | CHECKSUM="$(md5sum /etc/openmptcprouter-vps-admin/omr-bypass.json | awk '{print $1}' | tr -d '\n')" 16 | PREVIOUS_CHECKSUM="$(jq -M -r .bypass_checksum /etc/openmptcprouter-vps-admin/omr-admin-config.json | tr -d '\n')" 17 | [ "$CHECKSUM" = "$PREVIOUS_CHECKSUM" ] && exit 0 18 | 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 19 | mv /etc/openmptcprouter-vps-admin/omr-admin-config.json.tmp /etc/openmptcprouter-vps-admin/omr-admin-config.json 20 | # Action 21 | ipset -q flush omr_dst_bypass_srv_${INTERFACE} 2>&1 > /dev/null 22 | ipset -q flush omr6_dst_bypass_srv_${INTERFACE} 2>&1 > /dev/null 23 | ipset -q --exist restore <<-EOF 24 | create omr_dst_bypass_srv_${INTERFACE} hash:net hashsize 64 25 | create omr6_dst_bypass_srv_${INTERFACE} hash:net family inet6 hashsize 64 26 | EOF 27 | ipv4=$(cat /etc/openmptcprouter-vps-admin/omr-bypass.json | jq -r .${INTERFACE}.ipv4[]) 28 | for ip in $ipv4; do 29 | ipset -q add omr_dst_bypass_srv_${INTERFACE} $ip 30 | done 31 | ipv6=$(cat /etc/openmptcprouter-vps-admin/omr-bypass.json | jq -r .${INTERFACE}.ipv6[]) 32 | for ip in $ipv6; do 33 | ipset -q add omr6_dst_bypass_srv_${INTERFACE} $ip 34 | done 35 | iptables-save --counters 2>/dev/null | grep -v omr-bypass | iptables-restore -w --counters 2>/dev/null 36 | iptables-restore -w --wait=60 --noflush <<-EOF 37 | *mangle 38 | :omr-bypass - 39 | -A PREROUTING -j omr-bypass 40 | COMMIT 41 | EOF 42 | iptables-restore -w --wait=60 --noflush <<-EOF 43 | *mangle 44 | :omr-bypass-local - 45 | -A OUTPUT -m addrtype ! --dst-type LOCAL -j omr-bypass-local 46 | COMMIT 47 | EOF 48 | iptables-restore -w --wait=60 --noflush <<-EOF 49 | *mangle 50 | -A omr-bypass -m set --match-set omr_dst_bypass_srv_${INTERFACE} dst -j MARK --set-mark ${MARK} 51 | -A omr-bypass -m mark --mark ${MARK} -j RETURN 52 | -A omr-bypass-local -m set --match-set omr_dst_bypass_srv_${INTERFACE} dst -j MARK --set-mark ${MARK} 53 | -A omr-bypass-local -m mark --mark ${MARK} -j RETURN 54 | COMMIT 55 | EOF 56 | ip rule add prio 1 fwmark ${MARK} lookup ${TABLE} > /dev/null 2>&1 57 | ip route replace default via ${GATEWAY} dev ${INTERFACE} table ${TABLE} 58 | ip6tables-save --counters 2>/dev/null | grep -v omr-bypass | ip6tables-restore -w --counters 2>/dev/null 59 | ip6tables-restore -w --wait=60 --noflush <<-EOF 60 | *mangle 61 | :omr-bypass - 62 | -A PREROUTING -j omr-bypass 63 | COMMIT 64 | EOF 65 | ip6tables-restore -w --wait=60 --noflush <<-EOF 66 | *mangle 67 | :omr-bypass-local - 68 | -A OUTPUT -m addrtype ! --dst-type LOCAL -j omr-bypass-local 69 | COMMIT 70 | EOF 71 | ip6tables-restore -w --wait=60 --noflush <<-EOF 72 | *mangle 73 | -A omr-bypass -m set --match-set omr6_dst_bypass_srv_${INTERFACE} dst -j MARK --set-mark ${MARK} 74 | -A omr-bypass -m mark --mark ${MARK} -j RETURN 75 | -A omr-bypass-local -m set --match-set omr6_dst_bypass_srv_${INTERFACE} dst -j MARK --set-mark ${MARK} 76 | -A omr-bypass-local -m mark --mark ${MARK} -j RETURN 77 | COMMIT 78 | EOF 79 | if [ -n "$GATEWAY6" ]; then 80 | ip rule add prio 1 fwmark ${MARK} lookup ${TABLE} > /dev/null 2>&1 81 | ip route replace default via ${GATEWAY6} dev ${INTERFACE} table ${TABLE} 82 | fi -------------------------------------------------------------------------------- /v2ray-server.json: -------------------------------------------------------------------------------- 1 | { 2 | "log": { 3 | "loglevel": "error", 4 | "error": "/tmp/v2rayError.log" 5 | }, 6 | "transport": { 7 | "tcpSettings": {}, 8 | "wsSettings": {}, 9 | "kcpSettings": { 10 | "mtu": 1460, 11 | "tti": 10, 12 | "uplinkCapacity": 100, 13 | "downlinkCapacity": 100, 14 | "congestion": false, 15 | "readBufferSize": 8, 16 | "writeBufferSize": 8 17 | } 18 | }, 19 | "inbounds": [ 20 | { 21 | "tag": "omrin-tunnel", 22 | "port": 65228, 23 | "protocol": "vless", 24 | "settings": { 25 | "decryption": "none", 26 | "clients": [ 27 | { 28 | "id": "V2RAY_UUID", 29 | "level": 0, 30 | "alterId": 0, 31 | "email": "openmptcprouter" 32 | } 33 | ] 34 | }, 35 | "streamSettings": { 36 | "sockopt": { 37 | "mptcp": true, 38 | "mark": 0 39 | }, 40 | "network": "tcp", 41 | "security": "tls", 42 | "tlsSettings": { 43 | "certificates": [ 44 | { 45 | "certificateFile": "/etc/openvpn/ca/pki/issued/server.crt", 46 | "keyFile": "/etc/openvpn/ca/pki/private/server.key" 47 | } 48 | ] 49 | } 50 | } 51 | }, 52 | { 53 | "tag": "omrin-vmess-tunnel", 54 | "port": 65230, 55 | "protocol": "vmess", 56 | "settings": { 57 | "decryption": "none", 58 | "clients": [ 59 | { 60 | "id": "V2RAY_UUID", 61 | "level": 0, 62 | "alterId": 0, 63 | "email": "openmptcprouter" 64 | } 65 | ] 66 | }, 67 | "streamSettings": { 68 | "sockopt": { 69 | "mptcp": true, 70 | "mark": 0 71 | }, 72 | "network": "tcp", 73 | "security": "tls", 74 | "tlsSettings": { 75 | "certificates": [ 76 | { 77 | "certificateFile": "/etc/openvpn/ca/pki/issued/server.crt", 78 | "keyFile": "/etc/openvpn/ca/pki/private/server.key" 79 | } 80 | ] 81 | } 82 | } 83 | }, 84 | { 85 | "tag": "omrin-socks-tunnel", 86 | "port": 65231, 87 | "protocol": "socks", 88 | "settings": { 89 | "auth": "password", 90 | "accounts": [ 91 | { 92 | "pass": "V2RAY_UUID", 93 | "user": "openmptcprouter" 94 | } 95 | ] 96 | }, 97 | "streamSettings": { 98 | "sockopt": { 99 | "mptcp": true, 100 | "mark": 0 101 | }, 102 | "network": "tcp", 103 | "security": "tls", 104 | "tlsSettings": { 105 | "certificates": [ 106 | { 107 | "certificateFile": "/etc/openvpn/ca/pki/issued/server.crt", 108 | "keyFile": "/etc/openvpn/ca/pki/private/server.key" 109 | } 110 | ] 111 | } 112 | } 113 | }, 114 | { 115 | "tag": "omrin-trojan-tunnel", 116 | "port": 65229, 117 | "protocol": "trojan", 118 | "settings": { 119 | "clients": [ 120 | { 121 | "password": "V2RAY_UUID", 122 | "email": "openmptcprouter", 123 | "level": 0 124 | } 125 | ] 126 | }, 127 | "streamSettings": { 128 | "sockopt": { 129 | "mptcp": true, 130 | "mark": 0 131 | }, 132 | "network": "tcp", 133 | "security": "tls", 134 | "tlsSettings": { 135 | "certificates": [ 136 | { 137 | "certificateFile": "/etc/openvpn/ca/pki/issued/server.crt", 138 | "keyFile": "/etc/openvpn/ca/pki/private/server.key" 139 | } 140 | ] 141 | } 142 | } 143 | }, 144 | { 145 | "listen": "127.0.0.1", 146 | "port": 10085, 147 | "protocol": "dokodemo-door", 148 | "settings": { 149 | "address": "127.0.0.1" 150 | }, 151 | "tag": "api" 152 | } 153 | ], 154 | "outbounds": [ 155 | { 156 | "protocol": "freedom", 157 | "settings": { 158 | "userLevel": 0 159 | }, 160 | "tag": "direct" 161 | } 162 | ], 163 | "routing": { 164 | "rules": [ 165 | { 166 | "type": "field", 167 | "inboundTag": [ 168 | "omrin-tunnel", 169 | "omrin-vmess-tunnel", 170 | "omrin-socks-tunnel", 171 | "omrin-trojan-tunnel" 172 | ], 173 | "outboundTag": "OMRLan", 174 | "domain": [ 175 | "full:omr.lan" 176 | ] 177 | }, 178 | { 179 | "inboundTag": [ 180 | "api" 181 | ], 182 | "outboundTag": "api", 183 | "type": "field" 184 | } 185 | ] 186 | }, 187 | "reverse": { 188 | "portals": [ 189 | { 190 | "tag": "OMRLan", 191 | "domain": "omr.lan" 192 | } 193 | ] 194 | }, 195 | "stats": {}, 196 | "api": { 197 | "tag": "api", 198 | "services": [ 199 | "HandlerService", 200 | "LoggerService", 201 | "StatsService" 202 | ] 203 | }, 204 | "policy": { 205 | "levels": { 206 | "0": { 207 | "uplinkOnly": 0, 208 | "downlinkOnly": 0, 209 | "bufferSize": 512, 210 | "connIdle": 2400, 211 | "statsUserUplink": true, 212 | "statsUserDownlink": true 213 | } 214 | }, 215 | "system": { 216 | "statsInboundUplink": true, 217 | "statsInboundDownlink": true 218 | } 219 | } 220 | } 221 | -------------------------------------------------------------------------------- /xray-server.json: -------------------------------------------------------------------------------- 1 | { 2 | "log": { 3 | "loglevel": "error", 4 | "error": "/tmp/xrayError.log" 5 | }, 6 | "inbounds": [ 7 | { 8 | "tag": "omrin-tunnel", 9 | "port": 65248, 10 | "protocol": "vless", 11 | "settings": { 12 | "decryption": "none", 13 | "clients": [ 14 | { 15 | "id": "V2RAY_UUID", 16 | "level": 0, 17 | "alterId": 0, 18 | "email": "openmptcprouter" 19 | } 20 | ] 21 | }, 22 | "streamSettings": { 23 | "sockopt": { 24 | "tcpMptcp": true, 25 | "mark": 0 26 | }, 27 | "network": "tcp", 28 | "security": "tls", 29 | "tlsSettings": { 30 | "certificates": [ 31 | { 32 | "certificateFile": "/etc/openvpn/ca/pki/issued/server.crt", 33 | "keyFile": "/etc/openvpn/ca/pki/private/server.key" 34 | } 35 | ] 36 | } 37 | } 38 | }, 39 | { 40 | "tag": "omrin-vmess-tunnel", 41 | "port": 65250, 42 | "protocol": "vmess", 43 | "settings": { 44 | "decryption": "none", 45 | "clients": [ 46 | { 47 | "id": "V2RAY_UUID", 48 | "level": 0, 49 | "alterId": 0, 50 | "email": "openmptcprouter" 51 | } 52 | ] 53 | }, 54 | "streamSettings": { 55 | "sockopt": { 56 | "tcpMptcp": true, 57 | "mark": 0 58 | }, 59 | "network": "tcp", 60 | "security": "tls", 61 | "tlsSettings": { 62 | "certificates": [ 63 | { 64 | "certificateFile": "/etc/openvpn/ca/pki/issued/server.crt", 65 | "keyFile": "/etc/openvpn/ca/pki/private/server.key" 66 | } 67 | ] 68 | } 69 | } 70 | }, 71 | { 72 | "tag": "omrin-socks-tunnel", 73 | "port": 65251, 74 | "protocol": "socks", 75 | "settings": { 76 | "auth": "password", 77 | "accounts": [ 78 | { 79 | "pass": "V2RAY_UUID", 80 | "user": "openmptcprouter" 81 | } 82 | ] 83 | }, 84 | "streamSettings": { 85 | "sockopt": { 86 | "tcpMptcp": true, 87 | "mark": 0 88 | }, 89 | "network": "tcp", 90 | "security": "tls", 91 | "tlsSettings": { 92 | "certificates": [ 93 | { 94 | "certificateFile": "/etc/openvpn/ca/pki/issued/server.crt", 95 | "keyFile": "/etc/openvpn/ca/pki/private/server.key" 96 | } 97 | ] 98 | } 99 | } 100 | }, 101 | { 102 | "tag": "omrin-trojan-tunnel", 103 | "port": 65249, 104 | "protocol": "trojan", 105 | "settings": { 106 | "clients": [ 107 | { 108 | "password": "V2RAY_UUID", 109 | "email": "openmptcprouter", 110 | "level": 0 111 | } 112 | ] 113 | }, 114 | "streamSettings": { 115 | "sockopt": { 116 | "tcpMptcp": true, 117 | "mark": 0 118 | }, 119 | "network": "tcp", 120 | "security": "tls", 121 | "tlsSettings": { 122 | "certificates": [ 123 | { 124 | "certificateFile": "/etc/openvpn/ca/pki/issued/server.crt", 125 | "keyFile": "/etc/openvpn/ca/pki/private/server.key" 126 | } 127 | ] 128 | } 129 | } 130 | }, 131 | { 132 | "tag": "omrin-shadowsocks-tunnel", 133 | "port": 65252, 134 | "protocol": "shadowsocks", 135 | "settings": { 136 | "password": "XRAY_PSK", 137 | "method": "2022-blake3-aes-256-gcm", 138 | "network": "tcp,udp", 139 | "clients": [ 140 | { 141 | "password": "XRAY_UPSK", 142 | "email": "openmptcprouter" 143 | } 144 | ] 145 | }, 146 | "streamSettings": { 147 | "sockopt": { 148 | "tcpMptcp": true, 149 | "mark": 0 150 | }, 151 | "network": "tcp" 152 | } 153 | }, 154 | { 155 | "listen": "127.0.0.1", 156 | "port": 10086, 157 | "protocol": "dokodemo-door", 158 | "settings": { 159 | "address": "127.0.0.1" 160 | }, 161 | "tag": "api" 162 | } 163 | ], 164 | "outbounds": [ 165 | { 166 | "protocol": "freedom", 167 | "settings": { 168 | "userLevel": 0 169 | }, 170 | "tag": "direct" 171 | } 172 | ], 173 | "routing": { 174 | "rules": [ 175 | { 176 | "type": "field", 177 | "inboundTag": [ 178 | "omrin-tunnel", 179 | "omrin-vless-reality", 180 | "omrin-vmess-tunnel", 181 | "omrin-socks-tunnel", 182 | "omrin-trojan-tunnel" 183 | ], 184 | "outboundTag": "OMRLan", 185 | "domain": [ 186 | "full:omr.lan" 187 | ] 188 | }, 189 | { 190 | "inboundTag": [ 191 | "api" 192 | ], 193 | "outboundTag": "api", 194 | "type": "field" 195 | } 196 | ] 197 | }, 198 | "reverse": { 199 | "portals": [ 200 | { 201 | "tag": "OMRLan", 202 | "domain": "omr.lan" 203 | } 204 | ] 205 | }, 206 | "stats": {}, 207 | "api": { 208 | "tag": "api", 209 | "services": [ 210 | "HandlerService", 211 | "LoggerService", 212 | "StatsService" 213 | ] 214 | }, 215 | "policy": { 216 | "levels": { 217 | "0": { 218 | "uplinkOnly": 0, 219 | "downlinkOnly": 0, 220 | "bufferSize": 512, 221 | "connIdle": 2400, 222 | "statsUserUplink": true, 223 | "statsUserDownlink": true 224 | } 225 | }, 226 | "system": { 227 | "statsInboundUplink": true, 228 | "statsInboundDownlink": true 229 | } 230 | } 231 | } 232 | -------------------------------------------------------------------------------- /shorewall6/shorewall6.conf: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # Shorewall Version 5 -- /etc/shorewall6/shorewall6.conf 4 | # 5 | # For information about the settings in this file, type "man shorewall6.conf" 6 | # 7 | # Manpage also online at 8 | # http://www.shorewall.net/manpages6/shorewall6.conf.html 9 | ############################################################################### 10 | # S T A R T U P E N A B L E D 11 | ############################################################################### 12 | 13 | STARTUP_ENABLED=Yes 14 | 15 | ############################################################################### 16 | # V E R B O S I T Y 17 | ############################################################################### 18 | 19 | VERBOSITY=1 20 | 21 | ############################################################################### 22 | # P A G E R 23 | ############################################################################### 24 | 25 | PAGER= 26 | 27 | ############################################################################### 28 | # F I R E W A L L 29 | ############################################################################### 30 | 31 | FIREWALL= 32 | 33 | ############################################################################### 34 | # L O G G I N G 35 | ############################################################################### 36 | 37 | BLACKLIST_LOG_LEVEL= 38 | 39 | INVALID_LOG_LEVEL= 40 | 41 | LOG_BACKEND= 42 | 43 | LOG_VERBOSITY=2 44 | 45 | LOGALLNEW= 46 | 47 | LOGFILE=/var/log/messages 48 | 49 | LOGFORMAT="Shorewall:%s:%s:" 50 | 51 | LOGLIMIT= 52 | 53 | LOGTAGONLY=No 54 | 55 | MACLIST_LOG_LEVEL=info 56 | 57 | RELATED_LOG_LEVEL= 58 | 59 | RPFILTER_LOG_LEVEL=info 60 | 61 | SFILTER_LOG_LEVEL=info 62 | 63 | SMURF_LOG_LEVEL=info 64 | 65 | STARTUP_LOG=/var/log/shorewall6-init.log 66 | 67 | TCP_FLAGS_LOG_LEVEL=info 68 | 69 | UNTRACKED_LOG_LEVEL= 70 | 71 | ############################################################################### 72 | # L O C A T I O N O F F I L E S A N D D I R E C T O R I E S 73 | ############################################################################### 74 | 75 | CONFIG_PATH="${CONFDIR}/shorewall6:/usr/share/shorewall6:${SHAREDIR}/shorewall" 76 | 77 | GEOIPDIR=/usr/share/xt_geoip/LE 78 | 79 | IP6TABLES= 80 | 81 | IP= 82 | 83 | IPSET= 84 | 85 | LOCKFILE= 86 | 87 | MODULESDIR= 88 | 89 | NFACCT= 90 | 91 | PERL=/usr/bin/perl 92 | 93 | PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin" 94 | 95 | RESTOREFILE=restore 96 | 97 | SHOREWALL_SHELL=/bin/sh 98 | 99 | SUBSYSLOCK="" 100 | 101 | TC= 102 | 103 | ############################################################################### 104 | # D E F A U L T A C T I O N S / M A C R O S 105 | ############################################################################### 106 | 107 | ACCEPT_DEFAULT=none 108 | BLACKLIST_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" 109 | DROP_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" 110 | NFQUEUE_DEFAULT=none 111 | QUEUE_DEFAULT=none 112 | REJECT_DEFAULT="AllowICMPs,Broadcast(DROP),Multicast(DROP)" 113 | 114 | ############################################################################### 115 | # R S H / R C P C O M M A N D S 116 | ############################################################################### 117 | 118 | RCP_COMMAND='scp ${files} ${root}@${system}:${destination}' 119 | RSH_COMMAND='ssh ${root}@${system} ${command}' 120 | 121 | ############################################################################### 122 | # F I R E W A L L O P T I O N S 123 | ############################################################################### 124 | 125 | ACCOUNTING=Yes 126 | 127 | ACCOUNTING_TABLE=filter 128 | 129 | ADMINISABSENTMINDED=Yes 130 | 131 | AUTOCOMMENT=Yes 132 | 133 | AUTOHELPERS=Yes 134 | 135 | AUTOMAKE=No 136 | 137 | BASIC_FILTERS=No 138 | 139 | BLACKLIST="ALL" 140 | 141 | #CHAIN_SCRIPTS=Yes 142 | 143 | CLAMPMSS=No 144 | 145 | CLEAR_TC=No 146 | 147 | COMPLETE=No 148 | 149 | DEFER_DNS_RESOLUTION=Yes 150 | 151 | DELETE_THEN_ADD=Yes 152 | 153 | DONT_LOAD= 154 | 155 | DYNAMIC_BLACKLIST=Yes 156 | 157 | EXPAND_POLICIES=Yes 158 | 159 | EXPORTMODULES=Yes 160 | 161 | FASTACCEPT=No 162 | 163 | FORWARD_CLEAR_MARK=Yes 164 | 165 | HELPERS= 166 | 167 | IGNOREUNKNOWNVARIABLES=No 168 | 169 | IMPLICIT_CONTINUE=No 170 | 171 | #INLINE_MATCHES=No 172 | 173 | IPSET_WARNINGS=Yes 174 | 175 | IP_FORWARDING=On 176 | 177 | KEEP_RT_TABLES=Yes 178 | 179 | #LOAD_HELPERS_ONLY=Yes 180 | 181 | MACLIST_TABLE=filter 182 | 183 | MACLIST_TTL= 184 | 185 | MANGLE_ENABLED=Yes 186 | 187 | MARK_IN_FORWARD_CHAIN=No 188 | 189 | MODULE_SUFFIX=ko 190 | 191 | MUTEX_TIMEOUT=60 192 | 193 | OPTIMIZE=1 194 | 195 | OPTIMIZE_ACCOUNTING=No 196 | 197 | REJECT_ACTION= 198 | 199 | REQUIRE_INTERFACE=No 200 | 201 | RESTART=restart 202 | 203 | RESTORE_ROUTEMARKS=Yes 204 | 205 | SAVE_IPSETS=No 206 | 207 | TC_ENABLED=No 208 | 209 | TC_EXPERT=No 210 | 211 | TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2" 212 | 213 | TRACK_PROVIDERS=No 214 | 215 | TRACK_RULES=No 216 | 217 | USE_DEFAULT_RT=Yes 218 | 219 | USE_PHYSICAL_NAMES=No 220 | 221 | USE_RT_NAMES=No 222 | 223 | VERBOSE_MESSAGES=Yes 224 | 225 | WARNOLDCAPVERSION=Yes 226 | 227 | WORKAROUNDS=No 228 | 229 | ZERO_MARKS=No 230 | 231 | ZONE2ZONE=- 232 | 233 | ############################################################################### 234 | # P A C K E T D I S P O S I T I O N 235 | ############################################################################### 236 | 237 | BLACKLIST_DISPOSITION=DROP 238 | 239 | INVALID_DISPOSITION=CONTINUE 240 | 241 | MACLIST_DISPOSITION=REJECT 242 | 243 | RELATED_DISPOSITION=ACCEPT 244 | 245 | SFILTER_DISPOSITION=DROP 246 | 247 | RPFILTER_DISPOSITION=DROP 248 | 249 | SMURF_DISPOSITION=DROP 250 | 251 | TCP_FLAGS_DISPOSITION=DROP 252 | 253 | UNTRACKED_DISPOSITION=CONTINUE 254 | 255 | ################################################################################ 256 | # P A C K E T M A R K L A Y O U T 257 | ################################################################################ 258 | 259 | TC_BITS= 260 | 261 | PROVIDER_BITS= 262 | 263 | PROVIDER_OFFSET= 264 | 265 | MASK_BITS= 266 | 267 | ZONE_BITS=0 268 | 269 | #LAST LINE -- DO NOT REMOVE 270 | -------------------------------------------------------------------------------- /shorewall4/shorewall.conf: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # Shorewall Version 5 -- /etc/shorewall/shorewall.conf 4 | # 5 | # For information about the settings in this file, type "man shorewall.conf" 6 | # 7 | # Manpage also online at http://www.shorewall.net/manpages/shorewall.conf.html 8 | ############################################################################### 9 | # S T A R T U P E N A B L E D 10 | ############################################################################### 11 | 12 | STARTUP_ENABLED=Yes 13 | 14 | ############################################################################### 15 | # V E R B O S I T Y 16 | ############################################################################### 17 | 18 | VERBOSITY=1 19 | 20 | ############################################################################### 21 | # P A G E R 22 | ############################################################################### 23 | 24 | PAGER= 25 | 26 | ############################################################################### 27 | # F I R E W A L L 28 | ############################################################################### 29 | 30 | FIREWALL= 31 | 32 | ############################################################################### 33 | # L O G G I N G 34 | ############################################################################### 35 | 36 | BLACKLIST_LOG_LEVEL= 37 | 38 | INVALID_LOG_LEVEL= 39 | 40 | LOG_BACKEND= 41 | 42 | LOG_MARTIANS=No 43 | 44 | LOG_VERBOSITY=2 45 | 46 | LOGALLNEW= 47 | 48 | LOGFILE=/var/log/messages 49 | 50 | LOGFORMAT="Shorewall:%s:%s:" 51 | 52 | LOGTAGONLY=No 53 | 54 | LOGLIMIT= 55 | 56 | MACLIST_LOG_LEVEL=info 57 | 58 | RELATED_LOG_LEVEL= 59 | 60 | RPFILTER_LOG_LEVEL=info 61 | 62 | SFILTER_LOG_LEVEL=info 63 | 64 | SMURF_LOG_LEVEL=info 65 | 66 | STARTUP_LOG=/var/log/shorewall-init.log 67 | 68 | TCP_FLAGS_LOG_LEVEL=info 69 | 70 | UNTRACKED_LOG_LEVEL= 71 | 72 | ############################################################################### 73 | # L O C A T I O N O F F I L E S A N D D I R E C T O R I E S 74 | ############################################################################### 75 | 76 | ARPTABLES= 77 | 78 | CONFIG_PATH="${CONFDIR}/shorewall:${SHAREDIR}/shorewall" 79 | 80 | GEOIPDIR=/usr/share/xt_geoip/LE 81 | 82 | IPTABLES= 83 | 84 | IP= 85 | 86 | IPSET= 87 | 88 | LOCKFILE= 89 | 90 | MODULESDIR= 91 | 92 | NFACCT= 93 | 94 | PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin" 95 | 96 | PERL=/usr/bin/perl 97 | 98 | RESTOREFILE=restore 99 | 100 | SHOREWALL_SHELL=/bin/sh 101 | 102 | SUBSYSLOCK="" 103 | 104 | TC= 105 | 106 | ############################################################################### 107 | # D E F A U L T A C T I O N S / M A C R O S 108 | ############################################################################### 109 | 110 | ACCEPT_DEFAULT=none 111 | BLACKLIST_DEFAULT="Broadcast(DROP),Multicast(DROP),dropNotSyn:$LOG_LEVEL,dropInvalid:$LOG_LEVEL,DropDNSrep:$LOG_LEVEL" 112 | DROP_DEFAULT="Broadcast(DROP),Multicast(DROP)" 113 | NFQUEUE_DEFAULT=none 114 | QUEUE_DEFAULT=none 115 | REJECT_DEFAULT="Broadcast(DROP),Multicast(DROP)" 116 | 117 | ############################################################################### 118 | # R S H / R C P C O M M A N D S 119 | ############################################################################### 120 | 121 | RCP_COMMAND='scp ${files} ${root}@${system}:${destination}' 122 | RSH_COMMAND='ssh ${root}@${system} ${command}' 123 | 124 | ############################################################################### 125 | # F I R E W A L L O P T I O N S 126 | ############################################################################### 127 | 128 | ACCOUNTING=Yes 129 | 130 | ACCOUNTING_TABLE=filter 131 | 132 | ADD_IP_ALIASES=No 133 | 134 | ADD_SNAT_ALIASES=No 135 | 136 | ADMINISABSENTMINDED=Yes 137 | 138 | AUTOCOMMENT=Yes 139 | 140 | AUTOHELPERS=Yes 141 | 142 | AUTOMAKE=No 143 | 144 | BASIC_FILTERS=No 145 | 146 | BLACKLIST="ALL" 147 | 148 | #CHAIN_SCRIPTS=Yes 149 | 150 | CLAMPMSS=No 151 | 152 | CLEAR_TC=No 153 | 154 | COMPLETE=No 155 | 156 | DEFER_DNS_RESOLUTION=Yes 157 | 158 | DELETE_THEN_ADD=No 159 | 160 | DETECT_DNAT_IPADDRS=No 161 | 162 | DISABLE_IPV6=No 163 | 164 | DOCKER=No 165 | 166 | DONT_LOAD= 167 | 168 | DYNAMIC_BLACKLIST=Yes 169 | 170 | EXPAND_POLICIES=Yes 171 | 172 | EXPORTMODULES=Yes 173 | 174 | FASTACCEPT=No 175 | 176 | FORWARD_CLEAR_MARK= 177 | 178 | HELPERS= 179 | 180 | IGNOREUNKNOWNVARIABLES=No 181 | 182 | IMPLICIT_CONTINUE=No 183 | 184 | #INLINE_MATCHES=No 185 | 186 | IPSET_WARNINGS=Yes 187 | 188 | IP_FORWARDING=On 189 | 190 | KEEP_RT_TABLES=No 191 | 192 | #LOAD_HELPERS_ONLY=Yes 193 | 194 | MACLIST_TABLE=filter 195 | 196 | MACLIST_TTL= 197 | 198 | MANGLE_ENABLED=Yes 199 | 200 | #MAPOLDACTIONS=No 201 | 202 | MARK_IN_FORWARD_CHAIN=No 203 | 204 | MINIUPNPD=No 205 | 206 | #MODULE_SUFFIX=ko 207 | 208 | MULTICAST=No 209 | 210 | MUTEX_TIMEOUT=60 211 | 212 | NULL_ROUTE_RFC1918=No 213 | 214 | OPTIMIZE=0 215 | 216 | OPTIMIZE_ACCOUNTING=No 217 | 218 | REJECT_ACTION= 219 | 220 | REQUIRE_INTERFACE=No 221 | 222 | RESTART=restart 223 | 224 | RESTORE_DEFAULT_ROUTE=Yes 225 | 226 | RESTORE_ROUTEMARKS=Yes 227 | 228 | RETAIN_ALIASES=No 229 | 230 | ROUTE_FILTER=Yes 231 | 232 | SAVE_ARPTABLES=No 233 | 234 | SAVE_IPSETS=No 235 | 236 | TC_ENABLED=No 237 | 238 | TC_EXPERT=No 239 | 240 | TC_PRIOMAP="2 3 3 3 2 3 1 1 2 2 2 2 2 2 2 2" 241 | 242 | TRACK_PROVIDERS=No 243 | 244 | TRACK_RULES=No 245 | 246 | USE_DEFAULT_RT=Yes 247 | 248 | USE_PHYSICAL_NAMES=No 249 | 250 | USE_RT_NAMES=No 251 | 252 | VERBOSE_MESSAGES=Yes 253 | 254 | WARNOLDCAPVERSION=Yes 255 | 256 | WORKAROUNDS=No 257 | 258 | ZERO_MARKS=No 259 | 260 | ZONE2ZONE=- 261 | 262 | ############################################################################### 263 | # P A C K E T D I S P O S I T I O N 264 | ############################################################################### 265 | 266 | BLACKLIST_DISPOSITION=DROP 267 | 268 | INVALID_DISPOSITION=CONTINUE 269 | 270 | MACLIST_DISPOSITION=REJECT 271 | 272 | RELATED_DISPOSITION=ACCEPT 273 | 274 | RPFILTER_DISPOSITION=DROP 275 | 276 | SMURF_DISPOSITION=DROP 277 | 278 | SFILTER_DISPOSITION=DROP 279 | 280 | TCP_FLAGS_DISPOSITION=DROP 281 | 282 | UNTRACKED_DISPOSITION=CONTINUE 283 | 284 | ################################################################################ 285 | # P A C K E T M A R K L A Y O U T 286 | ################################################################################ 287 | 288 | TC_BITS= 289 | 290 | PROVIDER_BITS= 291 | 292 | PROVIDER_OFFSET= 293 | 294 | MASK_BITS= 295 | 296 | ZONE_BITS=0 297 | -------------------------------------------------------------------------------- /multipath: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Update the MP-TCP flags without the pached iproute2 4 | # 5 | # Author: Mario Krueger 6 | # Released under GPL 3 or later 7 | 8 | if [ -d "/proc/sys/net/mptcp" ]; then 9 | 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 10 | echo "MPTCP is disabled!" 11 | exit 1 12 | fi 13 | else 14 | echo "Your device don't support multipath-TCP." 15 | echo "You have to install the pached kernel to use MPTCP." 16 | echo "See http://multipath-tcp.org/ for details" 17 | exit 1 18 | fi 19 | 20 | case $1 in 21 | "-h") 22 | echo " Multipath-TCP configuration tool" 23 | echo "show/update flags:" 24 | echo " multipath [device]" 25 | echo " multipath device {on | off | backup | handover}" 26 | echo 27 | echo "show established conections: -c" 28 | echo "show fullmesh info: -f" 29 | echo "show kernel config: -k" 30 | echo 31 | echo "Flag on the device, to enable/disable MPTCP for this interface. The backup-flag" 32 | echo "will allow a subflow to be established across this interface, but only be used" 33 | echo "as backup. Handover-flag indicates that his interface is not used at all (even " 34 | echo "no subflow being established), as long as there are other interfaces available." 35 | echo "See http://multipath-tcp.org/ for details" 36 | echo 37 | exit 0 ;; 38 | "-c") 39 | cat /proc/net/mptcp_net/mptcp 40 | exit 0;; 41 | "-f") 42 | cat /proc/net/mptcp_fullmesh 43 | exit 0;; 44 | "-k") 45 | if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then 46 | echo Enabled: `cat /proc/sys/net/mptcp/mptcp_enabled` 47 | elif [ -f /proc/sys/net/mptcp/enabled ]; then 48 | echo Enabled: `cat /proc/sys/net/mptcp/enabled` 49 | fi 50 | if [ -f /proc/sys/net/mptcp/mptcp_path_manager ]; then 51 | echo Path Manager: `cat /proc/sys/net/mptcp/mptcp_path_manager` 52 | fi 53 | if [ -f /proc/sys/net/mptcp/mptcp_checksum ]; then 54 | echo Use checksum: `cat /proc/sys/net/mptcp/mptcp_checksum` 55 | else 56 | echo Use checksum: `cat /proc/sys/net/mptcp/checksum_enabled` 57 | fi 58 | if [ -f /proc/sys/net/mptcp/mptcp_scheduler ]; then 59 | echo Scheduler: `cat /proc/sys/net/mptcp/mptcp_scheduler` 60 | fi 61 | if [ -f /proc/sys/net/mptcp/mptcp_syn_retries ]; then 62 | echo Syn retries: `cat /proc/sys/net/mptcp/mptcp_syn_retries` 63 | fi 64 | if [ -f /proc/sys/net/mptcp/mptcp_debug ]; then 65 | echo Debugmode: `cat /proc/sys/net/mptcp/mptcp_debug` 66 | fi 67 | echo 68 | echo See http://multipath-tcp.org/ for details 69 | exit 0 ;; 70 | "") 71 | for ifpath in /sys/class/net/*; do 72 | $0 ${ifpath##*/} 73 | done 74 | exit 0;; 75 | *);; 76 | esac 77 | 78 | DEVICE="$1" 79 | TYPE="$2" 80 | #FLAG_PATH=`find /sys/devices/ -path "*/net/$DEVICE/flags"` 81 | 82 | [ -d "/sys/class/net/$DEVICE/" ] || { 83 | #echo "Device '$DEVICE' can't found!" 84 | #echo "Use the hardware name like in ifconfig" 85 | exit 1 86 | } 87 | 88 | if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then 89 | FLAG_PATH="/sys/class/net/$DEVICE/flags" 90 | IFF=`cat $FLAG_PATH` 91 | 92 | IFF_OFF="0x80000" 93 | IFF_ON="0x00" 94 | IFF_BACKUP="0x100000" 95 | IFF_HANDOVER="0x200000" 96 | IFF_MASK="0x380000" 97 | 98 | case $TYPE in 99 | "off") FLAG=$IFF_OFF;; 100 | "on") FLAG=$IFF_ON;; 101 | "backup") FLAG=$IFF_BACKUP;; 102 | "handover") FLAG=$IFF_HANDOVER;; 103 | "") 104 | IFF=`printf "0x%02x" $(($IFF&$IFF_MASK))` 105 | case "$IFF" in 106 | $IFF_OFF) echo $DEVICE is deactivated;; 107 | $IFF_ON) echo $DEVICE is in default mode;; 108 | $IFF_BACKUP) echo $DEVICE is in backup mode;; 109 | $IFF_HANDOVER) echo $DEVICE is in handover mode;; 110 | *) echo "Unkown state!" && exit 1;; 111 | esac 112 | exit 0;; 113 | *) echo "Unkown flag! Use 'multipath -h' for help" && exit 1;; 114 | esac 115 | 116 | printf "0x%02x" $(($(($IFF^$(($IFF&$IFF_MASK))))|$FLAG)) > $FLAG_PATH 117 | else 118 | ID=$(ip mptcp endpoint show | grep -m 1 "dev $DEVICE" | awk '{print $3}') 119 | IFF=$(ip mptcp endpoint show | grep -m 1 "dev $DEVICE" | awk '{print $4}') 120 | #IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p') 121 | [ -f /usr/bin/jsonfilter ] && IP=$(ip -j a show $DEVICE | jsonfilter -e '@[0].addr_info[*].local') 122 | [ -f /usr/bin/jq ] && IP=$(ip -j a show $DEVICE | jq -r '.[0].addr_info[].local') 123 | RMID=$(ip mptcp endpoint show | grep '::ffff' | awk '{ print $3 }') 124 | [ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null 125 | case $TYPE in 126 | "off") 127 | [ -n "$ID" ] && { 128 | for i in $ID; do 129 | ip mptcp endpoint delete id $i 2>&1 >/dev/null 130 | done 131 | } 132 | exit 0;; 133 | "on") 134 | [ -n "$ID" ] && { 135 | for i in $ID; do 136 | ip mptcp endpoint delete id $i 2>&1 >/dev/null 137 | done 138 | } 139 | for i in $IP; do 140 | ip mptcp endpoint add $i dev $DEVICE subflow fullmesh 141 | done 142 | exit 0;; 143 | "signal") 144 | [ -n "$ID" ] && { 145 | for i in $ID; do 146 | ip mptcp endpoint delete id $i 2>&1 >/dev/null 147 | done 148 | } 149 | for i in $IP; do 150 | ip mptcp endpoint add $i dev $DEVICE signal 151 | done 152 | exit 0;; 153 | "backup") 154 | [ -n "$ID" ] && { 155 | for i in $ID; do 156 | ip mptcp endpoint delete id $i 2>&1 >/dev/null 157 | done 158 | } 159 | for i in $IP; do 160 | ip mptcp endpoint add $i dev $DEVICE backup fullmesh 161 | done 162 | exit 0;; 163 | "") 164 | case "$IFF" in 165 | "") echo $DEVICE is deactivated;; 166 | "subflow") echo $DEVICE is in default mode;; 167 | "backup") echo $DEVICE is in backup mode;; 168 | "signal") echo $DEVICE is in signal mode;; 169 | "fullmesh") echo $DEVICE is in fullmesh mode;; 170 | *) echo "$DEVICE Unkown state!" && exit 1;; 171 | esac 172 | exit 0;; 173 | *) echo "Unkown flag! Use 'multipath -h' for help" && exit 1;; 174 | esac 175 | 176 | fi 177 | 178 | -------------------------------------------------------------------------------- /omr-service: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # OpenMPTCProuter VPS service script 3 | 4 | _multipath() { 5 | # Force multipath status 6 | source /etc/shorewall/params.net 7 | for intf in `ls -1 /sys/class/net`; do 8 | if [ "$intf" != "bonding_masters" ]; then 9 | 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 10 | [ -f /proc/sys/net/mptcp/mptcp_enabled ] && [ "$(multipath $intf | tr -d '\n')" != "$intf is in default mode" ] && multipath $intf on >/dev/null 2>&1 11 | [ -f /proc/sys/net/mptcp/enabled ] && [ "$(multipath $intf | tr -d '\n')" != "$intf is in signal mode" ] && { 12 | multipath $intf signal >/dev/null 2>&1 13 | ip mptcp limits set subflows 8 add_addr_accepted 8 >/dev/null 2>&1 14 | } 15 | else 16 | [ "$(multipath $intf | tr -d '\n')" != "$intf is deactivated" ] && multipath $intf off >/dev/null 2>&1 17 | fi 18 | fi 19 | done 20 | } 21 | 22 | _glorytun_udp() { 23 | #if [ -n "$(systemctl -a | grep 'glorytun-udp')" ]; then 24 | if systemctl list-unit-files glorytun-udp@.service >/dev/null; then 25 | [ -z "$(glorytun show dev gt-udp-tun0 2>/dev/null | grep tunnel)" ] && { 26 | logger -t "OMR-Service" "Restart Glorytun-UDP" 27 | systemctl -q restart 'glorytun-udp@*' 28 | sleep 10 29 | } 30 | if [ -z "$(pgrep post.sh)" ]; then 31 | for intf in /etc/glorytun-udp/tun*; do 32 | [ "$(echo $intf | grep key)" = "" ] && /etc/glorytun-udp/post.sh ${intf} & 33 | done 34 | #ip link set mtu 9000 dev gt-udp-tun0 >/dev/null 2>&1 35 | fi 36 | fi 37 | } 38 | 39 | _glorytun_tcp() { 40 | #if [ -n "$(systemctl -a | grep 'glorytun-tcp')" ]; then 41 | if systemctl list-unit-files glorytun-tcp@.service >/dev/null; then 42 | for intf in /etc/glorytun-tcp/tun*; do 43 | [ "$(echo $intf | grep key)" = "" ] && timeout 10 /etc/glorytun-tcp/post.sh ${intf} 44 | done 45 | if [ -f /etc/openmptcprouter-vps-admin/current-vpn ] && [ "$(cat /etc/openmptcprouter-vps-admin/current-vpn)" = "glorytun_tcp" ]; then 46 | localip="$(cat /etc/glorytun-tcp/tun0 | grep LOCALIP | cut -d '=' -f2)" 47 | [ -z "$localip" ] && localip="10.255.255.1" 48 | remoteip="$(echo $localip | sed 's/\.1/\.2/')" 49 | if [ "$(ping -c 6 -w 50 $remoteip | grep '100%')" != "" ] && ([ -z "$(pgrep glorytun-tcp)" ] || [ "$(expr $(date +%s) - $(stat -c %Y /proc/$(pgrep glorytun-tcp)/exe ))" -gt "600" ]); then 50 | logger -t "OMR-Service" "No answer from VPN client end, restart Glorytun-TCP" 51 | systemctl restart glorytun-tcp@tun0 52 | sleep 10 53 | fi 54 | fi 55 | #ip link set mtu 9000 dev gt-tun0 >/dev/null 2>&1 56 | fi 57 | } 58 | 59 | _dsvpn() { 60 | #if [ -n "$(systemctl -a | grep 'dsvpn')" ]; then 61 | if systemctl list-unit-files dsvpn-server@.service >/dev/null; then 62 | [ -n "$(ip -6 r show 64:ff9b::/96 dev dsvpn0)" ] && ip -6 r del 64:ff9b::/96 dev dsvpn0 >/dev/null 2>&1 63 | if [ -f /etc/openmptcprouter-vps-admin/current-vpn ] && [ "$(cat /etc/openmptcprouter-vps-admin/current-vpn)" = "dsvpn" ]; then 64 | localip="$(cat /etc/dsvpn/dsvpn0 | grep LOCALTUNIP | cut -d '=' -f2)" 65 | [ -z "$localip" ] && localip="10.255.251.1" 66 | remoteip="$(echo $localip | sed 's/\.1/\.2/')" 67 | if [ "$(ping -c 5 -w 5 $remoteip | grep '100%')" != "" ] && [ "$(expr $(date +%s) - $(stat -c %Y /proc/$(pgrep dsvpn)/exe ))" -gt "300" ]; then 68 | logger -t "OMR-Service" "No answer from VPN client end, restart DSVPN" 69 | systemctl restart dsvpn-server@dsvpn0 70 | fi 71 | #ip link set mtu 9000 dev dsvpn0 >/dev/null 2>&1 72 | fi 73 | fi 74 | } 75 | 76 | _softethervpn() { 77 | if systemctl list-unit-files softether-vpnserver.service >/dev/null; then 78 | if [ -z "$(ip a show dev tap_softether | grep '10.255.210.1')" ]; then 79 | ip a add 10.255.210.1/24 dev tap_softether >/dev/null 2>&1 80 | ip link set promisc on tap_softether >/dev/null 2>&1 81 | fi 82 | fi 83 | } 84 | 85 | _shadowsocks() { 86 | if systemctl list-unit-files shadowsocks-libev-manager@.service >/dev/null; then 87 | [ -z "$(pgrep ss-server)" ] && { 88 | logger -t "OMR-Service" "ss-server not detected, restart Shadowsocks libev" 89 | systemctl restart shadowsocks-libev-manager@manager 90 | } 91 | fi 92 | } 93 | 94 | _shadowsocks_go() { 95 | if systemctl list-unit-files shadowsocks-go.service >/dev/null; then 96 | [ -z "$(pgrep shadowsocks-go)" ] && { 97 | logger -t "OMR-Service" "ss-server not detected, restart Shadowsocks go" 98 | systemctl restart shadowsocks-go 99 | } 100 | fi 101 | } 102 | 103 | _xray() { 104 | if systemctl list-unit-files xray.service >/dev/null; then 105 | [ -z "$(pgrep xray)" ] && { 106 | logger -t "OMR-Service" "ss-server not detected, restart XRay" 107 | systemctl restart xray 108 | } 109 | fi 110 | } 111 | 112 | _v2ray() { 113 | if systemctl list-unit-files v2ray.service >/dev/null; then 114 | [ -z "$(pgrep v2ray)" ] && { 115 | logger -t "OMR-Service" "ss-server not detected, restart V2Ray" 116 | systemctl restart v2ray 117 | } 118 | fi 119 | } 120 | 121 | _wireguard() { 122 | #if [ -n "$(systemctl -a | grep 'wg')" ]; then 123 | if systemctl list-unit-files wg-quick@.service >/dev/null; then 124 | [ -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 125 | [ -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 126 | fi 127 | } 128 | 129 | 130 | _omr_api() { 131 | [ -z "$(pgrep curl)" ] && [ -z "$(curl -s -k -m 30 https://127.0.0.1:65500/)" ] && { 132 | logger -t "OMR-Service" "Can't contact API, restart OMR-Admin" 133 | systemctl -q restart omr-admin 134 | } 135 | } 136 | 137 | _lan_route() { 138 | jq -c '.users[0][]?' /etc/openmptcprouter-vps-admin/omr-admin-config.json | 139 | while IFS=$"\n" read -r c; do 140 | if [ -n "$c" ]; then 141 | vpnremoteip=$(echo "$c" | jq -r '.vpnremoteip') 142 | username=$(echo "$c" | jq -r '.username') 143 | if [ -n "$vpnremoteip" ] && [ "$vpnremoteip" != "null" ]; then 144 | echo "$c" | jq -c -r '.lanips[]? //empty' | 145 | while IFS=$"\n" read -r d; do 146 | if [ "$d" != "" ]; then 147 | network=$(ipcalc -n $d | grep Network | awk '{print $2}') 148 | networkonly=$(ipcalc -n $d | grep Network | awk '{print $2}' | cut -d/ -f1) 149 | netmask=$(ipcalc -n $d | grep Netmask | awk '{print $2}') 150 | [ -n "$network" ] && [ -z "$(ip r show $network via $vpnremoteip)" ] && ip r replace $network via $vpnremoteip >/dev/null 2>&1 151 | [ -n "$networkonly" ] && [ -n "$netmask" ] && ([ ! -f /etc/openvpn/ccd/${username} ] || [ -z "$(grep $networkonly /etc/openvpn/ccd/${username})" ]) && echo "iroute $networkonly $netmask" >> /etc/openvpn/ccd/${username} 152 | fi 153 | done 154 | fi 155 | fi 156 | done 157 | } 158 | 159 | _gre_tunnels() { 160 | . "$(readlink -f "/etc/shorewall/params.vpn")" 161 | if [ -n "$OMR_ADDR" ]; then 162 | for intf in /etc/openmptcprouter-vps-admin/intf/*; do 163 | if [ -f "$intf" ]; then 164 | . "$(readlink -f "$intf")" 165 | iface="$(basename $intf)" 166 | if [ "$(ip tunnel show $iface 2>/dev/null | awk '{print $4}')" != "$OMR_ADDR" ]; then 167 | [ -n "$(ip tunnel show $iface 2>/dev/null)" ] && ip tunnel del $iface >/dev/null 2>&1 168 | ip tunnel add $iface mode gre local $INTFADDR remote $OMR_ADDR >/dev/null 2>&1 169 | ip link set $iface up >/dev/null 2>&1 170 | ip addr add $LOCALIP dev $iface >/dev/null 2>&1 171 | ip route add $NETWORK dev $iface >/dev/null 2>&1 172 | fi 173 | fi 174 | done 175 | fi 176 | } 177 | 178 | _openvpn_bonding() { 179 | 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 180 | echo 0 > /sys/class/net/omr-bonding/bonding/mode >/dev/null 2>&1 181 | ip link set ovpnbonding1 master omr-bonding >/dev/null 2>&1 182 | ip link set ovpnbonding1 up >/dev/null 2>&1 183 | ip link set ovpnbonding2 master omr-bonding >/dev/null 2>&1 184 | ip link set ovpnbonding2 up >/dev/null 2>&1 185 | ip link set ovpnbonding3 master omr-bonding >/dev/null 2>&1 186 | ip link set ovpnbonding3 up >/dev/null 2>&1 187 | ip link set ovpnbonding4 master omr-bonding >/dev/null 2>&1 188 | ip link set ovpnbonding4 up >/dev/null 2>&1 189 | ip link set ovpnbonding5 master omr-bonding >/dev/null 2>&1 190 | ip link set ovpnbonding5 up >/dev/null 2>&1 191 | ip link set ovpnbonding6 master omr-bonding >/dev/null 2>&1 192 | ip link set ovpnbonding6 up >/dev/null 2>&1 193 | ip link set ovpnbonding7 master omr-bonding >/dev/null 2>&1 194 | ip link set ovpnbonding7 up >/dev/null 2>&1 195 | ip link set ovpnbonding8 master omr-bonding >/dev/null 2>&1 196 | ip link set ovpnbonding8 up >/dev/null 2>&1 197 | ip link set omr-bonding up mtu 1440 >/dev/null 2>&1 198 | ip a add 10.255.248.1 dev omr-bonding >/dev/null 2>&1 199 | ip r add 10.255.248.0/24 dev omr-bonding >/dev/null 2>&1 200 | ip r add 10.255.248.2 dev omr-bonding src 10.255.248.1 >/dev/null 2>&1 201 | fi 202 | } 203 | 204 | _vpn1() { 205 | vpn1route=$(ip r show dev vpn1 2>/dev/null | grep '0.0.0.0') 206 | [ -z "$vpn1route" ] && vpn1route=$(ip r show dev vpn1 2>/dev/null | grep 'default') 207 | if [ -n "$vpn1route" ]; then 208 | ip r del $vpn1route 209 | vpn1gw="$(echo \"$vpn1route\" | awk '{ print $3 }')" 210 | ip r a default via $vpngw dev vpn1 table 991337 211 | for route in $(ip r show dev vpn1); do 212 | ip r a $route table 991337 213 | done 214 | fi 215 | } 216 | 217 | sysctl -p /etc/sysctl.d/90-shadowsocks.conf >/dev/null 2>&1 218 | modprobe bonding >/dev/null 2>&1 219 | ip link add omr-bonding type bond >/dev/null 2>&1 220 | #[ -n "$(uname -r | grep '6.1')" ] && { 221 | # stap -g /usr/share/systemtap-mptcp/mptcp-app.stap 2>&1 & 222 | #} 223 | 224 | gre_tunnels="$(jq -c '.gre_tunnels' /etc/openmptcprouter-vps-admin/omr-admin-config.json)" 225 | lan_routes="$(jq -c '.lan_routes' /etc/openmptcprouter-vps-admin/omr-admin-config.json)" 226 | 227 | while true; do 228 | _glorytun_udp 229 | _glorytun_tcp 230 | _shadowsocks 231 | _shadowsocks_go 232 | _xray 233 | _v2ray 234 | _dsvpn 235 | _softethervpn 236 | _wireguard 237 | _multipath 238 | _omr_api 239 | [ "$lan_routes" != "false" ] && _lan_route 240 | [ "$gre_tunnels" != "false" ] && _gre_tunnels 241 | _openvpn_bonding 242 | _vpn1 243 | sleep 10 244 | done 245 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------