Create add_vpn_user.sh
Added a simple script for adding new vpn users
This commit is contained in:
parent
076406b80c
commit
93a66c380b
25
extras/add_vpn_user.sh
Normal file
25
extras/add_vpn_user.sh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Script for adding a new vpn user
|
||||||
|
# Usage: ./add_vpn_user.sh username pa$$word
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
echo "This script must be run as root"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $# -ne 2 ]] ; then
|
||||||
|
echo 'Usage: add_vpn_user.sh username pa$$word'
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Adding user..."
|
||||||
|
|
||||||
|
echo "\"$1\" l2tpd \"$2\" *" | tee -a /etc/ppp/chap-secrets > /dev/null
|
||||||
|
echo "$1:$(openssl passwd -1 $2):xauth-psk" | tee -a /etc/ipsec.d/passwd > /dev/null
|
||||||
|
|
||||||
|
echo "Restarting vpn service..."
|
||||||
|
|
||||||
|
service ipsec restart
|
||||||
|
service xl2tpd restart
|
Loading…
x
Reference in New Issue
Block a user