You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rmclient 698B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. if [ $# != 1 ]
  3. then
  4. echo "Usage: rmclient clientname"
  5. exit 1
  6. else
  7. cd /etc/openvpn/easy-rsa/2.0/keys
  8. clientsdir="/etc/openvpn/clients/"
  9. clientdir="$clientsdir$1/"
  10. clientsrmdir="/etc/openvpn/rmclients/"
  11. clientslinkdir="/var/vpn/clients/"
  12. if ! [ -a "$1.crt" ] && ! [ -a "$1.csr" ] && ! [ -a "$1.key" ] && ! [ -a $clientslinkdir"$1.tar.bz2" ] && ! [ -d $clientdir ]
  13. then
  14. echo "Client $1 does not exist"
  15. exit 2
  16. fi
  17. cd ..
  18. source ./vars
  19. ./revoke-full "$1"
  20. cd keys
  21. mkdir -p $clientsrmdir
  22. if [ -d $clientdir ]
  23. then
  24. mv $clientdir $clientsrmdir
  25. else
  26. echo "Client dir does not exist"
  27. fi
  28. htpasswd -D $clientslinkdir'.htpasswd' $1
  29. echo "rmclient completed"
  30. exit 0
  31. fi