pptp adduser proc refactoring
This commit is contained in:
parent
1b484cf3c4
commit
4f950271de
@ -15,6 +15,5 @@ conn L2TP-PSK-NAT
|
||||
dpddelay=30
|
||||
dpdtimeout=120
|
||||
dpdaction=clear
|
||||
keyexchange=ikev2
|
||||
ike=aes128-sha1-modp1024,aes128-sha1-modp1536,aes128-sha1-modp2048,aes128-sha256-ecp256,aes128-sha256-modp1024,aes128-sha256-modp1536,aes128-sha256-modp2048,aes256-aes128-sha256-sha1-modp2048-modp4096-modp1024,aes256-sha1-modp1024,aes256-sha256-modp1024,aes256-sha256-modp1536,aes256-sha256-modp2048,aes256-sha256-modp4096,aes256-sha384-ecp384,aes256-sha384-modp1024,aes256-sha384-modp1536,aes256-sha384-modp2048,aes256-sha384-modp4096,aes256gcm16-aes256gcm12-aes128gcm16-aes128gcm12-sha256-sha1-modp2048-modp4096-modp1024,3des-sha1-modp1024!
|
||||
esp=aes128-aes256-sha1-sha256-modp2048-modp4096-modp1024,aes128-sha1,aes128-sha1-modp1024,aes128-sha1-modp1536,aes128-sha1-modp2048,aes128-sha256,aes128-sha256-ecp256,aes128-sha256-modp1024,aes128-sha256-modp1536,aes128-sha256-modp2048,aes128gcm12-aes128gcm16-aes256gcm12-aes256gcm16-modp2048-modp4096-modp1024,aes128gcm16,aes128gcm16-ecp256,aes256-sha1,aes256-sha256,aes256-sha256-modp1024,aes256-sha256-modp1536,aes256-sha256-modp2048,aes256-sha256-modp4096,aes256-sha384,aes256-sha384-ecp384,aes256-sha384-modp1024,aes256-sha384-modp1536,aes256-sha384-modp2048,aes256-sha384-modp4096,aes256gcm16,aes256gcm16-ecp384,3des-sha1!
|
||||
|
||||
107
pptp/adduser.sh
107
pptp/adduser.sh
@ -8,57 +8,72 @@ if [[ ! -e $CHAPSECRETS ]] || [[ ! -r $CHAPSECRETS ]] || [[ ! -w $CHAPSECRETS ]]
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
LOGIN="$1"
|
||||
fi
|
||||
ADDUSER="no"
|
||||
ANSUSER="yes"
|
||||
|
||||
while [[ -z "$LOGIN" ]];
|
||||
while [ "$ANSUSER" != "$ADDUSER" ];
|
||||
do
|
||||
read -p "Enter name: " LOGIN
|
||||
done
|
||||
|
||||
unset PASSWORD
|
||||
|
||||
while [[ -z "$PASSWORD" ]];
|
||||
do
|
||||
read -p "Enter password: " PASSWORD
|
||||
echo
|
||||
done
|
||||
|
||||
DELETED=0
|
||||
|
||||
$DIR/checkuser.sh $LOGIN
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
NOTREM="no"
|
||||
read -p "User '$LOGIN' already exists. Do you want to remove existing user? [no] " ANSREM
|
||||
: ${ANSREM:=$NOTREM}
|
||||
|
||||
if [ "$NOTREM" == "$ANSREM" ]; then
|
||||
exit 1
|
||||
else
|
||||
$DIR/deluser.sh $LOGIN
|
||||
DELETED=1
|
||||
if [[ $# -gt 0 ]]; then
|
||||
LOGIN="$1"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "$LOGIN\t *\t $PASSWORD\t *" >> $CHAPSECRETS
|
||||
while [[ -z "$LOGIN" ]];
|
||||
do
|
||||
read -p "Enter name: " LOGIN
|
||||
done
|
||||
|
||||
if [ $DELETED -eq 0 ]; then
|
||||
echo "$CHAPSECRETS updated!"
|
||||
fi
|
||||
unset PASSWORD
|
||||
|
||||
STARTDIR=$(pwd)
|
||||
while [[ -z "$PASSWORD" ]];
|
||||
do
|
||||
read -p "Enter password: " PASSWORD
|
||||
echo
|
||||
done
|
||||
|
||||
mkdir "$STARTDIR/$LOGIN"
|
||||
DISTFILE=$STARTDIR/$LOGIN/setup.sh
|
||||
cp -rf setup.sh.dist "$DISTFILE"
|
||||
sed -i -e "s@_LOGIN_@$LOGIN@g" "$DISTFILE"
|
||||
sed -i -e "s@_PASSWORD_@$PASSWORD@g" "$DISTFILE"
|
||||
sed -i -e "s@_REMOTEIP_@$IP@g" "$DISTFILE"
|
||||
sed -i -e "s@_LOCALPREFIX_@$LOCALPREFIX@g" "$DISTFILE"
|
||||
chmod +x "$DISTFILE"
|
||||
USERNAME=${SUDO_USER:-$USER}
|
||||
chown -R $USERNAME:$USERNAME $STARTDIR/$LOGIN/
|
||||
echo
|
||||
echo "Created directory $STARTDIR/$LOGIN with client-side installation file."
|
||||
DELETED=0
|
||||
|
||||
$DIR/checkuser.sh $LOGIN
|
||||
|
||||
if [[ $? -eq 0 ]]; then
|
||||
NOTREM="no"
|
||||
read -p "User '$LOGIN' already exists. Do you want to remove existing user? [no] " ANSREM
|
||||
: ${ANSREM:=$NOTREM}
|
||||
|
||||
if [ "$NOTREM" == "$ANSREM" ]; then
|
||||
exit 1
|
||||
else
|
||||
$DIR/deluser.sh $LOGIN
|
||||
DELETED=1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "$LOGIN\t *\t $PASSWORD\t *" >> $CHAPSECRETS
|
||||
|
||||
if [ $DELETED -eq 0 ]; then
|
||||
echo "$CHAPSECRETS updated!"
|
||||
fi
|
||||
|
||||
STARTDIR=$(pwd)
|
||||
|
||||
mkdir "$STARTDIR/$LOGIN"
|
||||
DISTFILE=$STARTDIR/$LOGIN/setup.sh
|
||||
cp -rf setup.sh.dist "$DISTFILE"
|
||||
sed -i -e "s@_LOGIN_@$LOGIN@g" "$DISTFILE"
|
||||
sed -i -e "s@_PASSWORD_@$PASSWORD@g" "$DISTFILE"
|
||||
sed -i -e "s@_REMOTEIP_@$IP@g" "$DISTFILE"
|
||||
sed -i -e "s@_LOCALPREFIX_@$LOCALPREFIX@g" "$DISTFILE"
|
||||
chmod +x "$DISTFILE"
|
||||
USERNAME=${SUDO_USER:-$USER}
|
||||
chown -R $USERNAME:$USERNAME $STARTDIR/$LOGIN/
|
||||
echo
|
||||
echo "Created directory $STARTDIR/$LOGIN with client-side installation file."
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo
|
||||
read -p "Would you want add another user? [no] " ANSUSER
|
||||
: ${ANSUSER:=$ADDUSER}
|
||||
else
|
||||
ANSUSER=$ADDUSER
|
||||
fi
|
||||
done
|
||||
|
||||
@ -17,13 +17,7 @@ ANSUSER="yes"
|
||||
|
||||
echo
|
||||
echo "Configuring VPN users..."
|
||||
while [ "$ANSUSER" != "$ADDUSER" ];
|
||||
do
|
||||
$DIR/adduser.sh
|
||||
|
||||
read -p "Would you want add another user? [no] " ANSUSER
|
||||
: ${ANSUSER:=$ADDUSER}
|
||||
done
|
||||
$DIR/adduser.sh
|
||||
|
||||
echo
|
||||
echo "Configuring iptables firewall..."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user