mirror of
https://github.com/angristan/openvpn-install.git
synced 2025-01-09 16:20:04 +01:00
Added List Certificate Function
This commit is contained in:
parent
5e2e67f78d
commit
4aa9a7f9d8
1
openvpn-install
Submodule
1
openvpn-install
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 95be2fa3f039c6d9667430c3b858e03da606199b
|
@ -1291,6 +1291,34 @@ function removeOpenVPN() {
|
||||
fi
|
||||
}
|
||||
|
||||
function listcerts () {
|
||||
# Original Script from PiVPN: list clients script
|
||||
# Modified Script to add Certificate expiration Date -- psgoundar
|
||||
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 "\\e[1m::: Certificate Status List :::\\e[0m\\n"
|
||||
printf "\\e[4mStatus\\e[0m :: \\e[4mName\\e[0m\\e[0m :: \\e[4mExpiration \\e[0m\\n"
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
STATUS=$(echo "$line" | awk '{print $1}')
|
||||
NAME=$(echo "$line" | awk '{print $5}' | awk -FCN= '{print $2}')
|
||||
EXPD=$(echo "$line" | awk '{if (length($2) == 15) print $2; else print "20"$2}' | cut -b 1-8 | date +"%b %d %Y" -f -)
|
||||
|
||||
if [ "${STATUS}" == "V" ]; then
|
||||
printf " Valid :: %s :: %s\\n" "$NAME" "$EXPD"
|
||||
elif [ "${STATUS}" == "R" ]; then
|
||||
#printf " Revoked :: %s :: %s\\n" "$NAME" "$EXPD"
|
||||
continue
|
||||
else
|
||||
printf " Unknown :: %s :: %s\\n" "$NAME" "$EXPD"
|
||||
fi
|
||||
done <${INDEX} | column -t
|
||||
printf "\\n"
|
||||
}
|
||||
|
||||
function manageMenu() {
|
||||
echo "Welcome to OpenVPN-install!"
|
||||
echo "The git repository is available at: https://github.com/angristan/openvpn-install"
|
||||
@ -1300,10 +1328,11 @@ function manageMenu() {
|
||||
echo "What do you want to do?"
|
||||
echo " 1) Add a new user"
|
||||
echo " 2) Revoke existing user"
|
||||
echo " 3) Remove OpenVPN"
|
||||
echo " 4) Exit"
|
||||
until [[ $MENU_OPTION =~ ^[1-4]$ ]]; do
|
||||
read -rp "Select an option [1-4]: " MENU_OPTION
|
||||
echo " 3) List Current Issued Certificates"
|
||||
echo " 4) Remove OpenVPN"
|
||||
echo " 5) Exit"
|
||||
until [[ $MENU_OPTION =~ ^[1-5]$ ]]; do
|
||||
read -rp "Select an option [1-5]: " MENU_OPTION
|
||||
done
|
||||
|
||||
case $MENU_OPTION in
|
||||
@ -1314,9 +1343,12 @@ function manageMenu() {
|
||||
revokeClient
|
||||
;;
|
||||
3)
|
||||
removeOpenVPN
|
||||
listcerts
|
||||
;;
|
||||
4)
|
||||
removeOpenVPN
|
||||
;;
|
||||
5)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user