forked from MoeClub/Note
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SoftEther.sh
106 lines (88 loc) · 16 KB
/
SoftEther.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# Author: MoeClub.org
export ADMIN=''
export USER=''
export PASSWD=''
export PORT=''
export SoftEtherURL=''
export SoftEtherVersion='v4.38-9760-rtm-2021.08.17'
export SoftEtherConfig='IyBTb2Z0d2FyZSBDb25maWd1cmF0aW9uIEZpbGUKIyAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KIyAKIyBZb3UgbWF5IGVkaXQgdGhpcyBmaWxlIHdoZW4gdGhlIFZQTiBTZXJ2ZXIgLyBDbGllbnQgLyBCcmlkZ2UgcHJvZ3JhbSBpcyBub3QgcnVubmluZy4KIyAKIyBJbiBwcmlvciB0byBlZGl0IHRoaXMgZmlsZSBtYW51YWxseSBieSB5b3VyIHRleHQgZWRpdG9yLAojIHNodXRkb3duIHRoZSBWUE4gU2VydmVyIC8gQ2xpZW50IC8gQnJpZGdlIGJhY2tncm91bmQgc2VydmljZS4KIyBPdGhlcndpc2UsIGFsbCBjaGFuZ2VzIHdpbGwgYmUgbG9zdC4KIyAKZGVjbGFyZSByb290CnsKCXVpbnQgQ29uZmlnUmV2aXNpb24gMAoJYm9vbCBJUHNlY01lc3NhZ2VEaXNwbGF5ZWQgdHJ1ZQoJc3RyaW5nIFJlZ2lvbiAkCglib29sIFZnc01lc3NhZ2VEaXNwbGF5ZWQgZmFsc2UKCglkZWNsYXJlIEREbnNDbGllbnQKCXsKCQlib29sIERpc2FibGVkIHRydWUKCX0KCWRlY2xh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bGFyZSBVc2VyTGlzdAoJCQkJewoJCQkJfQoJCQl9CgkJCWRlY2xhcmUgVHJhZmZpYwoJCQl7CgkJCX0KCQl9Cgl9CglkZWNsYXJlIFZpcnR1YWxMYXllcjNTd2l0Y2hMaXN0Cgl7Cgl9Cn0K'
while [[ $# -ge 1 ]]; do
case $1 in
-a)
shift
ADMIN=`echo "$1" |sed 's/[[:space:]]//g' |head -n1`
shift
;;
-u)
shift
USER=`echo "$1" |sed 's/[[:space:]]//g' |head -n1`
shift
;;
-p)
shift
PASSWD=`echo "$1" |sed 's/[[:space:]]//g' |head -n1`
shift
;;
-port)
shift
PORT=`echo "$1" |sed 's/[[:space:]]//g' |grep -o '[0-9]\+' |head -n1`
shift
;;
-url)
shift
SoftEtherURL=`echo "$1" |sed 's/[[:space:]]//g'`
shift
;;
-ver)
shift
SoftEtherVersion=`echo "$1" |sed 's/[[:space:]]//g'`
shift
;;
*)
echo -ne " Usage:\n\tbash $(basename $0)\t-a [AdminPasswd] -u [User] -p [Passwd] -port [Port]\n"
exit 1;
;;
esac
done
[ -n "$ADMIN" ] || ADMIN="empty"
[ -n "$USER" ] || USER="vpn"
[ -n "$PASSWD" ] || PASSWD="vpn"
[ -n "$PORT" ] && [ "$PORT" -gt 0 ] && [ "$PORT" -lt 65536 ] || PORT="5555"
case `uname -m` in aarch64|arm64) ARCH="arm64";; x86|i386|i686) ARCH="i386";; x86_64|amd64) ARCH="amd64";; *) ARCH="";; esac
[ -n "$ARCH" ] || exit 1
[ ! -n "$SoftEtherURL" ] && [ "$ARCH" == "arm64" ] && SoftEtherURL="http://www.softether-download.com/files/softether/${SoftEtherVersion}-tree/Linux/SoftEther_VPN_Server/64bit_-_ARM_64bit/softether-vpnserver-${SoftEtherVersion}-linux-arm64-64bit.tar.gz";
[ ! -n "$SoftEtherURL" ] && [ "$ARCH" == "amd64" ] && SoftEtherURL="http://www.softether-download.com/files/softether/${SoftEtherVersion}-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-${SoftEtherVersion}-linux-x64-64bit.tar.gz";
[ ! -n "$SoftEtherURL" ] && [ "$ARCH" == "i386" ] && SoftEtherURL="http://www.softether-download.com/files/softether/${SoftEtherVersion}-tree/Linux/SoftEther_VPN_Server/32bit_-_Intel_x86/softether-vpnserver-${SoftEtherVersion}-linux-x86-32bit.tar.gz";
[ ! -n "$SoftEtherURL" ] && exit 1
rm -rf /tmp/softether.tar.gz
wget --no-check-certificate --no-cache -4 -qO "/tmp/softether.tar.gz" "${SoftEtherURL}"
[ $? -eq 0 ] || exit 1
kill -9 `ps -C "vpnserver" -o pid=` >/dev/null 2>&1
rm -rf /etc/softether
mkdir -p /etc/softether
echo "${SoftEtherConfig}" |base64 -d >/etc/softether/vpn_server.config
sed -i "s/uint Port 5555/uint Port $PORT/" /etc/softether/vpn_server.config
tar -zvxf /tmp/softether.tar.gz -C /tmp
cd /tmp/vpnserver
# make i_read_and_agree_the_license_agreement
make main
[ $? -eq 0 ] || exit 1
[ -f /tmp/vpnserver/vpnserver ] && cp -rf /tmp/vpnserver/vpnserver /etc/softether
[ -f /tmp/vpnserver/vpncmd ] && cp -rf /tmp/vpnserver/vpncmd /etc/softether
[ -f /tmp/vpnserver/hamcore.se2 ] && cp -rf /tmp/vpnserver/hamcore.se2 /etc/softether
[ -f /etc/softether/vpnserver ] && [ -f /etc/softether/vpncmd ] && [ -f /tmp/vpnserver/hamcore.se2 ] || exit 1
chmod -R 755 /etc/softether
if [ -f /etc/crontab ]; then
sed -i '/vpnserver/d' /etc/crontab
while [ -z "$(sed -n '$p' /etc/crontab)" ]; do sed -i '$d' /etc/crontab; done
sed -i "\$a\@reboot root /etc/softether/vpnserver start >>/dev/null 2>&1 &\n\n\n" /etc/crontab
fi
/etc/softether/vpnserver start
while true; do /etc/softether/vpncmd 127.0.0.1:$PORT /SERVER /PASSWORD:empty /CMD:About >/dev/null 2>&1; [ $? -eq 0 ] && break; echo "Waiting vpnserver ..."; sleep 1; done
/etc/softether/vpncmd 127.0.0.1:$PORT /SERVER /PASSWORD:empty /HUB:DEFAULT /CMD:UserCreate "$USER" /GROUP: /REALNAME: /NOTE:
/etc/softether/vpncmd 127.0.0.1:$PORT /SERVER /PASSWORD:empty /HUB:DEFAULT /CMD:UserPasswordSet "$USER" /PASSWORD:"$PASSWD"
/etc/softether/vpncmd 127.0.0.1:$PORT /SERVER /PASSWORD:empty /HUB:DEFAULT /CMD:SetHubPassword "$ADMIN"
/etc/softether/vpncmd 127.0.0.1:$PORT /SERVER /PASSWORD:empty /CMD:ServerPasswordSet "$ADMIN"
/etc/softether/vpnserver stop
/etc/softether/vpnserver start