mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-20 03:40:17 +00:00
add parameter to force remove profile
This commit is contained in:
parent
92f900637e
commit
aa297e5296
1 changed files with 34 additions and 23 deletions
|
@ -14,11 +14,12 @@ source "${setupVars}"
|
||||||
helpFunc() {
|
helpFunc() {
|
||||||
echo "::: Revoke a client ovpn profile"
|
echo "::: Revoke a client ovpn profile"
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Usage: pivpn <-r|revoke> [-h|--help] [<client-1>] ... [<client-n>] ..."
|
echo "::: Usage: pivpn <-r|revoke> [-y|--yes] [-h|--help] [<client-1>] ... [<client-n>] ..."
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo "::: Commands:"
|
echo "::: Commands:"
|
||||||
echo "::: [none] Interactive mode"
|
echo "::: [none] Interactive mode"
|
||||||
echo "::: <client> Client(s) to to revoke"
|
echo "::: <client> Client(s) to to revoke"
|
||||||
|
echo "::: -y,--yes Remove Client(s) without confirmation"
|
||||||
echo "::: -h,--help Show this help dialog"
|
echo "::: -h,--help Show this help dialog"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +32,9 @@ do
|
||||||
helpFunc
|
helpFunc
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
-y|--yes)
|
||||||
|
CONFIRM=true
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
CERTS_TO_REVOKE+=("$1")
|
CERTS_TO_REVOKE+=("$1")
|
||||||
;;
|
;;
|
||||||
|
@ -111,6 +115,12 @@ fi
|
||||||
cd /etc/openvpn/easy-rsa || exit
|
cd /etc/openvpn/easy-rsa || exit
|
||||||
|
|
||||||
for (( ii = 0; ii < ${#CERTS_TO_REVOKE[@]}; ii++)); do
|
for (( ii = 0; ii < ${#CERTS_TO_REVOKE[@]}; ii++)); do
|
||||||
|
if [ -n "$CONFIRM" ]; then
|
||||||
|
REPLY="y"
|
||||||
|
else
|
||||||
|
read -r -p "Do you really want to revoke ${CERTS_TO_REVOKE[ii]}? [Y/n] "
|
||||||
|
fi
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
printf "\n::: Revoking certificate '"%s"'.\n" "${CERTS_TO_REVOKE[ii]}"
|
printf "\n::: Revoking certificate '"%s"'.\n" "${CERTS_TO_REVOKE[ii]}"
|
||||||
./easyrsa --batch revoke "${CERTS_TO_REVOKE[ii]}"
|
./easyrsa --batch revoke "${CERTS_TO_REVOKE[ii]}"
|
||||||
./easyrsa gen-crl
|
./easyrsa gen-crl
|
||||||
|
@ -138,5 +148,6 @@ for (( ii = 0; ii < ${#CERTS_TO_REVOKE[@]}; ii++)); do
|
||||||
echo "::: Failed to reload pihole-FTL configuration"
|
echo "::: Failed to reload pihole-FTL configuration"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
printf "::: Completed!\n"
|
printf "::: Completed!\n"
|
||||||
|
|
Loading…
Reference in a new issue