Plack::App::OpenVPN::Status - Plack application to display the sessions of OpenVPN server
use Plack::Builder; use Plack::App::File; use Plack::App::OpenVPN::Status; builder { mount '/static' => Plack::App::File->new(root => "/path/to/static"); mount '/' => Plack::App::OpenVPN::Status->new( status_from => "/path/to/openvpn/status.log" ); };
Plack::App::OpenVPN::Status is an application to display active sessions of the OpenVPN server.
It parse OpenVPN status log and display active sessions. Supported all three versions of the status log. Check the OpenVPN server documentation how to set up version. Howewer, there is no needs (and no ability, at the moment) to point version of status log. Application detect it authomatically. Also status log version will be diplayed on the generated web page.
Twitter Bootstrap layout is used to diplay active OpenVPN sessions.
Creates a new application. The following options are supported:
Path to OpenVPN server status log file. This option is required. At the moment, the application can able to read versions 1, 2, 3 of the status log file.
Coderef used as a view to display sessions. This must be a valid Text::MicroTemplate's template. The hashref of params is passed to the view as first argument. So you can use it like this:
% my $vars = $_[0];
Now $vars contains the structure like this:
$vars = { 'updated' => 'Wed Dec 5 21:25:58 2012', 'version' => '2', 'users' => [ { 'common-name' => 'cadvecisvo', 'remote-ip' => '1.2.3.4', 'remote-port' => '4944', 'rx-bytes' => '1.21 Mio', 'tx-bytes' => '503.1 Kio', 'connected' => 'Wed Dec 5 21:16:58 2012', 'virtual' => '00:ff:de:ad:be:ef', 'last-ref' => 'Wed Dec 5 21:25:55 2012', } ] }
This is the default view to display sessions. It uses Twitter Bootstrap layout.
Plack
Text::MicroTemplate
OpenVPN Manual
Twitter Bootstrap
Anton Gerasimov, <chim@cpan.org>
Copyright (C) 2012 by Anton Gerasimov
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Plack::App::OpenVPN::Status, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::App::OpenVPN::Status
CPAN shell
perl -MCPAN -e shell install Plack::App::OpenVPN::Status
For more information on module installation, please visit the detailed CPAN module installation guide.