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}')
|
STATUS=$(echo "$line" | awk '{print $1}')
|
||||||
if [[ "${STATUS}" = "V" ]]; then
|
if [[ "${STATUS}" = "V" ]]; then
|
||||||
NAME=$(echo "$line" | sed -e 's:.*/CN=::')
|
NAME=$(echo "$line" | sed -e 's:.*/CN=::')
|
||||||
CERTS[$i]=${NAME}
|
|
||||||
if [ "$i" != 0 ]; then
|
if [ "$i" != 0 ]; then
|
||||||
# Prevent printing "server" certificate
|
# Prevent printing "server" certificate
|
||||||
printf " %s\n" "$NAME"
|
CERTS[$i]=${NAME}
|
||||||
fi
|
fi
|
||||||
let i=i+1
|
let i=i+1
|
||||||
fi
|
fi
|
||||||
done <${INDEX}
|
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"
|
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
|
read -r NAME
|
||||||
|
|
||||||
if [[ -z "${NAME}" ]]; then
|
if [[ -z "${NAME}" ]]; then
|
||||||
|
@ -70,6 +76,10 @@ if [[ -z "${CERTS_TO_REVOKE}" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ${NAME} =~ $re ]] ; then
|
||||||
|
NAME=${CERTS[$(($NAME))]}
|
||||||
|
fi
|
||||||
|
|
||||||
for((x=1;x<=i;++x)); do
|
for((x=1;x<=i;++x)); do
|
||||||
if [ "${CERTS[$x]}" = "${NAME}" ]; then
|
if [ "${CERTS[$x]}" = "${NAME}" ]; then
|
||||||
VALID=1
|
VALID=1
|
||||||
|
|
Loading…
Reference in a new issue