OpenVPN Status Parser for PHP

I use the excellent OpenVPN for my VPN needs. Since version 2 it supports printing a nice status file of currently connected clients but unfortunately it is a bit ugly.

I wrote a simple php library that can parse this file and returns a associative array of logged in users, you can then easily display it using Smarty or whatever you use for templating.

You can download version 1.0 here you can also check out the README and a Sample that I did using Smarty.

2 Comments

Nice script.
I found it best to add a trim() around the [updated] element.

Useful. Thanks.

Suggestion: if the logfile passed to parseLog() fails to fopen() correctly, the script loops endlessly. After the fopen(), do a test to make sure it actually opened, perhaps like this:


function parseLog ($log, $proto) {
$handle = fopen($log, "r");
if(!$handle)return false;

Leave a comment

Recent Entries

  • flashpolicyd 2.0

    I wrote a multi threaded server for Adobe Flash Policy requests, some background from Adobe:Since policy files were first introduced, Flash Player has recognized /crossdomain.xml...

  • Adventures with Ruby

    Some more about my continuing experiences with ruby, in my last post I saidthe language does what you'd expect and as you'll see in my...

  • New programming language of choice - Ruby

    I have fallen out of love with Perl some time ago, I cannot point to one specific thing about it that put me off, I...

  • On working from home

    I've not been posting much here, work has been incredibly manic the last while, especially I need to still finish off my SSO posts with...

  • Rework of puppet facts for /etc/facts.txt

    Previously I blogged a custom fact that reads /etc/facts.txt to build up some custom facts for use in Puppet manifests, well I've since learned a...

Close