Skip to content

Instantly share code, notes, and snippets.

@ThomRoman
Forked from mikej312/openvpn.md
Created July 3, 2020 00:24
Show Gist options
  • Save ThomRoman/62d39fbb6408dcc4b1e949426400f0c2 to your computer and use it in GitHub Desktop.
Save ThomRoman/62d39fbb6408dcc4b1e949426400f0c2 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