diff --git a/debian9-x86_64.sh b/debian9-x86_64.sh index fdcc69d..209b2a1 100755 --- a/debian9-x86_64.sh +++ b/debian9-x86_64.sh @@ -6,8 +6,11 @@ # See /LICENSE for more information. # +KERNEL=${KERNEL:-5.4} UPSTREAM=${UPSTREAM:-no} +[ "$UPSTREAM" = "yes" ] && KERNEL="5.15" UPSTREAM6=${UPSTREAM6:-no} +[ "$UPSTREAM6" = "yes" ] && KERNEL="6.1" SHADOWSOCKS_PASS=${SHADOWSOCKS_PASS:-$(head -c 32 /dev/urandom | base64 -w0)} GLORYTUN_PASS=${GLORYTUN_PASS:-$(od -vN "32" -An -tx1 /dev/urandom | tr '[:lower:]' '[:upper:]' | tr -d " \n")} DSVPN_PASS=${DSVPN_PASS:-$(od -vN "32" -An -tx1 /dev/urandom | tr '[:lower:]' '[:upper:]' | tr -d " \n")} @@ -19,6 +22,7 @@ V2RAY=${V2RAY:-yes} V2RAY_UUID=${V2RAY_UUID:-$(cat /proc/sys/kernel/random/uuid | tr -d "\n")} XRAY=${XRAY:-yes} XRAY_UUID=${XRAY_UUID:-$V2RAY_UUID} +SHADOWSOCKS=${SHADOWSOCKS:-yes} SHADOWSOCKS_GO=${SHADOWSOCKS_GO:-yes} PSK=${PSK:-$(head -c 32 /dev/urandom | base64 -w0)} UPSK=${UPSK:-$(head -c 32 /dev/urandom | base64 -w0)} @@ -36,7 +40,7 @@ OPENVPN=${OPENVPN:-yes} DSVPN=${DSVPN:-yes} WIREGUARD=${WIREGUARD:-yes} SOURCES=${SOURCES:-no} -if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" ]; then +if [ "$KERNEL" != "5.4" ]; then SOURCES="yes" fi NOINTERNET=${NOINTERNET:-no} @@ -48,18 +52,20 @@ INTERFACE=${INTERFACE:-$(ip -o -4 route show to default | grep -m 1 -Po '(?<=dev KERNEL_VERSION="5.4.207" KERNEL_PACKAGE_VERSION="1.22" KERNEL_RELEASE="${KERNEL_VERSION}-mptcp_${KERNEL_PACKAGE_VERSION}" -if [ "$UPSTREAM" = "yes" ]; then +if [ "$KERNEL" = "5.15" ]; then KERNEL_VERSION="5.15.57" KERNEL_PACKAGE_VERSION="1.6" KERNEL_RELEASE="${KERNEL_VERSION}-mptcp_${KERNEL_VERSION}-${KERNEL_PACKAGE_VERSION}" fi -if [ "$UPSTREAM6" = "yes" ]; then +if [ "$KERNEL" = "6.1" ]; then KERNEL_VERSION="6.1.0" KERNEL_PACKAGE_VERSION="1.30" KERNEL_RELEASE="${KERNEL_VERSION}-mptcp_${KERNEL_PACKAGE_VERSION}" fi +GLORYTUN_UDP=${GLORYTUN_UDP:-yes} GLORYTUN_UDP_VERSION="23100474922259d00a8c0c4b00a0c8de89202cf9" GLORYTUN_UDP_BINARY_VERSION="0.3.4-5" +GLORYTUN_TCP=${GLORYTUN_TCP:-yes} GLORYTUN_TCP_BINARY_VERSION="0.0.35-6" #MLVPN_VERSION="8f9720978b28c1954f9f229525333547283316d2" MLVPN_VERSION="8aa1b16d843ea68734e2520e39a34cb7f3d61b2b" @@ -67,8 +73,8 @@ MLVPN_BINARY_VERSION="3.0.0+20211028.git.ddafba3" UBOND_VERSION="31af0f69ebb6d07ed9348dca2fced33b956cedee" OBFS_VERSION="486bebd9208539058e57e23a12f23103016e09b4" OBFS_BINARY_VERSION="0.0.5-1" -OMR_ADMIN_VERSION="0780292d156cd8c00cbc83e1ca7d1ff3fde7cf5c" -OMR_ADMIN_BINARY_VERSION="0.8+20240213" +OMR_ADMIN_VERSION="a30f1f32461aefcdb47851d533439032af6e4b05" +OMR_ADMIN_BINARY_VERSION="0.9+20240222" #OMR_ADMIN_BINARY_VERSION="0.3+20220827" DSVPN_VERSION="3b99d2ef6c02b2ef68b5784bec8adfdd55b29b1a" DSVPN_BINARY_VERSION="0.1.4-2" @@ -126,12 +132,12 @@ fi echo "Check architecture..." ARCH=$(dpkg --print-architecture | tr -d "\n") -if [ "$UPSTREAM6" != "yes" ] && [ "$ARCH" != "amd64" ] && [ "$ID" != "debian" ]; then +if ([ "$KERNEL" = "5.4" ] || [ "$KERNEL" = "5.15" ]) && [ "$ARCH" != "amd64" ] && [ "$ID" != "debian" ]; then echo "Only x86_64 (amd64) is supported on this OS" exit 1 fi -if [ "$UPSTREAM6" != "yes" ]; then +if [ "$KERNEL" = "5.4" ] || [ "$KERNEL" = "5.15" ]; then echo "Check virtualized environment" VIRT="$(systemd-detect-virt 2>/dev/null || true)" if [ -z "$(uname -a | grep mptcp)" ] && [ -n "$VIRT" ] && ([ "$VIRT" = "openvz" ] || [ "$VIRT" = "lxc" ] || [ "$VIRT" = "docker" ]); then @@ -225,7 +231,7 @@ if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "9" ] && [ "$UPDATE_OS" = "yes" ]; apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" dist-upgrade VERSION_ID="10" fi -if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "10" ] && [ "$UPDATE_OS" = "yes" ] && [ "$UPSTREAM6" = "yes" ]; then +if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "10" ] && [ "$UPDATE_OS" = "yes" ] && ([ "$KERNEL" = "6.1" ] || [ "$KERNEL" = "6.6" ]); then echo "Update Debian 10 Stretch to Debian 11 Buster" apt-get -y -f --force-yes upgrade apt-get -y -f --force-yes dist-upgrade @@ -236,7 +242,7 @@ if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "10" ] && [ "$UPDATE_OS" = "yes" ] apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" dist-upgrade VERSION_ID="11" fi -if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "11" ] && [ "$UPDATE_OS" = "yes" ] && [ "$UPSTREAM6" = "yes" ]; then +if [ "$ID" = "debian" ] && [ "$VERSION_ID" = "11" ] && [ "$UPDATE_OS" = "yes" ] && ([ "$KERNEL" = "6.1" ] || [ "$KERNEL" = "6.6" ]); then echo "Update Debian 11 Buster to Debian 12" apt-get -y -f --force-yes upgrade apt-get -y -f --force-yes dist-upgrade @@ -256,7 +262,7 @@ if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "18.04" ] && [ "$UPDATE_OS" = "yes" apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" dist-upgrade VERSION_ID="20.04" fi -if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "18.04" ] && [ "$UPDATE_OS" = "yes" ] && [ "$UPSTREAM6" = "yes" ]; then +if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "18.04" ] && [ "$UPDATE_OS" = "yes" ] && ([ "$KERNEL" = "6.1" ] || [ "$KERNEL" = "6.6" ]); then echo "Update Ubuntu 20.04 to Ubuntu 22.04" apt-get -y -f --force-yes upgrade apt-get -y -f --force-yes dist-upgrade @@ -377,7 +383,7 @@ if [ -z "$(dpkg-query -l | grep grub)" ]; then echo 'GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"' > /etc/default/grub } fi -if [ "$UPSTREAM6" != "yes" ]; then +if [ "$KERNEL" = "5.4" ] || [ "$KERNEL" = "5.15" ]; then if [ "$SOURCES" = "yes" ]; then wget -O /tmp/linux-image-${KERNEL_RELEASE}_amd64.deb ${VPSURL}kernel/linux-image-${KERNEL_RELEASE}_amd64.deb wget -O /tmp/linux-headers-${KERNEL_RELEASE}_amd64.deb ${VPSURL}kernel/linux-headers-${KERNEL_RELEASE}_amd64.deb @@ -418,6 +424,15 @@ if [ "$UPSTREAM6" != "yes" ]; then bash update-grub.sh ${KERNEL_VERSION}-mptcp bash update-grub.sh ${KERNEL_RELEASE} [ -f /boot/grub/grub.cfg ] && sed -i 's/default="1>0"/default="0"/' /boot/grub/grub.cfg 2>&1 >/dev/null +elif [ "$KERNEL" = "6.6" ] && [ "$ARCH" = "amd64" ]; then + wget https://dl.xanmod.org/archive.key -O /etc/apt/trusted.gpg.d/xanmod.gpg + echo 'deb http://deb.xanmod.org releases main' > /etc/apt/sources.list.d/xanmod-release.list + apt-get update + apt-get -y install linux-xanmod-x64v3 + [ -f /etc/default/grub ] && { + sed -i "s@^\(GRUB_DEFAULT=\).*@\1\"0\"@" /etc/default/grub >/dev/null 2>&1 + [ -f /boot/grub/grub.cfg ] && grub-mkconfig -o /boot/grub/grub.cfg >/dev/null 2>&1 + } else if [ "$ID" = "ubuntu" ] && [ -z "$(uname -a | grep '6.1')" ]; then apt-get -y install $(apt-cache search linux-image-unsigned-6.1.0 | tail -n 1 | cut -d" " -f1) @@ -447,7 +462,7 @@ if [ "$IPERF" = "yes" ]; then echo "openmptcprouter,$IPERFPASS" > /etc/iperf3/users.csv fi chown -Rf iperf3 /etc/iperf3 || true - systemctl enable iperf3.service + systemctl enable iperf3.service || true mkdir -p /etc/systemd/system/iperf3.service.d if [ "$LOCALFILES" = "no" ]; then wget -O /etc/systemd/system/iperf3.service.d/override.conf ${VPSURL}${VPSPATH}/iperf3.override.conf @@ -456,7 +471,7 @@ if [ "$IPERF" = "yes" ]; then fi fi -if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]; then +if [ "$KERNEL" != "5.4" ]; then echo "Compile and install mptcpize..." apt-get -y install --no-install-recommends build-essential cd /tmp @@ -496,89 +511,89 @@ if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]; then fi apt-get -y remove shadowsocks-libev - -if [ "$SOURCES" = "yes" ]; then - #apt -t stretch-backports -y install shadowsocks-libev - ## Compile Shadowsocks - #rm -rf /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION} - #wget -O /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION}.tar.gz http://github.com/shadowsocks/shadowsocks-libev/releases/download/v${SHADOWSOCKS_VERSION}/shadowsocks-libev-${SHADOWSOCKS_VERSION}.tar.gz - cd /tmp - rm -rf shadowsocks-libev - git clone https://github.com/Ysurac/shadowsocks-libev.git - cd shadowsocks-libev - git checkout ${SHADOWSOCKS_VERSION} - git submodule update --init --recursive - #tar xzf shadowsocks-libev-${SHADOWSOCKS_VERSION}.tar.gz - #cd shadowsocks-libev-${SHADOWSOCKS_VERSION} - #wget https://raw.githubusercontent.com/Ysurac/openmptcprouter-feeds/master/shadowsocks-libev/patches/020-NOCRYPTO.patch - #patch -p1 < 020-NOCRYPTO.patch - #wget https://github.com/Ysurac/shadowsocks-libev/commit/31b93ac2b054bc3f68ea01569649e6882d72218e.patch - #patch -p1 < 31b93ac2b054bc3f68ea01569649e6882d72218e.patch - #wget https://github.com/Ysurac/shadowsocks-libev/commit/2e52734b3bf176966e78e77cf080a1e8c6b2b570.patch - #patch -p1 < 2e52734b3bf176966e78e77cf080a1e8c6b2b570.patch - #wget https://github.com/Ysurac/shadowsocks-libev/commit/dd1baa91e975a69508f9ad67d75d72624c773d24.patch - #patch -p1 < dd1baa91e975a69508f9ad67d75d72624c773d24.patch - # Shadowsocks eBPF support - #wget https://raw.githubusercontent.com/Ysurac/openmptcprouter-feeds/master/shadowsocks-libev/patches/030-eBPF.patch - #patch -p1 < 030-eBPF.patch - #rm -f /var/lib/dpkg/lock - #apt-get install -y --no-install-recommends build-essential git ca-certificates libcap-dev libelf-dev libpcap-dev - #cd /tmp - #rm -rf libbpf - #git clone https://github.com/libbpf/libbpf.git - #cd libbpf - #if [ "$ID" = "debian" ]; then - # rm -f /var/lib/dpkg/lock - # apt -y -t stretch-backports install linux-libc-dev - #elif [ "$ID" = "ubuntu" ]; then - # rm -f /var/lib/dpkg/lock - # apt-get -y install linux-libc-dev - #fi - #BUILD_SHARED=y make -C src CFLAGS="$CFLAGS -DCOMPAT_NEED_REALLOCARRAY" - #cp /tmp/libbpf/src/libbpf.so /usr/lib - #cp /tmp/libbpf/src/*.h /usr/include/bpf - #cd /tmp - #rm -rf /tmp/libbpf - rm -f /var/lib/dpkg/lock - rm -f /var/lib/dpkg/lock-frontend - apt-get -y install --no-install-recommends devscripts equivs apg libcap2-bin libpam-cap libc-ares2 libc-ares-dev libev4 haveged libpcre3-dev - apt-get -y install --no-install-recommends asciidoc-base asciidoc-common docbook-xml docbook-xsl libev-dev libmbedcrypto3 libmbedtls-dev libmbedtls12 libmbedx509-0 libxml2-utils libxslt1.1 pkg-config sgml-base sgml-data xml-core xmlto xsltproc - sleep 1 - rm -f /var/lib/dpkg/lock - rm -f /var/lib/dpkg/lock-frontend - systemctl enable haveged - - if [ "$ID" = "debian" ]; then +if [ "$SHADOWSOCKS" = "yes" ]; then + if [ "$SOURCES" = "yes" ]; then + #apt -t stretch-backports -y install shadowsocks-libev + ## Compile Shadowsocks + #rm -rf /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION} + #wget -O /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION}.tar.gz http://github.com/shadowsocks/shadowsocks-libev/releases/download/v${SHADOWSOCKS_VERSION}/shadowsocks-libev-${SHADOWSOCKS_VERSION}.tar.gz + cd /tmp + rm -rf shadowsocks-libev + git clone https://github.com/Ysurac/shadowsocks-libev.git + cd shadowsocks-libev + git checkout ${SHADOWSOCKS_VERSION} + git submodule update --init --recursive + #tar xzf shadowsocks-libev-${SHADOWSOCKS_VERSION}.tar.gz + #cd shadowsocks-libev-${SHADOWSOCKS_VERSION} + #wget https://raw.githubusercontent.com/Ysurac/openmptcprouter-feeds/master/shadowsocks-libev/patches/020-NOCRYPTO.patch + #patch -p1 < 020-NOCRYPTO.patch + #wget https://github.com/Ysurac/shadowsocks-libev/commit/31b93ac2b054bc3f68ea01569649e6882d72218e.patch + #patch -p1 < 31b93ac2b054bc3f68ea01569649e6882d72218e.patch + #wget https://github.com/Ysurac/shadowsocks-libev/commit/2e52734b3bf176966e78e77cf080a1e8c6b2b570.patch + #patch -p1 < 2e52734b3bf176966e78e77cf080a1e8c6b2b570.patch + #wget https://github.com/Ysurac/shadowsocks-libev/commit/dd1baa91e975a69508f9ad67d75d72624c773d24.patch + #patch -p1 < dd1baa91e975a69508f9ad67d75d72624c773d24.patch + # Shadowsocks eBPF support + #wget https://raw.githubusercontent.com/Ysurac/openmptcprouter-feeds/master/shadowsocks-libev/patches/030-eBPF.patch + #patch -p1 < 030-eBPF.patch + #rm -f /var/lib/dpkg/lock + #apt-get install -y --no-install-recommends build-essential git ca-certificates libcap-dev libelf-dev libpcap-dev + #cd /tmp + #rm -rf libbpf + #git clone https://github.com/libbpf/libbpf.git + #cd libbpf + #if [ "$ID" = "debian" ]; then + # rm -f /var/lib/dpkg/lock + # apt -y -t stretch-backports install linux-libc-dev + #elif [ "$ID" = "ubuntu" ]; then + # rm -f /var/lib/dpkg/lock + # apt-get -y install linux-libc-dev + #fi + #BUILD_SHARED=y make -C src CFLAGS="$CFLAGS -DCOMPAT_NEED_REALLOCARRAY" + #cp /tmp/libbpf/src/libbpf.so /usr/lib + #cp /tmp/libbpf/src/*.h /usr/include/bpf + #cd /tmp + #rm -rf /tmp/libbpf rm -f /var/lib/dpkg/lock rm -f /var/lib/dpkg/lock-frontend - if [ "$VERSION_ID" = "9" ]; then - apt -y -t stretch-backports install libsodium-dev - else - apt -y install libsodium-dev + apt-get -y install --no-install-recommends devscripts equivs apg libcap2-bin libpam-cap libc-ares2 libc-ares-dev libev4 haveged libpcre3-dev + apt-get -y install --no-install-recommends asciidoc-base asciidoc-common docbook-xml docbook-xsl libev-dev libmbedcrypto3 libmbedtls-dev libmbedtls12 libmbedx509-0 libxml2-utils libxslt1.1 pkg-config sgml-base sgml-data xml-core xmlto xsltproc + sleep 1 + rm -f /var/lib/dpkg/lock + rm -f /var/lib/dpkg/lock-frontend + systemctl enable haveged + if [ "$ID" = "debian" ]; then + rm -f /var/lib/dpkg/lock + rm -f /var/lib/dpkg/lock-frontend + if [ "$VERSION_ID" = "9" ]; then + apt -y -t stretch-backports install libsodium-dev + else + apt -y install libsodium-dev + fi + elif [ "$ID" = "ubuntu" ]; then + rm -f /var/lib/dpkg/lock + rm -f /var/lib/dpkg/lock-frontend + apt-get -y install libsodium-dev fi - elif [ "$ID" = "ubuntu" ]; then + #cd /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION} rm -f /var/lib/dpkg/lock rm -f /var/lib/dpkg/lock-frontend - apt-get -y install libsodium-dev + mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" 2>&1 >/dev/null + rm -f /var/lib/dpkg/lock + rm -f /var/lib/dpkg/lock-frontend + dpkg-buildpackage -b -us -uc 2>&1 >/dev/null + rm -f /var/lib/dpkg/lock + rm -f /var/lib/dpkg/lock-frontend + cd /tmp + #dpkg -i shadowsocks-libev_*.deb + dpkg -i omr-shadowsocks-libev_*.deb 2>&1 >/dev/null + #mkdir -p /usr/lib/shadowsocks-libev + #cp -f /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION}/src/*.ebpf /usr/lib/shadowsocks-libev + #rm -rf /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION} + rm -rf /tmp/shadowsocks-libev + else + apt-get -y -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-overwrite" install omr-shadowsocks-libev=${SHADOWSOCKS_BINARY_VERSION} fi - #cd /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION} - rm -f /var/lib/dpkg/lock - rm -f /var/lib/dpkg/lock-frontend - mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends -y" 2>&1 >/dev/null - rm -f /var/lib/dpkg/lock - rm -f /var/lib/dpkg/lock-frontend - dpkg-buildpackage -b -us -uc 2>&1 >/dev/null - rm -f /var/lib/dpkg/lock - rm -f /var/lib/dpkg/lock-frontend - cd /tmp - #dpkg -i shadowsocks-libev_*.deb - dpkg -i omr-shadowsocks-libev_*.deb 2>&1 >/dev/null - #mkdir -p /usr/lib/shadowsocks-libev - #cp -f /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION}/src/*.ebpf /usr/lib/shadowsocks-libev - #rm -rf /tmp/shadowsocks-libev-${SHADOWSOCKS_VERSION} - rm -rf /tmp/shadowsocks-libev -else - apt-get -y -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-overwrite" install omr-shadowsocks-libev=${SHADOWSOCKS_BINARY_VERSION} fi # Load BBR Congestion module at boot time @@ -586,7 +601,7 @@ if ! grep -q bbr /etc/modules ; then echo tcp_bbr >> /etc/modules fi -if [ "$UPSTREAM" != "yes" ] && [ "$UPSTREAM6" != "yes" ]; then +if [ "$KERNEL" = "5.4" ]; then # Load OLIA Congestion module at boot time if ! grep -q olia /etc/modules ; then echo mptcp_olia >> /etc/modules @@ -706,7 +721,8 @@ if [ "$OMR_ADMIN" = "yes" ]; then fi mkdir -p /etc/openmptcprouter-vps-admin/omr-6in4 mkdir -p /etc/openmptcprouter-vps-admin/intf - [ ! -f "/etc/openmptcprouter-vps-admin/current-vpn" ] && echo "glorytun_tcp" > /etc/openmptcprouter-vps-admin/current-vpn + #[ ! -f "/etc/openmptcprouter-vps-admin/current-vpn" ] && echo "glorytun_tcp" > /etc/openmptcprouter-vps-admin/current-vpn + [ ! -f "/etc/openmptcprouter-vps-admin/current-vpn" ] && echo "openvpn" > /etc/openmptcprouter-vps-admin/current-vpn mkdir -p /var/opt/openmptcprouter if [ "$SOURCES" = "yes" ]; then wget -O /lib/systemd/system/omr-admin.service ${VPSURL}${VPSPATH}/omr-admin.service.in @@ -764,7 +780,7 @@ if [ "$OMR_ADMIN" = "yes" ]; then systemctl enable omr-admin-ipv6.service } systemctl enable omr-admin.service - if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]; then + if [ "$KERNEL" != "5.4" ]; then mptcpize enable omr-admin.service 2>&1 >/dev/null [ "$(ip -6 a)" != "" ] && mptcpize enable omr-admin-ipv6.service 2>&1 >/dev/null fi @@ -772,74 +788,75 @@ fi # Get shadowsocks optimization if [ "$LOCALFILES" = "no" ]; then - if [ "$UPSTREAM6" = "yes" ]; then + if [ "$KERNEL" = "6.1" ] || [ "$KERNEL" = "6.6" ]; then wget -O /etc/sysctl.d/90-shadowsocks.conf ${VPSURL}${VPSPATH}/shadowsocks.6.1.conf else wget -O /etc/sysctl.d/90-shadowsocks.conf ${VPSURL}${VPSPATH}/shadowsocks.conf fi else - if [ "$UPSTREAM6" = "yes" ]; then + if [ "$KERNEL" = "6.1" ] || [ "$KERNEL" = "6.6" ]; then cp ${DIR}/shadowsocks.6.1.conf /etc/sysctl.d/90-shadowsocks.conf else cp ${DIR}/shadowsocks.conf /etc/sysctl.d/90-shadowsocks.conf fi fi -if [ "$update" != 0 ]; then - if [ ! -f /etc/shadowsocks-libev/manager.json ]; then - SHADOWSOCKS_PASS=$(grep -Po '"'"key"'"\s*:\s*"\K([^"]*)' /etc/shadowsocks-libev/config.json | tr -d "\n" | sed 's/-/+/g; s/_/\//g;') - else - SHADOWSOCKS_PASS=$(grep -Po '"'"65101"'":\s*"\K([^"]*)' /etc/shadowsocks-libev/manager.json | tr -d "\n" | sed 's/-/+/g; s/_/\//g;') +if [ "$SHADOWSOCKS" = "yes" ]; then + if [ "$update" != 0 ]; then + if [ ! -f /etc/shadowsocks-libev/manager.json ]; then + SHADOWSOCKS_PASS=$(grep -Po '"'"key"'"\s*:\s*"\K([^"]*)' /etc/shadowsocks-libev/config.json | tr -d "\n" | sed 's/-/+/g; s/_/\//g;') + elif [ -f /etc/shadowsocks-libev/manager.json ]; then + SHADOWSOCKS_PASS=$(grep -Po '"'"65101"'":\s*"\K([^"]*)' /etc/shadowsocks-libev/manager.json | tr -d "\n" | sed 's/-/+/g; s/_/\//g;') + fi fi -fi -# Install shadowsocks config and add a shadowsocks by CPU -if [ "$update" = "0" ] || [ ! -f /etc/shadowsocks-libev/manager.json ]; then - if [ "$LOCALFILES" = "no" ]; then - wget -O /etc/shadowsocks-libev/manager.json ${VPSURL}${VPSPATH}/manager.json - else - cp ${DIR}/manager.json /etc/shadowsocks-libev/manager.json - fi - SHADOWSOCKS_PASS_JSON=$(echo $SHADOWSOCKS_PASS | sed 's/+/-/g; s/\//_/g;') - if [ "$NBCPU" -gt "1" ]; then - for i in $(seq 2 NBCPU); do + # Install shadowsocks config and add a shadowsocks by CPU + if [ "$update" = "0" ] || [ ! -f /etc/shadowsocks-libev/manager.json ]; then + if [ "$LOCALFILES" = "no" ]; then + wget -O /etc/shadowsocks-libev/manager.json ${VPSURL}${VPSPATH}/manager.json + else + cp ${DIR}/manager.json /etc/shadowsocks-libev/manager.json + fi + SHADOWSOCKS_PASS_JSON=$(echo $SHADOWSOCKS_PASS | sed 's/+/-/g; s/\//_/g;') + if [ "$NBCPU" -gt "1" ]; then + for i in $(seq 2 NBCPU); do + sed -i '0,/65101/ s/ "65101.*/&\n&/' /etc/shadowsocks-libev/manager.json + done + fi + #sed -i "s:MySecretKey:$SHADOWSOCKS_PASS_JSON:g" /etc/shadowsocks-libev/config.json + sed -i "s:MySecretKey:$SHADOWSOCKS_PASS_JSON:g" /etc/shadowsocks-libev/manager.json + [ "$(ip -6 a)" = "" ] && sed -i '/"\[::0\]"/d' /etc/shadowsocks-libev/manager.json + elif [ "$update" != "0" ] && [ -f /etc/shadowsocks-libev/manager.json ] && [ "$(grep -c '65101' /etc/shadowsocks-libev/manager.json | tr -d '\n')" != "$NBCPU" ] && [ -z "$(grep port_conf /etc/shadowsocks-libev/manager.json)" ]; then + for i in $(seq 2 $NBCPU); do sed -i '0,/65101/ s/ "65101.*/&\n&/' /etc/shadowsocks-libev/manager.json done + sed -i 's/ "65101.*"$/&,/' /etc/shadowsocks-libev/manager.json + fi + [ ! -f /etc/shadowsocks-libev/local.acl ] && touch /etc/shadowsocks-libev/local.acl + #sed -i 's:aes-256-cfb:chacha20:g' /etc/shadowsocks-libev/config.json + #sed -i 's:json:json --no-delay:g' /lib/systemd/system/shadowsocks-libev-server@.service + if [ "$LOCALFILES" = "no" ]; then + wget -O /lib/systemd/system/shadowsocks-libev-manager@.service ${VPSURL}${VPSPATH}/shadowsocks-libev-manager@.service.in + else + cp ${DIR}/shadowsocks-libev-manager@.service.in /lib/systemd/system/shadowsocks-libev-manager@.service + fi + if systemctl -q is-enabled shadowsocks-libev; then + systemctl -q disable shadowsocks-libev + fi + [ -f /etc/shadowsocks-libev/config.json ] && systemctl disable shadowsocks-libev-server@config.service + systemctl enable shadowsocks-libev-manager@manager.service + if [ $NBCPU -gt 1 ]; then + for i in $(seq 1 $NBCPU); do + [ -f /etc/shadowsocks-libev/config$i.json ] && systemctl is-enabled shadowsocks-libev && systemctl disable shadowsocks-libev-server@config$i.service + done + fi + if systemctl -q is-active shadowsocks-libev-manager@manager; then + systemctl -q stop shadowsocks-libev-manager@manager > /dev/null 2>&1 fi - #sed -i "s:MySecretKey:$SHADOWSOCKS_PASS_JSON:g" /etc/shadowsocks-libev/config.json - sed -i "s:MySecretKey:$SHADOWSOCKS_PASS_JSON:g" /etc/shadowsocks-libev/manager.json - [ "$(ip -6 a)" = "" ] && sed -i '/"\[::0\]"/d' /etc/shadowsocks-libev/manager.json -elif [ "$update" != "0" ] && [ -f /etc/shadowsocks-libev/manager.json ] && [ "$(grep -c '65101' /etc/shadowsocks-libev/manager.json | tr -d '\n')" != "$NBCPU" ] && [ -z "$(grep port_conf /etc/shadowsocks-libev/manager.json)" ]; then - for i in $(seq 2 $NBCPU); do - sed -i '0,/65101/ s/ "65101.*/&\n&/' /etc/shadowsocks-libev/manager.json - done - sed -i 's/ "65101.*"$/&,/' /etc/shadowsocks-libev/manager.json -fi -[ ! -f /etc/shadowsocks-libev/local.acl ] && touch /etc/shadowsocks-libev/local.acl -#sed -i 's:aes-256-cfb:chacha20:g' /etc/shadowsocks-libev/config.json -#sed -i 's:json:json --no-delay:g' /lib/systemd/system/shadowsocks-libev-server@.service -if [ "$LOCALFILES" = "no" ]; then - wget -O /lib/systemd/system/shadowsocks-libev-manager@.service ${VPSURL}${VPSPATH}/shadowsocks-libev-manager@.service.in -else - cp ${DIR}/shadowsocks-libev-manager@.service.in /lib/systemd/system/shadowsocks-libev-manager@.service -fi -if systemctl -q is-enabled shadowsocks-libev; then - systemctl -q disable shadowsocks-libev -fi -[ -f /etc/shadowsocks-libev/config.json ] && systemctl disable shadowsocks-libev-server@config.service -systemctl enable shadowsocks-libev-manager@manager.service -if [ $NBCPU -gt 1 ]; then - for i in $(seq 1 $NBCPU); do - [ -f /etc/shadowsocks-libev/config$i.json ] && systemctl is-enabled shadowsocks-libev && systemctl disable shadowsocks-libev-server@config$i.service - done fi if ! grep -q 'DefaultLimitNOFILE=65536' /etc/systemd/system.conf ; then echo 'DefaultLimitNOFILE=65536' >> /etc/systemd/system.conf fi -if systemctl -q is-active shadowsocks-libev-manager@manager; then - systemctl -q stop shadowsocks-libev-manager@manager > /dev/null 2>&1 -fi - if [ "$LOCALFILES" = "no" ]; then wget -O /lib/systemd/system/omr-update.service ${VPSURL}${VPSPATH}/omr-update.service.in wget -O /usr/bin/omr-update ${VPSURL}${VPSPATH}/omr-update @@ -917,7 +934,7 @@ if [ "$V2RAY_PLUGIN" = "yes" ]; then fi fi -if [ "$OBFS" = "no" ] && [ "$V2RAY_PLUGIN" = "no" ]; then +if [ "$OBFS" = "no" ] && [ "$V2RAY_PLUGIN" = "no" ] && [ -f /etc/shadowsocks-libev/config.json ]; then sed -i -e '/plugin/d' -e 's/,,//' /etc/shadowsocks-libev/config.json fi @@ -1015,7 +1032,7 @@ if [ "$V2RAY" = "yes" ]; then wget -O /etc/v2ray/v2ray-server.json ${VPSURL}${VPSPATH}/v2ray-server.json sed -i "s:V2RAY_UUID:$V2RAY_UUID:g" /etc/v2ray/v2ray-server.json #fi - if ([ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]) && [ -z "$(grep mptcp /etc/v2ray/v2ray-server.json | grep true)" ]; then + if [ "$KERNEL" != "5.4" ] && [ -z "$(grep mptcp /etc/v2ray/v2ray-server.json | grep true)" ]; then sed -i 's/"sockopt": {/&\n "mptcp": true,/' /etc/v2ray/v2ray-server.json fi rm -f /etc/v2ray/config.json @@ -1355,7 +1372,7 @@ if [ "$OPENVPN" = "yes" ]; then openssl dhparam -out /etc/openvpn/server/dh2048.pem 2048 fi if [ "$LOCALFILES" = "no" ]; then - if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]; then + if [ "$KERNEL" != "5.4" ]; then wget -O /etc/openvpn/tun0.conf ${VPSURL}${VPSPATH}/openvpn-tun0.6.1.conf wget -O /etc/openvpn/tun1.conf ${VPSURL}${VPSPATH}/openvpn-tun1.6.1.conf else @@ -1371,7 +1388,7 @@ if [ "$OPENVPN" = "yes" ]; then wget -O /etc/openvpn/bonding7.conf ${VPSURL}${VPSPATH}/openvpn-bonding7.conf wget -O /etc/openvpn/bonding8.conf ${VPSURL}${VPSPATH}/openvpn-bonding8.conf else - if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]; then + if [ "$KERNEL" != "5.4" ]; then cp ${DIR}/openvpn-tun0.6.1.conf /etc/openvpn/tun0.conf cp ${DIR}/openvpn-tun1.6.1.conf /etc/openvpn/tun1.conf else @@ -1397,7 +1414,7 @@ if [ "$OPENVPN" = "yes" ]; then chmod 644 /lib/systemd/system/openvpn*.service systemctl enable openvpn@tun0.service systemctl enable openvpn@tun1.service - if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]; then + if [ "$KERNEL" != "5.4" ]; then mptcpize enable openvpn@tun0 2>&1 >/dev/null fi systemctl enable openvpn@bonding1.service @@ -1415,61 +1432,63 @@ echo 'Glorytun UDP' if systemctl -q is-active glorytun-udp@tun0.service; then systemctl -q stop 'glorytun-udp@*' > /dev/null 2>&1 fi -if [ "$SOURCES" = "yes" ]; then - rm -f /var/lib/dpkg/lock - rm -f /var/lib/dpkg/lock-frontend - rm -f /usr/bin/glorytun - apt-get install -y --no-install-recommends build-essential git ca-certificates meson pkg-config - rm -rf /tmp/glorytun-udp - cd /tmp - git clone https://github.com/Ysurac/glorytun.git /tmp/glorytun-udp - cd /tmp/glorytun-udp - git checkout ${GLORYTUN_UDP_VERSION} - git submodule update --init --recursive - meson build - ninja -C build install - sed -i 's:EmitDNS=yes:EmitDNS=no:g' /lib/systemd/network/glorytun.network - rm /lib/systemd/system/glorytun* - rm /lib/systemd/network/glorytun* - if [ "$LOCALFILES" = "no" ]; then - wget -O /usr/local/bin/glorytun-udp-run ${VPSURL}${VPSPATH}/glorytun-udp-run +if [ "$GLORYTUN_UDP" = "yes" ]; then + if [ "$SOURCES" = "yes" ]; then + rm -f /var/lib/dpkg/lock + rm -f /var/lib/dpkg/lock-frontend + rm -f /usr/bin/glorytun + apt-get install -y --no-install-recommends build-essential git ca-certificates meson pkg-config + rm -rf /tmp/glorytun-udp + cd /tmp + git clone https://github.com/Ysurac/glorytun.git /tmp/glorytun-udp + cd /tmp/glorytun-udp + git checkout ${GLORYTUN_UDP_VERSION} + git submodule update --init --recursive + meson build + ninja -C build install + sed -i 's:EmitDNS=yes:EmitDNS=no:g' /lib/systemd/network/glorytun.network + rm /lib/systemd/system/glorytun* + rm /lib/systemd/network/glorytun* + if [ "$LOCALFILES" = "no" ]; then + wget -O /usr/local/bin/glorytun-udp-run ${VPSURL}${VPSPATH}/glorytun-udp-run + else + cp ${DIR}/glorytun-udp-run /usr/local/bin/glorytun-udp-run + fi + chmod 755 /usr/local/bin/glorytun-udp-run + if [ "$LOCALFILES" = "no" ]; then + wget -O /lib/systemd/system/glorytun-udp@.service ${VPSURL}${VPSPATH}/glorytun-udp%40.service.in + else + cp ${DIR}/glorytun-udp@.service.in /lib/systemd/system/glorytun-udp@.service + fi + chmod 644 /lib/systemd/system/glorytun-udp@.service + #wget -O /lib/systemd/network/glorytun-udp.network ${VPSURL}${VPSPATH}/glorytun-udp.network + rm -f /lib/systemd/network/glorytun-udp.network + mkdir -p /etc/glorytun-udp + if [ "$LOCALFILES" = "no" ]; then + wget -O /etc/glorytun-udp/post.sh ${VPSURL}${VPSPATH}/glorytun-udp-post.sh + wget -O /etc/glorytun-udp/tun0 ${VPSURL}${VPSPATH}/tun0.glorytun-udp + else + cp ${DIR}/glorytun-udp-post.sh /etc/glorytun-udp/post.sh + cp ${DIR}/tun0.glorytun-udp /etc/glorytun-udp/tun0 + fi + chmod 755 /etc/glorytun-udp/post.sh + if [ "$update" = "0" ] || [ ! -f /etc/glorytun-udp/tun0.key ]; then + echo "$GLORYTUN_PASS" > /etc/glorytun-udp/tun0.key + elif [ ! -f /etc/glorytun-udp/tun0.key ] && [ -f /etc/glorytun-tcp/tun0.key ]; then + cp /etc/glorytun-tcp/tun0.key /etc/glorytun-udp/tun0.key + fi + systemctl enable glorytun-udp@tun0.service + systemctl enable systemd-networkd.service + cd /tmp + rm -rf /tmp/glorytun-udp else - cp ${DIR}/glorytun-udp-run /usr/local/bin/glorytun-udp-run + rm -f /usr/local/bin/glorytun + apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-overwrite" install --reinstall omr-glorytun=${GLORYTUN_UDP_BINARY_VERSION} + chmod 644 /lib/systemd/system/glorytun-udp@.service + GLORYTUN_PASS="$(cat /etc/glorytun-udp/tun0.key | tr -d '\n')" fi - chmod 755 /usr/local/bin/glorytun-udp-run - if [ "$LOCALFILES" = "no" ]; then - wget -O /lib/systemd/system/glorytun-udp@.service ${VPSURL}${VPSPATH}/glorytun-udp%40.service.in - else - cp ${DIR}/glorytun-udp@.service.in /lib/systemd/system/glorytun-udp@.service - fi - chmod 644 /lib/systemd/system/glorytun-udp@.service - #wget -O /lib/systemd/network/glorytun-udp.network ${VPSURL}${VPSPATH}/glorytun-udp.network - rm -f /lib/systemd/network/glorytun-udp.network - mkdir -p /etc/glorytun-udp - if [ "$LOCALFILES" = "no" ]; then - wget -O /etc/glorytun-udp/post.sh ${VPSURL}${VPSPATH}/glorytun-udp-post.sh - wget -O /etc/glorytun-udp/tun0 ${VPSURL}${VPSPATH}/tun0.glorytun-udp - else - cp ${DIR}/glorytun-udp-post.sh /etc/glorytun-udp/post.sh - cp ${DIR}/tun0.glorytun-udp /etc/glorytun-udp/tun0 - fi - chmod 755 /etc/glorytun-udp/post.sh - if [ "$update" = "0" ] || [ ! -f /etc/glorytun-udp/tun0.key ]; then - echo "$GLORYTUN_PASS" > /etc/glorytun-udp/tun0.key - elif [ ! -f /etc/glorytun-udp/tun0.key ] && [ -f /etc/glorytun-tcp/tun0.key ]; then - cp /etc/glorytun-tcp/tun0.key /etc/glorytun-udp/tun0.key - fi - systemctl enable glorytun-udp@tun0.service - systemctl enable systemd-networkd.service - cd /tmp - rm -rf /tmp/glorytun-udp -else - rm -f /usr/local/bin/glorytun - apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-overwrite" install --reinstall omr-glorytun=${GLORYTUN_UDP_BINARY_VERSION} - chmod 644 /lib/systemd/system/glorytun-udp@.service - GLORYTUN_PASS="$(cat /etc/glorytun-udp/tun0.key | tr -d '\n')" + [ "$(ip -6 a)" != "" ] && sed -i 's/0.0.0.0/::/g' /etc/glorytun-udp/tun0 fi -[ "$(ip -6 a)" != "" ] && sed -i 's/0.0.0.0/::/g' /etc/glorytun-udp/tun0 # Add chrony for time sync @@ -1515,7 +1534,7 @@ if [ "$DSVPN" = "yes" ]; then chmod 644 /lib/systemd/system/dsvpn-server@.service DSVPN_PASS=$(cat /etc/dsvpn/dsvpn0.key | tr -d "\n") fi - if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]; then + if [ "$KERNEL" != "5.4" ]; then mptcpize enable dsvpn-server@dsvpn0 2>&1 >/dev/null fi fi @@ -1524,58 +1543,60 @@ fi if systemctl -q is-active glorytun-tcp@tun0.service; then systemctl -q stop 'glorytun-tcp@*' > /dev/null 2>&1 fi -if [ "$SOURCES" = "yes" ]; then - if [ "$ID" = "debian" ]; then - if [ "$VERSION_ID" = "9" ]; then - apt -t stretch-backports -y install libsodium-dev - else - apt -y install libsodium-dev +if [ "$GLORYTUN_TCP" = "yes" ]; then + if [ "$SOURCES" = "yes" ]; then + if [ "$ID" = "debian" ]; then + if [ "$VERSION_ID" = "9" ]; then + apt -t stretch-backports -y install libsodium-dev + else + apt -y install libsodium-dev + fi + elif [ "$ID" = "ubuntu" ]; then + apt-get -y install libsodium-dev fi - elif [ "$ID" = "ubuntu" ]; then - apt-get -y install libsodium-dev - fi - rm -f /var/lib/dpkg/lock - rm -f /var/lib/dpkg/lock-frontend - rm -f /usr/bin/glorytun-tcp - apt-get -y install build-essential pkg-config autoconf automake - rm -rf /tmp/glorytun-0.0.35 - cd /tmp - if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]; then - wget -O /tmp/glorytun-0.0.35.tar.gz https://github.com/Ysurac/glorytun/archive/refs/heads/tcp.tar.gz + rm -f /var/lib/dpkg/lock + rm -f /var/lib/dpkg/lock-frontend + rm -f /usr/bin/glorytun-tcp + apt-get -y install build-essential pkg-config autoconf automake + rm -rf /tmp/glorytun-0.0.35 + cd /tmp + if [ "$KERNEL" != "5.4" ]; then + wget -O /tmp/glorytun-0.0.35.tar.gz https://github.com/Ysurac/glorytun/archive/refs/heads/tcp.tar.gz + else + wget -O /tmp/glorytun-0.0.35.tar.gz https://github.com/angt/glorytun/releases/download/v0.0.35/glorytun-0.0.35.tar.gz + fi + tar xzf glorytun-0.0.35.tar.gz + if [ "$KERNEL" != "5.4" ]; then + mv /tmp/glorytun-tcp /tmp/glorytun-0.0.35 + fi + cd glorytun-0.0.35 + ./autogen.sh + ./configure + make + cp glorytun /usr/local/bin/glorytun-tcp + wget -O /usr/local/bin/glorytun-tcp-run ${VPSURL}${VPSPATH}/glorytun-tcp-run + chmod 755 /usr/local/bin/glorytun-tcp-run + wget -O /lib/systemd/system/glorytun-tcp@.service ${VPSURL}${VPSPATH}/glorytun-tcp%40.service.in + #wget -O /lib/systemd/network/glorytun-tcp.network ${VPSURL}${VPSPATH}/glorytun.network + chmod 644 /lib/systemd/system/glorytun-tcp@.service + rm -f /lib/systemd/network/glorytun-tcp.network + mkdir -p /etc/glorytun-tcp + wget -O /etc/glorytun-tcp/post.sh ${VPSURL}${VPSPATH}/glorytun-tcp-post.sh + chmod 755 /etc/glorytun-tcp/post.sh + wget -O /etc/glorytun-tcp/tun0 ${VPSURL}${VPSPATH}/tun0.glorytun + if [ "$update" = "0" ]; then + echo "$GLORYTUN_PASS" > /etc/glorytun-tcp/tun0.key + fi + systemctl enable glorytun-tcp@tun0.service + #systemctl enable systemd-networkd.service + cd /tmp + rm -rf /tmp/glorytun-0.0.35 else - wget -O /tmp/glorytun-0.0.35.tar.gz https://github.com/angt/glorytun/releases/download/v0.0.35/glorytun-0.0.35.tar.gz + rm -f /usr/local/bin/glorytun-tcp + apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-overwrite" install --reinstall omr-glorytun-tcp=${GLORYTUN_TCP_BINARY_VERSION} fi - tar xzf glorytun-0.0.35.tar.gz - if [ "$UPSTREAM" = "yes" ] || [ "$UPSTREAM6" = "yes" ]; then - mv /tmp/glorytun-tcp /tmp/glorytun-0.0.35 - fi - cd glorytun-0.0.35 - ./autogen.sh - ./configure - make - cp glorytun /usr/local/bin/glorytun-tcp - wget -O /usr/local/bin/glorytun-tcp-run ${VPSURL}${VPSPATH}/glorytun-tcp-run - chmod 755 /usr/local/bin/glorytun-tcp-run - wget -O /lib/systemd/system/glorytun-tcp@.service ${VPSURL}${VPSPATH}/glorytun-tcp%40.service.in - #wget -O /lib/systemd/network/glorytun-tcp.network ${VPSURL}${VPSPATH}/glorytun.network - chmod 644 /lib/systemd/system/glorytun-tcp@.service - rm -f /lib/systemd/network/glorytun-tcp.network - mkdir -p /etc/glorytun-tcp - wget -O /etc/glorytun-tcp/post.sh ${VPSURL}${VPSPATH}/glorytun-tcp-post.sh - chmod 755 /etc/glorytun-tcp/post.sh - wget -O /etc/glorytun-tcp/tun0 ${VPSURL}${VPSPATH}/tun0.glorytun - if [ "$update" = "0" ]; then - echo "$GLORYTUN_PASS" > /etc/glorytun-tcp/tun0.key - fi - systemctl enable glorytun-tcp@tun0.service - #systemctl enable systemd-networkd.service - cd /tmp - rm -rf /tmp/glorytun-0.0.35 -else - rm -f /usr/local/bin/glorytun-tcp - apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-overwrite" install --reinstall omr-glorytun-tcp=${GLORYTUN_TCP_BINARY_VERSION} + [ "$(ip -6 a)" != "" ] && sed -i 's/0.0.0.0/::/g' /etc/glorytun-tcp/tun0 fi -[ "$(ip -6 a)" != "" ] && sed -i 's/0.0.0.0/::/g' /etc/glorytun-tcp/tun0 # Load tun module at boot time @@ -1849,14 +1870,26 @@ if [ "$update" = "0" ]; then # Save info in file cat > /root/openmptcprouter_config.txt <<-EOF SSH port: 65222 (instead of port 22) - Shadowsocks port: 65101 - Shadowsocks encryption: chacha20 - Your shadowsocks key: ${SHADOWSOCKS_PASS} - Your shadowsocks 2022 key: ${PSK}:${UPSK} - Glorytun port: 65001 - Glorytun encryption: chacha20 - Your glorytun key: ${GLORYTUN_PASS} EOF + if [ "$SHADOWSOCKS" = "yes" ]; then + cat >> /root/openmptcprouter_config.txt <<-EOF + Shadowsocks port: 65101 + Shadowsocks encryption: chacha20 + Your shadowsocks key: ${SHADOWSOCKS_PASS} + EOF + fi + if [ "$SHADOWSOCKS_GO" = "yes" ]; then + cat >> /root/openmptcprouter_config.txt <<-EOF + Your shadowsocks 2022 key: ${PSK}:${UPSK} + EOF + fi + if ([ "$GLORYTUN_TCP" = "yes" ] || [ "$GLORYTUN_UDP" = "yes" ]); then + cat >> /root/openmptcprouter_config.txt <<-EOF + Glorytun port: 65001 + Glorytun encryption: chacha20 + Your glorytun key: ${GLORYTUN_PASS} + EOF + fi if [ "$DSVPN" = "yes" ]; then cat >> /root/openmptcprouter_config.txt <<-EOF A Dead Simple VPN port: 65401 @@ -1882,7 +1915,7 @@ if [ "$update" = "0" ]; then Your OpenMPTCProuter Server username: openmptcprouter EOF fi - systemctl -q restart sshd + #systemctl -q restart sshd else echo '====================================================================================' echo "OpenMPTCProuter Server is now updated to version $OMR_VERSION !" @@ -1910,18 +1943,27 @@ else systemctl -q restart v2ray echo 'done' fi + if [ "$XRAY" = "yes" ]; then + echo 'Restarting xray...' + systemctl -q restart xray + echo 'done' + fi if [ "$DSVPN" = "yes" ]; then echo 'Restarting dsvpn...' systemctl -q start dsvpn-server@dsvpn0 || true systemctl -q restart 'dsvpn-server@*' || true echo 'done' fi - echo 'Restarting glorytun...' - systemctl -q start glorytun-tcp@tun0 || true - systemctl -q restart 'glorytun-tcp@*' || true - systemctl -q start glorytun-udp@tun0 || true - systemctl -q restart 'glorytun-udp@*' || true - echo 'done' + if [ "$GLORYTUN_TCP" = "yes" ]; then + echo 'Restarting glorytun tcp...' + systemctl -q start glorytun-tcp@tun0 || true + systemctl -q restart 'glorytun-tcp@*' || true + fi + if [ "$GLORYTUN_UDP" = "yes" ]; then + systemctl -q start glorytun-udp@tun0 || true + systemctl -q restart 'glorytun-udp@*' || true + echo 'done' + fi echo 'Restarting omr6in4...' systemctl -q start omr6in4@user0 || true systemctl -q restart omr6in4@* || true @@ -1963,13 +2005,19 @@ else echo 'You can set VPS_DOMAIN to a working domain if you want a certificate.' fi echo 'Apply latest sysctl...' - sysctl -p /etc/sysctl.d/90-shadowsocks.conf > /dev/null 2>&1 + sysctl -p /etc/sysctl.d/90-shadowsocks.conf > /dev/null 2>&1 || true echo 'done' echo 'Restarting omr...' systemctl -q restart omr echo 'done' - echo 'Restarting shadowsocks...' - systemctl -q restart shadowsocks-libev-manager@manager + if [ "$SHADOWSOCKS" = "yes" ]; then + echo 'Restarting shadowsocks...' + systemctl -q restart shadowsocks-libev-manager@manager + fi + if [ "$SHADOWSOCKS_GO" = "yes" ]; then + echo 'Restarting shadowsocks-go...' + systemctl -q restart shadowsocks-go + fi # if [ $NBCPU -gt 1 ]; then # for i in $NBCPU; do # systemctl restart shadowsocks-libev-server@config$i diff --git a/omr-pihole.sh b/omr-pihole.sh index a32acfb..b8b0c27 100644 --- a/omr-pihole.sh +++ b/omr-pihole.sh @@ -37,7 +37,7 @@ mv /etc/pihole/setupVars.new.conf /etc/pihole/setupVars.conf cat >> /etc/pihole/setupVars.conf <<-EOF PIHOLE_INTERFACE=gt-tun0 IPV4_ADDRESS=10.255.0.0/16 -IPV6_ADDRESS=fe80::aff:ff01/64 +IPV6_ADDRESS=fd00::a00:/106 RATE_LIMIT=0/0 EOF