Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Aug 2015 10:51:30 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r393856 - in head/net-mgmt: . p5-Net-OpenVPN-Manage p5-Net-OpenVPN-Manage/files
Message-ID:  <201508101051.t7AApUIa083048@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Mon Aug 10 10:51:30 2015
New Revision: 393856
URL: https://svnweb.freebsd.org/changeset/ports/393856

Log:
  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>

Added:
  head/net-mgmt/p5-Net-OpenVPN-Manage/
  head/net-mgmt/p5-Net-OpenVPN-Manage/Makefile   (contents, props changed)
  head/net-mgmt/p5-Net-OpenVPN-Manage/distinfo   (contents, props changed)
  head/net-mgmt/p5-Net-OpenVPN-Manage/files/
  head/net-mgmt/p5-Net-OpenVPN-Manage/files/patch-lib_Net_OpenVPN_Manage.pm   (contents, props changed)
  head/net-mgmt/p5-Net-OpenVPN-Manage/pkg-descr   (contents, props changed)
  head/net-mgmt/p5-Net-OpenVPN-Manage/pkg-plist   (contents, props changed)
Modified:
  head/net-mgmt/Makefile

Modified: head/net-mgmt/Makefile
==============================================================================
--- head/net-mgmt/Makefile	Mon Aug 10 10:37:24 2015	(r393855)
+++ head/net-mgmt/Makefile	Mon Aug 10 10:51:30 2015	(r393856)
@@ -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

Added: head/net-mgmt/p5-Net-OpenVPN-Manage/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/p5-Net-OpenVPN-Manage/Makefile	Mon Aug 10 10:51:30 2015	(r393856)
@@ -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>

Added: head/net-mgmt/p5-Net-OpenVPN-Manage/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/p5-Net-OpenVPN-Manage/distinfo	Mon Aug 10 10:51:30 2015	(r393856)
@@ -0,0 +1,2 @@
+SHA256 (Net-OpenVPN-Manage-0.02.tar.gz) = b7fd691c24e4fbc78c2af992550abc96bf0db48d6f9e1406f0ebcb22ba0eeb57
+SIZE (Net-OpenVPN-Manage-0.02.tar.gz) = 12066

Added: head/net-mgmt/p5-Net-OpenVPN-Manage/files/patch-lib_Net_OpenVPN_Manage.pm
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/p5-Net-OpenVPN-Manage/files/patch-lib_Net_OpenVPN_Manage.pm	Mon Aug 10 10:51:30 2015	(r393856)
@@ -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.

Added: head/net-mgmt/p5-Net-OpenVPN-Manage/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/p5-Net-OpenVPN-Manage/pkg-descr	Mon Aug 10 10:51:30 2015	(r393856)
@@ -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/

Added: head/net-mgmt/p5-Net-OpenVPN-Manage/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-mgmt/p5-Net-OpenVPN-Manage/pkg-plist	Mon Aug 10 10:51:30 2015	(r393856)
@@ -0,0 +1,3 @@
+%%PERL5_MAN3%%/Net::OpenVPN::Manage.3.gz
+%%SITE_PERL%%/Net/OpenVPN/Manage.html
+%%SITE_PERL%%/Net/OpenVPN/Manage.pm



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201508101051.t7AApUIa083048>