Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # FIRST PART
- cd /root
- #check for new version @ http://www.softether-download.com/
- wget http://www.softether-download.com/files/softether/v4.10-9473-beta-2014.07.12-tree/Linux/SoftEther_VPN_Server/64bit_-_Intel_x64_or_AMD64/softether-vpnserver-v4.10-9473-beta-2014.07.12-linux-x64-64bit.tar.gz
- tar xzvf softether-vpnserver-v4.10-9473-beta-2014.07.12-linux-x64-64bit.tar.gz
- rm -v *.gz
- cd vpnserver
- expect -c "
- spawn make
- expect \"Please choose one of above number:\" { send \"1\\r\" }
- expect \"Please choose one of above number:\" { send \"1\\r\" }
- expect \"Please choose one of above number:\" { send \"1\\r\" }
- expect \"#\" { send \"\\r\" }
- "
- cd ..
- mv -v vpnserver /usr/local
- cd /usr/local/vpnserver/
- chmod -v 600 *
- chmod -v 700 vpnserver
- chmod -v 700 vpncmd
- echo -e "#!/bin/sh
- # chkconfig: 2345 99 01
- # description: SoftEther VPN Server
- DAEMON=/usr/local/vpnserver/vpnserver
- LOCK=/var/lock/subsys/vpnserver
- test -x \$DAEMON || exit 0
- case \"\$1\" in
- start)
- \$DAEMON start
- touch \$LOCK
- ;;
- stop)
- \$DAEMON stop
- rm \$LOCK
- ;;
- restart)
- \$DAEMON stop
- sleep 3
- \$DAEMON start
- ;;
- *)
- echo \"Usage: \$0 {start|stop|restart}\"
- exit 1
- esac
- exit 0
- " >> /etc/init.d/vpnserver
- mkdir -v /var/lock/subsys
- chmod -v 755 /etc/init.d/vpnserver && /etc/init.d/vpnserver start
- update-rc.d vpnserver defaults
- # SECOND PART
- vpnnewport="xxx"
- vpnadminpw="xxx"
- vpnhubpw="xxx"
- vpnusername="xxx"
- vpnuserpw="xxx"
- vpnpsk="xxx"
- expect -c "
- spawn ./vpncmd
- expect \"Select 1, 2 or 3:\" { send \"1\\r\" }
- expect \"Hostname of IP Address of Destination:\" { send \"\\r\" }
- expect \"Specify Virtual Hub Name:\" { send \"\\r\" }
- expect \"VPN Server>\" { send \"ServerPasswordSet\\r\" }
- expect \"Password:\" { send \"$vpnadminpw\\r\" }
- expect \"Confirm input:\" { send \"$vpnadminpw\\r\" }
- expect \"VPN Server>\" { send \"HubCreate VPN\\r\" }
- expect \"Password:\" { send \"$vpnhubpw\\r\" }
- expect \"Confirm input:\" { send \"$vpnhubpw\\r\" }
- expect \"VPN Server>\" { send \"ListenerDelete 443\\r\" }
- expect \"VPN Server>\" { send \"ListenerDelete 992\\r\" }
- expect \"VPN Server>\" { send \"ListenerDelete 1194\\r\" }
- expect \"VPN Server>\" { send \"ListenerDelete 5555\\r\" }
- expect \"VPN Server>\" { send \"ListenerCreate $vpnnewport\\r\" }
- expect \"VPN Server>\" { send \"Hub VPN\\r\" }
- expect \"VPN Server/VPN>\" { send \"SecureNatEnable\\r\" }
- expect \"VPN Server/VPN>\" { send \"UserCreate $vpnusername\\r\" }
- expect \"Assigned Group Name:\" { send \"\\r\" }
- expect \"User Full Name:\" { send \"\\r\" }
- expect \"User Description:\" { send \"\\r\" }
- expect \"VPN Server/VPN>\" { send \"UserPasswordSet $vpnusername\\r\" }
- expect \"Password:\" { send \"$vpnuserpw\\r\" }
- expect \"Confirm input:\" { send \"$vpnuserpw\\r\" }
- expect \"VPN Server/VPN>\" { send \"IPsecEnable\\r\" }
- expect \"Enable L2TP over IPsec Server Function (yes / no):\" { send \"y\\r\" }
- expect \"Enable Raw L2TP Server Function (yes / no):\" { send \"n\\r\" }
- expect \"Enable EtherIP / L2TPv3 over IPsec Server Function (yes / no):\" { send \"n\\r\" }
- expect \"Pre Shared Key for IPsec (Recommended: 9 letters at maximum):\" { send \"$vpnpsk\\r\" }
- expect \"Default Virtual HUB in a case of omitting the HUB on the Username:\" { send \"VPN\\r\" }
- expect \"VPN Server/VPN>\" { send \"quit\\r\" }
- expect \"#\" { send \"\\r\" }
- "
- echo -e "\n > default config applied \n"
- iptables -A INPUT -p tcp --dport $vpnnewport -j ACCEPT
- echo -e " > incoming connections to port $vpnnewport allowed (vpn) "
- service iptables-persistent save
- echo -e " > iptables rules updated \n "
- cd /root
- echo -e "alias vpncmd=\"/usr/local/vpnserver/./vpncmd\"" >> .bash_profile
- source ~/.bash_profile
- echo -e " > vpncmd alias created "
- echo -e "\n > softhether installed \n "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement