Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added List Certificate Function #587

Closed
wants to merge 42 commits into from
Closed
Changes from 6 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0dc5107
Certificate Expiry date changes
psgoundar Mar 22, 2020
09a9123
Change Client profiles save folder to /opt/ovpn
psgoundar Mar 23, 2020
671e21d
Added PiVPN Function listcerts
psgoundar Mar 23, 2020
230459c
Updated Menu
psgoundar Mar 23, 2020
74f33d1
Fixed Menu Listing
psgoundar Mar 23, 2020
b858a8b
Menu Updates
psgoundar Mar 23, 2020
526cd74
Added PiVPN function listclients
psgoundar Mar 23, 2020
d62213d
Updated File locations for Log files in Server.conf
psgoundar Mar 23, 2020
9e24832
Added Placeholder for New Features 6,7,8 to Menu
psgoundar Mar 28, 2020
3305056
Fixed Menu Selection Error
psgoundar Mar 28, 2020
f2411c0
Added Certificate Expiration Dates to listcerts()
psgoundar Mar 28, 2020
a24c5de
Refresh
psgoundar Mar 28, 2020
8652391
Refresh
psgoundar Mar 28, 2020
bbf489f
Set Server Cert to 12775 All others to 1080 Days
psgoundar Mar 28, 2020
d18a10d
Merge pull request #1 from angristan/master
psgoundar Mar 28, 2020
f783a3e
Merge pull request #2 from angristan/master
psgoundar Mar 28, 2020
4dce304
Added List function to Show Issued Certificates
psgoundar Mar 28, 2020
163f729
Updated Syntax Formating
psgoundar Mar 29, 2020
dd5f3e1
Cleaned up Formating
psgoundar Mar 29, 2020
d5bd197
Disabled Listing of Revoked Certs
psgoundar Mar 29, 2020
dbae6a1
Fixed Issue for Cert Names when OU is defined.
psgoundar Mar 29, 2020
47d6888
Updated Backup Script
psgoundar Mar 29, 2020
bdc67ad
Merge branch 'master' of https://github.com/psgoundar/openvpn-install
psgoundar Mar 29, 2020
b3b30ab
Fixed Restore Script Error
psgoundar Mar 29, 2020
865fecb
Updated Backup Script
psgoundar Mar 29, 2020
b9be231
Updates to Restore and Backup Script
psgoundar Mar 29, 2020
f1d63cf
Merge pull request #4 from angristan/master
psgoundar Apr 5, 2020
47c7385
Merge pull request #5 from angristan/master
psgoundar Apr 10, 2020
b330282
ccd changes
psgoundar Apr 15, 2020
0314c28
Merge branch 'master' of https://github.com/psgoundar/openvpn-install
psgoundar Apr 15, 2020
87d88a7
Reverting Changes to be consistant with angristan
psgoundar Apr 15, 2020
ab19e8b
Misc
psgoundar Apr 15, 2020
33e754e
Commit
psgoundar Apr 15, 2020
95be2fa
Updated list function tabbing
psgoundar Apr 15, 2020
9c517cb
Added List function to Show Issued Certificates
psgoundar Mar 28, 2020
f6dd08d
Updated Syntax Formating
psgoundar Mar 29, 2020
cfc63eb
Cleaned up Formating
psgoundar Mar 29, 2020
13adb69
Disabled Listing of Revoked Certs
psgoundar Mar 29, 2020
3a438a6
Fixed Issue for Cert Names when OU is defined.
psgoundar Mar 29, 2020
d481be7
Merge branch 'angristan' of https://github.com/psgoundar/openvpn-inst…
psgoundar May 2, 2020
05e998b
New Merge
psgoundar May 2, 2020
8eecbf2
Rebase
psgoundar May 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions openvpn-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,39 @@ 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 () {
clear
echo "Welcome to OpenVPN-install!"
Expand All @@ -1248,10 +1281,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 " 8) Remove OpenVPN"
echo " 9) Exit"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3, 8, 9?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got multiple other options that I've added to my repo And I was planning on slowly submitting all the changes up to the main repo.
And I didn't want to continually be renumbering the remove and Exit options
Such as:
echo " 1) Add a new user"
echo " 2) Revoke existing user"
echo " 3) List Current Issued Certificates"
echo " 4) List Current Active Users"
echo " 5) Backup Configuration"
echo " 6) Restore Configuration from Backup *Incomplete"
echo " 7) Sync Configuration to Alternate Servers *Incomplete"
echo " 8) Remove OpenVPN"
echo " 9) Exit"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do the appropriate changes for this PR :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I totally Screwed up my branch. I will close this pull Request. And pull another with the neccessary Changes.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok :)

until [[ "$MENU_OPTION" =~ ^[1-9]$ ]]; do
read -rp "Select an option [1-9]: " MENU_OPTION
done

case $MENU_OPTION in
Expand All @@ -1262,9 +1296,13 @@ function manageMenu () {
revokeClient
;;
3)
listcerts
;;

8)
removeOpenVPN
;;
4)
9)
exit 0
;;
esac
Expand Down