aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanfe <danfe@FreeBSD.org>2015-08-10 18:51:30 +0800
committerdanfe <danfe@FreeBSD.org>2015-08-10 18:51:30 +0800
commit3c7cf719dd9a79516c58e4a6152f942d86d88a14 (patch)
tree07ceea81a997f97a7785788dea2433937e100df6
parentfb541a152e0db6ebe881f4bc195da93010150ec8 (diff)
downloadfreebsd-ports-gnome-3c7cf719dd9a79516c58e4a6152f942d86d88a14.tar.gz
freebsd-ports-gnome-3c7cf719dd9a79516c58e4a6152f942d86d88a14.tar.zst
freebsd-ports-gnome-3c7cf719dd9a79516c58e4a6152f942d86d88a14.zip
Add Perl module for managing an OpenVPN process via its management port,
with custom patch that introduces new method to return active connection status information as a hash to hashes. Submitted by: Zeus Panchenko <zeus@gnu.org.ua>
-rw-r--r--net-mgmt/Makefile1
-rw-r--r--net-mgmt/p5-Net-OpenVPN-Manage/Makefile20
-rw-r--r--net-mgmt/p5-Net-OpenVPN-Manage/distinfo2
-rw-r--r--net-mgmt/p5-Net-OpenVPN-Manage/files/patch-lib_Net_OpenVPN_Manage.pm104
-rw-r--r--net-mgmt/p5-Net-OpenVPN-Manage/pkg-descr4
-rw-r--r--net-mgmt/p5-Net-OpenVPN-Manage/pkg-plist3
6 files changed, 134 insertions, 0 deletions
diff --git a/net-mgmt/Makefile b/net-mgmt/Makefile
index 8b6318bf5c93..b75153925cfc 100644
--- a/net-mgmt/Makefile
+++ b/net-mgmt/Makefile
@@ -217,6 +217,7 @@
SUBDIR += p5-Net-IPv6Addr
SUBDIR += p5-Net-NSCA-Client
SUBDIR += p5-Net-Netmask
+ SUBDIR += p5-Net-OpenVPN-Manage
SUBDIR += p5-Net-SNMP
SUBDIR += p5-Net-SNMP-Util
SUBDIR += p5-Net-SNMPTrapd
diff --git a/net-mgmt/p5-Net-OpenVPN-Manage/Makefile b/net-mgmt/p5-Net-OpenVPN-Manage/Makefile
new file mode 100644
index 000000000000..485b89c7b591
--- /dev/null
+++ b/net-mgmt/p5-Net-OpenVPN-Manage/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+PORTNAME= Net-OpenVPN-Manage
+PORTVERSION= 0.02
+CATEGORIES= net-mgmt perl5
+MASTER_SITES= CPAN
+PKGNAMEPREFIX= p5-
+
+MAINTAINER= perl@FreeBSD.org
+COMMENT= Manage an OpenVPN process via its management port
+
+LICENSE= ART10 GPLv2
+LICENSE_COMB= dual
+
+RUN_DEPENDS= p5-Net-Telnet>=0:${PORTSDIR}/net/p5-Net-Telnet
+
+USES= perl5
+USE_PERL5= configure
+
+.include <bsd.port.mk>
diff --git a/net-mgmt/p5-Net-OpenVPN-Manage/distinfo b/net-mgmt/p5-Net-OpenVPN-Manage/distinfo
new file mode 100644
index 000000000000..2c01b4da2027
--- /dev/null
+++ b/net-mgmt/p5-Net-OpenVPN-Manage/distinfo
@@ -0,0 +1,2 @@
+SHA256 (Net-OpenVPN-Manage-0.02.tar.gz) = b7fd691c24e4fbc78c2af992550abc96bf0db48d6f9e1406f0ebcb22ba0eeb57
+SIZE (Net-OpenVPN-Manage-0.02.tar.gz) = 12066
diff --git a/net-mgmt/p5-Net-OpenVPN-Manage/files/patch-lib_Net_OpenVPN_Manage.pm b/net-mgmt/p5-Net-OpenVPN-Manage/files/patch-lib_Net_OpenVPN_Manage.pm
new file mode 100644
index 000000000000..26a581bce270
--- /dev/null
+++ b/net-mgmt/p5-Net-OpenVPN-Manage/files/patch-lib_Net_OpenVPN_Manage.pm
@@ -0,0 +1,104 @@
+--- lib/Net/OpenVPN/Manage.pm.orig 2006-07-10 18:21:19 UTC
++++ lib/Net/OpenVPN/Manage.pm
+@@ -1,3 +1,5 @@
++# -*- mode: cperl; mode: follow; -*-
++
+ package Net::OpenVPN::Manage;
+
+ use strict;
+@@ -217,6 +219,84 @@ sub status_ref() {
+ return $ref;
+ }
+
++# $hash_ref = $vpn->status_hash();
++sub status_hash() {
++ my $ref;
++ my $self = shift;
++ my $arg = 2;
++ my $telnet = $self->{objects}{_telnet_};
++ my @output = $telnet->cmd(String => 'status '.$arg, Prompt => '/(SUCCESS:.*\n|ERROR:.*\n|END.*\n)/');
++ unless ($telnet->last_prompt =~ /(SUCCESS:.*|END.*\n)/){
++ $self->{error_msg} = $telnet->last_prompt();
++ return 0;
++ }
++ unless ($telnet->last_prompt =~ /END.*\n/){
++ return $telnet->last_prompt();
++ }
++ my ( $i, @arr );
++ foreach my $ln ( @output ){
++ chomp $ln;
++ if (( $ln eq '' ) || ( $ln =~ /^\s*$/ )){
++ next;
++ } elsif ( $ln =~ s/^(CLIENT_LIST),// ) {
++ @arr = split ',', $ln;
++ chomp @arr;
++ $ref->{$1}->{$arr[0]} = {
++ ip_real => $arr[1],
++ ip_virt => $arr[2],
++ b_recv => $arr[3],
++ b_sent => $arr[4],
++ ts => $arr[5],
++ ts_s => $arr[6],
++ name => $arr[7],
++ };
++ undef @arr;
++ } elsif ( $ln =~ s/^(ROUTING_TABLE),// ) {
++ @arr = split ',', $ln;
++ chomp @arr;
++ $ref->{$1}->{$arr[1]} = {
++ ip_virt => $arr[0],
++ ip_real => $arr[2],
++ ts => $arr[3],
++ ts_s => $arr[4],
++ };
++ undef @arr;
++ } elsif ( $ln =~ /^HEADER,ROUTING_TABLE/ ) {
++ @arr = split ',', $ln;
++ chomp @arr;
++ $ref->{HEADER}->{$arr[1]} = {
++ ip_virt => 'Virtual Address',
++ cn => 'Common Name',
++ ip_real => 'Real Address',
++ ts => 'Last Ref',
++ ts_s => 'Last Ref (time_t)',
++ };
++ undef @arr;
++ } elsif ( $ln =~ /^HEADER,CLIENT_LIST/ ) {
++ @arr = split ',', $ln;
++ chomp @arr;
++ $ref->{HEADER}->{$arr[1]} = {
++ cn => 'Common Name',
++ ip_real => 'Real Address',
++ ip_virt => 'Virtual Address',
++ b_recv => 'Bytes Received',
++ b_sent => 'Bytes Sent',
++ ts => 'Connected Since',
++ ts_s => 'Connected Since (time_t)',
++ name => 'Username',
++ };
++ undef @arr;
++ } elsif ( $ln =~ s/^(TITLE),// ){
++ $ref->{$1}=$ln;
++ } elsif ( $ln =~ s/^(TIME),// ){
++ $ref->{$1}=$ln;
++ } elsif ( $ln =~ s/^(GLOBAL_STATS),// ){
++ $ref->{$1}=$ln;
++ }
++ }
++ return $ref;
++}
++
+ # Not implemented
+ sub test {
+ my $self = shift;
+@@ -478,6 +558,10 @@ If called without an argument, it will r
+ # Print the connection status page using the version 2 format.
+ print $vpn->status(2);
+
++=item $vpn->status_hash( );
++
++Returns the active connections status information as a hash to hashes.
++
+ =item $vpn->status_ref( );
+
+ Returns the active connections status information as a reference to a hash of arrays.
diff --git a/net-mgmt/p5-Net-OpenVPN-Manage/pkg-descr b/net-mgmt/p5-Net-OpenVPN-Manage/pkg-descr
new file mode 100644
index 000000000000..7ec01ad0e5e7
--- /dev/null
+++ b/net-mgmt/p5-Net-OpenVPN-Manage/pkg-descr
@@ -0,0 +1,4 @@
+This module connects to the OpenVPN management interface, executes commands
+on the interface, and returns the results or errors that result.
+
+WWW: http://search.cpan.org/dist/Net-OpenVPN-Manage/
diff --git a/net-mgmt/p5-Net-OpenVPN-Manage/pkg-plist b/net-mgmt/p5-Net-OpenVPN-Manage/pkg-plist
new file mode 100644
index 000000000000..e0f40e200b4a
--- /dev/null
+++ b/net-mgmt/p5-Net-OpenVPN-Manage/pkg-plist
@@ -0,0 +1,3 @@
+%%PERL5_MAN3%%/Net::OpenVPN::Manage.3.gz
+%%SITE_PERL%%/Net/OpenVPN/Manage.html
+%%SITE_PERL%%/Net/OpenVPN/Manage.pm