mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-20 03:40:17 +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"
|
INDEX="/etc/openvpn/easy-rsa/keys/index.txt"
|
||||||
printf "\n"
|
printf "\n"
|
||||||
if [ ! -f $INDEX ]; then
|
if [ ! -f "$INDEX" ]; then
|
||||||
printf "The file: $INDEX \n"
|
echo "The file: $INDEX was not found!"
|
||||||
printf "Was not Found!\n"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -14,18 +13,15 @@ printf "\n"
|
||||||
printf "\e[1m::: Certificate Status List :::\e[0m\n"
|
printf "\e[1m::: Certificate Status List :::\e[0m\n"
|
||||||
printf " ::\e[4m Status \e[0m||\e[4m Name \e[0m:: \n"
|
printf " ::\e[4m Status \e[0m||\e[4m Name \e[0m:: \n"
|
||||||
|
|
||||||
while read -r line || [[ -n "$line" ]]; do
|
while read -r line || [ -n "$line" ]; do
|
||||||
status=$(echo $line | awk '{print $1}')
|
STATUS=$(echo "$line" | awk '{print $1}')
|
||||||
var=$(echo $line | sed -e 's/^.*CN=\([^/]*\)\/.*/\1/')
|
NAME=$(echo "$line" | sed -e 's/^.*CN=\([^/]*\)\/.*/\1/')
|
||||||
if [[ $status = "V" ]]; then
|
if [ "$STATUS" = "V" ]; then
|
||||||
printf " Valid :: "
|
printf " Valid :: %s\n" "$NAME"
|
||||||
printf " $var\n"
|
elif [ "$STATUS" = "R" ]; then
|
||||||
elif [[ $status = "R" ]]; then
|
printf " Revoked :: %s\n" "$NAME"
|
||||||
printf " Revoked :: "
|
|
||||||
printf " $var\n"
|
|
||||||
else
|
else
|
||||||
printf " Unknown :: \n"
|
printf " Unknown :: %s\n" "$NAME"
|
||||||
printf " $var\n"
|
|
||||||
fi
|
fi
|
||||||
done <$INDEX
|
done <$INDEX
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
Loading…
Reference in a new issue