Merging branch 486 into master

This commit is contained in:
Dominic Dumrauf (MacBook Pro 2017) 2019-09-18 09:24:22 +01:00
commit 0703161789
2 changed files with 23 additions and 9 deletions

View File

@ -83,6 +83,18 @@ export PASS="1"
./openvpn-install.sh ./openvpn-install.sh
``` ```
### Headless User Removal
The removal of an existing user can also be fully automated. Again, the key is to provide the (string) value of the `MENU_OPTION` variable along with the remaining mandatory variables before invoking the script.
The following Bash script removes the existing user `bar` from an OpenVPN configuration
```bash
#!/bin/bash
export MENU_OPTION="2"
export CLIENT="bar"
./openvpn-install.sh
```
## Features ## Features

View File

@ -1072,16 +1072,18 @@ function revokeClient () {
exit 1 exit 1
fi fi
echo "" until [[ "$CLIENT" =~ ^[a-zA-Z0-9_]+$ ]]; do
echo "Select the existing client certificate you want to revoke" echo ""
tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | nl -s ') ' echo "Select the existing client certificate you want to revoke"
if [[ "$NUMBEROFCLIENTS" = '1' ]]; then tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | nl -s ') '
read -rp "Select one client [1]: " CLIENTNUMBER if [[ "$NUMBEROFCLIENTS" = '1' ]]; then
else read -rp "Select one client [1]: " CLIENTNUMBER
read -rp "Select one client [1-$NUMBEROFCLIENTS]: " CLIENTNUMBER else
fi read -rp "Select one client [1-$NUMBEROFCLIENTS]: " CLIENTNUMBER
fi
CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p) CLIENT=$(tail -n +2 /etc/openvpn/easy-rsa/pki/index.txt | grep "^V" | cut -d '=' -f 2 | sed -n "$CLIENTNUMBER"p)
done
cd /etc/openvpn/easy-rsa/ cd /etc/openvpn/easy-rsa/
./easyrsa --batch revoke "$CLIENT" ./easyrsa --batch revoke "$CLIENT"
EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl EASYRSA_CRL_DAYS=3650 ./easyrsa gen-crl