Skip to content

Instantly share code, notes, and snippets.

@mikej312
Created July 3, 2020 00:21
Show Gist options
  • Save mikej312/31b8a7ef4e12eb3bf6c9681729f992fe to your computer and use it in GitHub Desktop.
Save mikej312/31b8a7ef4e12eb3bf6c9681729f992fe to your computer and use it in GitHub Desktop.
Associate usernames with IP addresses of OpenVPN clients

Tested on an OpenBSD system using OpenVPN LDAP authentication:

sed -n '/Virtual/,/GLOBAL/{//!p;}' /var/log/openvpn-status.log | awk -F'[,:]' '{print $3}' | while read -r r; do echo -n $r; fgrep $r /var/log/openvpn | fgrep -m 1 username | awk -F\' '{ print " - " $2}' ; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment