mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-23 21:30:15 +00:00
Cleaned up listOVPN.sh
This commit is contained in:
parent
caee0858cf
commit
4e0f9ac0ff
1 changed files with 10 additions and 14 deletions
|
@ -3,9 +3,8 @@
|
|||
|
||||
INDEX="/etc/openvpn/easy-rsa/keys/index.txt"
|
||||
printf "\n"
|
||||
if [ ! -f $INDEX ]; then
|
||||
printf "The file: $INDEX \n"
|
||||
printf "Was not Found!\n"
|
||||
if [ ! -f "$INDEX" ]; then
|
||||
echo "The file: $INDEX was not found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -14,18 +13,15 @@ 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"
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
STATUS=$(echo "$line" | awk '{print $1}')
|
||||
NAME=$(echo "$line" | sed -e 's/^.*CN=\([^/]*\)\/.*/\1/')
|
||||
if [ "$STATUS" = "V" ]; then
|
||||
printf " Valid :: %s\n" "$NAME"
|
||||
elif [ "$STATUS" = "R" ]; then
|
||||
printf " Revoked :: %s\n" "$NAME"
|
||||
else
|
||||
printf " Unknown :: \n"
|
||||
printf " $var\n"
|
||||
printf " Unknown :: %s\n" "$NAME"
|
||||
fi
|
||||
done <$INDEX
|
||||
printf "\n"
|
||||
|
|
Loading…
Reference in a new issue