added vpnc_config.sh
This commit is contained in:
parent
2294262fba
commit
d49b956fff
|
@ -0,0 +1,100 @@
|
|||
#!/bin/bash
|
||||
|
||||
clear
|
||||
|
||||
echo "
|
||||
########################################################
|
||||
#### Installation and configuration of vpnc ####
|
||||
#### ####
|
||||
#### Cisco VPN Config Script ####
|
||||
#### ####
|
||||
#### Scriptauthor: David Starzengruber ####
|
||||
########################################################
|
||||
"
|
||||
|
||||
# scriptconfiguration (if you want to skip the config wizard)
|
||||
connection_name="aec"
|
||||
vpn_user="<user>"
|
||||
vpn_password="<password>"
|
||||
vpn_gate="<ip>"
|
||||
vpn_group="<vpn-group>"
|
||||
vpn_group_password="<group-secret>"
|
||||
command=""
|
||||
|
||||
# sudo check
|
||||
if [ $USER != "root" ]; then
|
||||
echo "
|
||||
Sorry $USER, you need to run this script as user root! (try: sudo ./vpnc.sh)
|
||||
"
|
||||
exit
|
||||
fi
|
||||
|
||||
# configuration wizard
|
||||
clear
|
||||
echo "Cisco VPN config wizard"
|
||||
echo "Enter a name for this connection:"
|
||||
read connection_name
|
||||
clear
|
||||
echo "Cisco VPN config wizard"
|
||||
echo "Enter $connection_name VPN Gateway:"
|
||||
read vpn_gate
|
||||
clear
|
||||
echo "Cisco VPN config wizard"
|
||||
echo "Enter $connection_name VPN Username:"
|
||||
read vpn_user
|
||||
clear
|
||||
echo "Cisco VPN config wizard"
|
||||
echo "Enter $connection_name VPN Password:"
|
||||
read vpn_password
|
||||
clear
|
||||
echo "Cisco VPN config wizard"
|
||||
echo "Enter $connection_name VPN Group:"
|
||||
read vpn_group
|
||||
clear
|
||||
echo "Cisco VPN config wizard"
|
||||
echo "Enter $connection_name VPN Group Password:"
|
||||
read vpn_group_password
|
||||
clear
|
||||
echo "Cisco VPN config wizard"
|
||||
echo "Enter any command which should be executed on connect:"
|
||||
read command
|
||||
clear
|
||||
|
||||
# installation via package-manager
|
||||
echo Installing vpnc..
|
||||
apt-get install -y vpnc | grep already
|
||||
|
||||
# adding connection script
|
||||
echo "Creating connection script. (/usr/local/bin/connect-$connection_name)"
|
||||
echo "echo Starting VPNC Deamon..
|
||||
sudo vpnc-connect /etc/vpnc/$connection_name.cfg
|
||||
$command
|
||||
echo Custom command executed.
|
||||
" > /usr/local/bin/connect-$connection_name
|
||||
|
||||
# adding configuration file
|
||||
echo "Creating $connection_name configuration file..."
|
||||
echo "IPSec gateway $vpn_gate
|
||||
IPSec ID $vpn_group
|
||||
IPSec secret $vpn_group_password
|
||||
Xauth username $vpn_user
|
||||
Xauth password $vpn_password" > /etc/vpnc/$connection_name.cfg
|
||||
|
||||
#setting executeperms
|
||||
chmod 775 /usr/local/bin/connect-$connection_name
|
||||
|
||||
#finish
|
||||
echo "
|
||||
########################################################
|
||||
#### Installation and configuration of vpnc ####
|
||||
#### ####
|
||||
#### Cisco VPN Config Script ####
|
||||
#### ####
|
||||
#### Scriptauthor: David Starzengruber ####
|
||||
########################################################
|
||||
"
|
||||
echo "Everythings done!
|
||||
Configfilepath: /etc/vpnc/$connection_name.cfg
|
||||
Startscriptpath: /usr/local/bin/connect-$connection_name
|
||||
VPN connect command: connect-$connection_name
|
||||
"
|
Loading…
Reference in New Issue