mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
a432e187b9
If user had space in some cert fields, like city was "Fort Worth" the current way would have fell apart. This fixes these issues in 'pivpn list' and hence 'pivpn revoke'
31 lines
857 B
Bash
31 lines
857 B
Bash
#!/usr/bin/env bash
|
|
# PiVPN: list clients script
|
|
|
|
INDEX="/etc/openvpn/easy-rsa/keys/index.txt"
|
|
printf "\n"
|
|
if [ ! -f $INDEX ]; then
|
|
printf "The file: $INDEX \n"
|
|
printf "Was not Found!\n"
|
|
exit 1
|
|
fi
|
|
|
|
printf ": NOTE : The first entry should always be your valid server!\n"
|
|
printf "\n"
|
|
printf "\e[1m::: Certificate Status List :::\e[0m\n"
|
|
printf " ::\e[4m Status \e[0m||\e[4m Name \e[0m:: \n"
|
|
|
|
while read -r line || [[ -n "$line" ]]; do
|
|
status=$(echo $line | awk '{print $1}')
|
|
var=$(echo $line | sed -e 's/^.*CN=\([^/]*\)\/.*/\1/')
|
|
if [[ $status = "V" ]]; then
|
|
printf " Valid :: "
|
|
printf " $var\n"
|
|
elif [[ $status = "R" ]]; then
|
|
printf " Revoked :: "
|
|
printf " $var\n"
|
|
else
|
|
printf " Unknown :: \n"
|
|
printf " $var\n"
|
|
fi
|
|
done <$INDEX
|
|
printf "\n"
|