1
0
Fork 0
mirror of synced 2025-04-05 06:03:33 +03:00
This commit is contained in:
Ernesto Serrano 2018-02-18 04:52:05 +00:00 committed by GitHub
commit b00ce196d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

25
extras/add_vpn_user.sh Normal file
View 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