SHARE
TWEET

Untitled

a guest Jul 20th, 2014 238 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # FIRST PART
  4.  
  5. cd /root
  6.  
  7. #check for new version @ http://www.softether-download.com/
  8.  
  9. 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
  10.  
  11. tar xzvf softether-vpnserver-v4.10-9473-beta-2014.07.12-linux-x64-64bit.tar.gz
  12.  
  13. rm -v *.gz
  14. cd vpnserver
  15.  
  16. expect -c "
  17. spawn make
  18. expect \"Please choose one of above number:\" { send \"1\\r\" }
  19. expect \"Please choose one of above number:\" { send \"1\\r\" }
  20. expect \"Please choose one of above number:\" { send \"1\\r\" }
  21. expect \"#\" { send \"\\r\" }
  22. "
  23.  
  24. cd ..
  25. mv -v vpnserver /usr/local
  26. cd /usr/local/vpnserver/
  27.  
  28. chmod -v 600 *
  29. chmod -v 700 vpnserver
  30. chmod -v 700 vpncmd
  31.  
  32. echo -e "#!/bin/sh
  33. # chkconfig: 2345 99 01
  34. # description: SoftEther VPN Server
  35. DAEMON=/usr/local/vpnserver/vpnserver
  36. LOCK=/var/lock/subsys/vpnserver
  37. test -x \$DAEMON || exit 0
  38. case \"\$1\" in
  39. start)
  40. \$DAEMON start
  41. touch \$LOCK
  42. ;;
  43. stop)
  44. \$DAEMON stop
  45. rm \$LOCK
  46. ;;
  47. restart)
  48. \$DAEMON stop
  49. sleep 3
  50. \$DAEMON start
  51. ;;
  52. *)
  53. echo \"Usage: \$0 {start|stop|restart}\"
  54. exit 1
  55. esac
  56. exit 0
  57. " >> /etc/init.d/vpnserver
  58.  
  59. mkdir -v /var/lock/subsys
  60.  
  61. chmod -v 755 /etc/init.d/vpnserver && /etc/init.d/vpnserver start
  62.  
  63. update-rc.d vpnserver defaults
  64.  
  65.  
  66. # SECOND PART
  67.  
  68. vpnnewport="xxx"
  69. vpnadminpw="xxx"
  70. vpnhubpw="xxx"
  71. vpnusername="xxx"
  72. vpnuserpw="xxx"
  73. vpnpsk="xxx"
  74.  
  75. expect -c "
  76. spawn ./vpncmd
  77. expect \"Select 1, 2 or 3:\" { send \"1\\r\" }
  78. expect \"Hostname of IP Address of Destination:\" { send \"\\r\" }
  79. expect \"Specify Virtual Hub Name:\" { send \"\\r\" }
  80. expect \"VPN Server>\" { send \"ServerPasswordSet\\r\" }
  81. expect \"Password:\" { send \"$vpnadminpw\\r\" }
  82. expect \"Confirm input:\" { send \"$vpnadminpw\\r\" }
  83. expect \"VPN Server>\" { send \"HubCreate VPN\\r\" }
  84. expect \"Password:\" { send \"$vpnhubpw\\r\" }
  85. expect \"Confirm input:\" { send \"$vpnhubpw\\r\" }
  86. expect \"VPN Server>\" { send \"ListenerDelete 443\\r\" }
  87. expect \"VPN Server>\" { send \"ListenerDelete 992\\r\" }
  88. expect \"VPN Server>\" { send \"ListenerDelete 1194\\r\" }
  89. expect \"VPN Server>\" { send \"ListenerDelete 5555\\r\" }
  90. expect \"VPN Server>\" { send \"ListenerCreate $vpnnewport\\r\" }
  91. expect \"VPN Server>\" { send \"Hub VPN\\r\" }
  92. expect \"VPN Server/VPN>\" { send \"SecureNatEnable\\r\" }
  93. expect \"VPN Server/VPN>\" { send \"UserCreate $vpnusername\\r\" }
  94. expect \"Assigned Group Name:\" { send \"\\r\" }
  95. expect \"User Full Name:\" { send \"\\r\" }
  96. expect \"User Description:\" { send \"\\r\" }
  97. expect \"VPN Server/VPN>\" { send \"UserPasswordSet $vpnusername\\r\" }
  98. expect \"Password:\" { send \"$vpnuserpw\\r\" }
  99. expect \"Confirm input:\" { send \"$vpnuserpw\\r\" }
  100. expect \"VPN Server/VPN>\" { send \"IPsecEnable\\r\" }
  101. expect \"Enable L2TP over IPsec Server Function (yes / no):\" { send \"y\\r\" }
  102. expect \"Enable Raw L2TP Server Function (yes / no):\" { send \"n\\r\" }
  103. expect \"Enable EtherIP / L2TPv3 over IPsec Server Function (yes / no):\" { send \"n\\r\" }
  104. expect \"Pre Shared Key for IPsec (Recommended: 9 letters at maximum):\" { send \"$vpnpsk\\r\" }
  105. expect \"Default Virtual HUB in a case of omitting the HUB on the Username:\" { send \"VPN\\r\" }
  106. expect \"VPN Server/VPN>\" { send \"quit\\r\" }
  107. expect \"#\" { send \"\\r\" }
  108. "
  109.  
  110. echo -e "\n > default config applied \n"
  111.  
  112. iptables -A INPUT -p tcp --dport $vpnnewport -j ACCEPT
  113. echo -e " > incoming connections to port $vpnnewport allowed (vpn) "
  114. service iptables-persistent save
  115. echo -e " > iptables rules updated \n "
  116.  
  117. cd /root
  118. echo -e "alias vpncmd=\"/usr/local/vpnserver/./vpncmd\"" >> .bash_profile
  119. source ~/.bash_profile
  120. echo -e " > vpncmd alias created "
  121.  
  122.  
  123. echo -e "\n > softhether installed \n "
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top