mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
Add Index for OpenVPN remover command
This commit is contained in:
parent
934aff8871
commit
c00e208286
1 changed files with 13 additions and 3 deletions
|
@ -52,17 +52,23 @@ if [[ -z "${CERTS_TO_REVOKE}" ]]; then
|
|||
STATUS=$(echo "$line" | awk '{print $1}')
|
||||
if [[ "${STATUS}" = "V" ]]; then
|
||||
NAME=$(echo "$line" | sed -e 's:.*/CN=::')
|
||||
CERTS[$i]=${NAME}
|
||||
if [ "$i" != 0 ]; then
|
||||
# Prevent printing "server" certificate
|
||||
printf " %s\n" "$NAME"
|
||||
CERTS[$i]=${NAME}
|
||||
fi
|
||||
let i=i+1
|
||||
fi
|
||||
done <${INDEX}
|
||||
|
||||
i=1
|
||||
len=${#CERTS[@]}
|
||||
while [ $i -le ${len} ]; do
|
||||
printf "[%0${#len}s] %s\r\n" ${i} ${CERTS[(($i))]}
|
||||
((i++))
|
||||
done
|
||||
printf "\n"
|
||||
|
||||
echo -n "::: Please enter the Name of the client to be revoked from the list above: "
|
||||
echo -n "::: Please enter the Index/Name of the client to be revoked from the list above: "
|
||||
read -r NAME
|
||||
|
||||
if [[ -z "${NAME}" ]]; then
|
||||
|
@ -70,6 +76,10 @@ if [[ -z "${CERTS_TO_REVOKE}" ]]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${NAME} =~ $re ]] ; then
|
||||
NAME=${CERTS[$(($NAME))]}
|
||||
fi
|
||||
|
||||
for((x=1;x<=i;++x)); do
|
||||
if [ "${CERTS[$x]}" = "${NAME}" ]; then
|
||||
VALID=1
|
||||
|
|
Loading…
Reference in a new issue