pptp adduser proc refactoring

master
bedefaced 9 years ago committed by bedefaced
parent 1b484cf3c4
commit 4f950271de
  1. 1
      ipsec/ipsec.conf.dist
  2. 75
      pptp/adduser.sh
  3. 8
      pptp/install.sh

@ -15,6 +15,5 @@ conn L2TP-PSK-NAT
dpddelay=30 dpddelay=30
dpdtimeout=120 dpdtimeout=120
dpdaction=clear 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! 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! 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!

@ -8,28 +8,34 @@ if [[ ! -e $CHAPSECRETS ]] || [[ ! -r $CHAPSECRETS ]] || [[ ! -w $CHAPSECRETS ]]
exit 1 exit 1
fi fi
if [[ $# -gt 0 ]]; then ADDUSER="no"
LOGIN="$1" ANSUSER="yes"
fi
while [[ -z "$LOGIN" ]]; while [ "$ANSUSER" != "$ADDUSER" ];
do do
if [[ $# -gt 0 ]]; then
LOGIN="$1"
fi
while [[ -z "$LOGIN" ]];
do
read -p "Enter name: " LOGIN read -p "Enter name: " LOGIN
done done
unset PASSWORD unset PASSWORD
while [[ -z "$PASSWORD" ]]; while [[ -z "$PASSWORD" ]];
do do
read -p "Enter password: " PASSWORD read -p "Enter password: " PASSWORD
echo echo
done done
DELETED=0 DELETED=0
$DIR/checkuser.sh $LOGIN $DIR/checkuser.sh $LOGIN
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
NOTREM="no" NOTREM="no"
read -p "User '$LOGIN' already exists. Do you want to remove existing user? [no] " ANSREM read -p "User '$LOGIN' already exists. Do you want to remove existing user? [no] " ANSREM
: ${ANSREM:=$NOTREM} : ${ANSREM:=$NOTREM}
@ -40,25 +46,34 @@ if [[ $? -eq 0 ]]; then
$DIR/deluser.sh $LOGIN $DIR/deluser.sh $LOGIN
DELETED=1 DELETED=1
fi fi
fi fi
echo -e "$LOGIN\t *\t $PASSWORD\t *" >> $CHAPSECRETS echo -e "$LOGIN\t *\t $PASSWORD\t *" >> $CHAPSECRETS
if [ $DELETED -eq 0 ]; then if [ $DELETED -eq 0 ]; then
echo "$CHAPSECRETS updated!" echo "$CHAPSECRETS updated!"
fi 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."
STARTDIR=$(pwd) if [[ $# -eq 0 ]]; then
echo
mkdir "$STARTDIR/$LOGIN" read -p "Would you want add another user? [no] " ANSUSER
DISTFILE=$STARTDIR/$LOGIN/setup.sh : ${ANSUSER:=$ADDUSER}
cp -rf setup.sh.dist "$DISTFILE" else
sed -i -e "s@_LOGIN_@$LOGIN@g" "$DISTFILE" ANSUSER=$ADDUSER
sed -i -e "s@_PASSWORD_@$PASSWORD@g" "$DISTFILE" fi
sed -i -e "s@_REMOTEIP_@$IP@g" "$DISTFILE" done
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."

@ -17,13 +17,7 @@ ANSUSER="yes"
echo echo
echo "Configuring VPN users..." echo "Configuring VPN users..."
while [ "$ANSUSER" != "$ADDUSER" ]; $DIR/adduser.sh
do
$DIR/adduser.sh
read -p "Would you want add another user? [no] " ANSUSER
: ${ANSUSER:=$ADDUSER}
done
echo echo
echo "Configuring iptables firewall..." echo "Configuring iptables firewall..."

Loading…
Cancel
Save