Added back Debian 10 support

This commit is contained in:
Orazio 2019-10-14 15:06:34 +02:00
parent 5e16322f9e
commit 1777d5c239
3 changed files with 60 additions and 30 deletions

View file

@ -1,10 +1,16 @@
#!/usr/bin/env bash
# PiVPN: revoke client script
install_user=$(</etc/pivpn/install_user)
PLAT=$(</etc/pivpn/DET_PLATFORM)
setupVars="/etc/pivpn/setupVars.conf"
INDEX="/etc/openvpn/easy-rsa/pki/index.txt"
if [ ! -f "${setupVars}" ]; then
echo "::: Missing setup vars file!"
exit 1
fi
source "${setupVars}"
helpFunc() {
echo "::: Revoke a client ovpn profile"
echo ":::"
@ -56,7 +62,7 @@ if [[ -z "${CERTS_TO_REVOKE}" ]]; then
done <${INDEX}
printf "\n"
echo "::: Please enter the Name of the client to be revoked from the list above:"
echo -n "::: Please enter the Name of the client to be revoked from the list above: "
read -r NAME
if [[ -z "${NAME}" ]]; then
@ -104,8 +110,6 @@ fi
cd /etc/openvpn/easy-rsa || exit
install_home=$(grep -m1 "^${install_user}:" /etc/passwd | cut -d: -f6)
install_home=${install_home%/} # remove possible trailing slash
for (( ii = 0; ii < ${#CERTS_TO_REVOKE[@]}; ii++)); do
printf "\n::: Revoking certificate '"%s"'.\n" "${CERTS_TO_REVOKE[ii]}"
./easyrsa --batch revoke "${CERTS_TO_REVOKE[ii]}"