From 671e21de3ce8b6e49bb424385ec83280bc16613b Mon Sep 17 00:00:00 2001 From: Swamy Goundar Date: Sun, 22 Mar 2020 18:54:53 -0700 Subject: [PATCH] Added PiVPN Function listcerts --- openvpn-install.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/openvpn-install.sh b/openvpn-install.sh index 38a85a3..bb84900 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -1230,6 +1230,39 @@ function removeOpenVPN () { fi } +function listcerts () { +# PiVPN: list clients script function + +INDEX="/etc/openvpn/easy-rsa/pki/index.txt" +printf "\n" +if [ ! -f "${INDEX}" ]; then + echo "The file: $INDEX was not found!" + 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}') + NAME=$(echo "$line" | sed -e 's:.*/CN=::') + if [ "${STATUS}" == "V" ]; then + printf " Valid :: %s\n" "$NAME" + elif [ "${STATUS}" == "R" ]; then + printf " Revoked :: %s\n" "$NAME" + else + printf " Unknown :: %s\n" "$NAME" + fi +done <${INDEX} +printf "\n" + + + + + +} function manageMenu () { clear echo "Welcome to OpenVPN-install!"