Skip to content

Instantly share code, notes, and snippets.

@divyavanmahajan
Last active December 27, 2023 14:30
Show Gist options
  • Save divyavanmahajan/ac2839b8ba564bad5022 to your computer and use it in GitHub Desktop.
Save divyavanmahajan/ac2839b8ba564bad5022 to your computer and use it in GitHub Desktop.
Turnkey OpenVPN - List active users and user profiles.
#!/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
@JeffPHenry
Copy link

this doesnt work.

@seitosan
Copy link

#!/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