Last active
December 27, 2023 14:30
-
-
Save divyavanmahajan/ac2839b8ba564bad5022 to your computer and use it in GitHub Desktop.
Turnkey OpenVPN - List active users and user profiles.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# List users in the system | |
echo "Users setup in the system." | |
ls /etc/openvpn/easy-rsa/keys/*ovpn|xargs -n 1 -I FNAME basename FNAME .ovpn|grep -v proxy|xargs -n 1 -I NAME echo " NAME" | |
echo ------ | |
echo Active users | |
echo ------ | |
cat /var/log/openvpn/server.log |
#!/bin/bash -e
List users in the system
echo "Users setup in the system."
cd $1
ls *ovpn|xargs -n 1 -I FNAME basename FNAME .ovpn|grep -v proxy|xargs -n 1 -I NAME echo " NAME"
echo ------
echo Active users
echo ------
cat /var/log/openvpn/openvpn.log | grep "VERIFY OK: depth=0, CN=" | cut -d ' ' -f 7 | sed -e 's/CN=//' | sort -u
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this doesnt work.