2020-11-04 20:45:56 +03:00
|
|
|
#!/bin/bash
|
2019-01-05 17:18:39 +03:00
|
|
|
|
|
|
|
set -eux
|
|
|
|
|
2020-07-21 22:11:57 +03:00
|
|
|
BUILD_BINARIESDIRECTORY="${BUILD_BINARIESDIRECTORY:-build}"
|
2019-01-05 17:18:39 +03:00
|
|
|
|
2020-07-21 22:11:57 +03:00
|
|
|
cd $BUILD_BINARIESDIRECTORY
|
2019-01-05 17:18:39 +03:00
|
|
|
|
2020-07-21 22:11:57 +03:00
|
|
|
./vpnserver start
|
|
|
|
|
2020-11-04 20:45:56 +03:00
|
|
|
#
|
|
|
|
# wait until server listen 443
|
|
|
|
#
|
|
|
|
set +e
|
|
|
|
started="false"
|
|
|
|
for i in 1 2 3 4 5 6
|
|
|
|
do
|
|
|
|
s=$(echo exit | telnet 127.0.0.1 443 | grep "Connected")
|
|
|
|
if [ "$s" != "" ]
|
|
|
|
then
|
|
|
|
started="true"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
sleep 10
|
|
|
|
done
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if [ "$started" == "false" ]
|
|
|
|
then
|
|
|
|
echo "vpnserver is not listening 127.0.0.1:443"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-07-21 22:11:57 +03:00
|
|
|
./vpncmd 127.0.0.1:443 /SERVER /HUB:DEFAULT /CMD:SecureNatEnable
|
2020-07-20 04:36:03 +03:00
|
|
|
./vpncmd 127.0.0.1:443 /SERVER /CMD:"ProtoOptionsSet OpenVPN /NAME:Enabled /VALUE:True"
|
2020-07-21 22:11:57 +03:00
|
|
|
./vpncmd 127.0.0.1:443 /SERVER /CMD:"PortsUDPSet 1194"
|
|
|
|
./vpncmd 127.0.0.1:443 /SERVER /HUB:DEFAULT /CMD:"UserCreate test /GROUP:none /REALNAME:none /NOTE:none"
|
|
|
|
./vpncmd 127.0.0.1:443 /SERVER /HUB:DEFAULT /CMD:"UserPasswordSet test /PASSWORD:test"
|
|
|
|
./vpncmd 127.0.0.1:443 /SERVER /CMD:"OpenVpnMakeConfig my_openvpn_config.zip"
|
|
|
|
|
|
|
|
unzip -d /tmp my_openvpn_config.zip
|