1234567891011121314151617181920212223242526272829303132333435 |
- #!/bin/bash
- if [ $# != 1 ]
- then
- echo "Usage: rmclient clientname"
- exit 1
- else
- cd /etc/openvpn/easy-rsa/2.0/keys
- clientsdir="/etc/openvpn/clients/"
- clientdir="$clientsdir$1/"
- clientsrmdir="/etc/openvpn/rmclients/"
- clientslinkdir="/var/vpn/clients/"
- if ! [ -a "$1.crt" ] && ! [ -a "$1.csr" ] && ! [ -a "$1.key" ] && ! [ -a $clientslinkdir"$1.tar.bz2" ] && ! [ -d $clientdir ]
- then
- echo "Client $1 does not exist"
- exit 2
- fi
-
- cd ..
- source ./vars
- ./revoke-full "$1"
- cd keys
- mkdir -p $clientsrmdir
-
- if [ -d $clientdir ]
- then
- mv $clientdir $clientsrmdir
- else
- echo "Client dir does not exist"
- fi
-
- htpasswd -D $clientslinkdir'.htpasswd' $1
-
- echo "rmclient completed"
- exit 0
- fi
|