Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Apr 2002 13:07:31 +0100 (BST)
From:      Jon Wilson <jon@netcraft.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/37185: New Port: nrpep (netsaint remote plugin executor (perl)).
Message-ID:  <200204171207.g3HC7Vg44870@dopey.netcraft.com>

next in thread | raw e-mail | index | archive | help

>Number:         37185
>Category:       ports
>Synopsis:       New Port: nrpep (netsaint remote plugin executor (perl)).
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 17 05:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jon Wilson
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
Netcraft Ltd
>Environment:
System: FreeBSD dopey.netcraft.com 4.4-STABLE FreeBSD 4.4-STABLE #1: Fri Jan 25 16:19:23 GMT 2002 jon@dopey.netcraft.com:/usr/obj/usr/src/sys/DOPEY i386


>Description:
	New port for the Netsaint Remote Plugin Executor (Perl)
>How-To-Repeat:
	Install the port!
>Fix:
	Shar archive follows:


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	/usr/ports/net/nrpep
#	/usr/ports/net/nrpep/distinfo
#	/usr/ports/net/nrpep/Makefile
#	/usr/ports/net/nrpep/files
#	/usr/ports/net/nrpep/files/patch-aa
#	/usr/ports/net/nrpep/files/patch-ab
#	/usr/ports/net/nrpep/files/patch-ac
#	/usr/ports/net/nrpep/pkg-comment
#	/usr/ports/net/nrpep/pkg-descr
#	/usr/ports/net/nrpep/pkg-message
#	/usr/ports/net/nrpep/pkg-plist
#
echo c - /usr/ports/net/nrpep
mkdir -p /usr/ports/net/nrpep > /dev/null 2>&1
echo x - /usr/ports/net/nrpep/distinfo
sed 's/^X//' >/usr/ports/net/nrpep/distinfo << 'END-of-/usr/ports/net/nrpep/distinfo'
XMD5 (nrpep-0.2.tar.gz) = 6c84144892b0d552b65dd007ff8fc787
END-of-/usr/ports/net/nrpep/distinfo
echo x - /usr/ports/net/nrpep/Makefile
sed 's/^X//' >/usr/ports/net/nrpep/Makefile << 'END-of-/usr/ports/net/nrpep/Makefile'
X# New ports collection makefile for:	nrpep
X# Date created: 10 April 2002
X# Whom:		jon@netcraft.com
X#
X# $FreeBSD$
X
XPORTNAME=	nrpep
XPORTVERSION=	0.2
XCATEGORIES=	net
XMASTER_SITES=	http://www.netsaint.org/download/contrib/addons/
X
XMAINTAINER=	jon@netcraft.com
X
X# Note that this port depends on neither netsaint-plugins OR netsaint, because it
X# installs both a client and a server, and so could need EITHER. Bummer.
XRUN_DEPENDS=  	${LOCALBASE}/lib/perl5/site_perl/5.005/Crypt/TripleDES.pm:${PORTSDIR}/security/p5-Crypt-TripleDES
X
Xpost-install:
X	${CAT} pkg-message
X
X.include <bsd.port.mk>
END-of-/usr/ports/net/nrpep/Makefile
echo c - /usr/ports/net/nrpep/files
mkdir -p /usr/ports/net/nrpep/files > /dev/null 2>&1
echo x - /usr/ports/net/nrpep/files/patch-aa
sed 's/^X//' >/usr/ports/net/nrpep/files/patch-aa << 'END-of-/usr/ports/net/nrpep/files/patch-aa'
X--- nrpep.bak	Sat Jan  8 01:00:45 2000
X+++ nrpep	Wed Apr 10 16:50:09 2002
X@@ -13,24 +13,39 @@
X 
X # Perl libs and such the program needs
X use strict;
X-use vars qw($opt_c $version %commands $key $cipher);
X+use vars qw($opt_d $opt_c $version %commands $key $cipher);
X use Getopt::Std;
X use Crypt::TripleDES;
X 
X # Global Variables
X-$version = "0.2";
X+$version = "0.2-fbsd";
X 
X # Get the command line arguments
X-getopts('c:');
X+getopts('d:c:');
X+
X+# Open a log
X+if ($opt_d) {
X+        open(LOG,">>$opt_d") or die "Cannot open $opt_d for logging";
X+	print LOG "\n\nNRPEP\n";
X+}
X+
X # Check for the proper command line arguments, if we fail, print out an
X # error message and die.
X &Check_Command($opt_c);
X+
X # Grab the configuration file, and parse it for all the variables we
X # will need.
X-&Get_Configs($opt_c);
X+%commands = Get_Configs($opt_c);
X+if ($opt_d) {print LOG Dumper(%commands);}
X+
X # Now that I have a set of commands, go into recieve mode
X &Recieve;
X 
X+$opt_d && close(LOG);
X+exit 0;
X+
X+######################################################################################
X+
X sub Recieve {
X 	my $line;
X 	my $commandentered;
X@@ -49,8 +64,10 @@
X 		$_ =~ s/(\r|\n)//g;
X # Start a new cipher with the proper key;
X 		$cipher = new Crypt::TripleDES;
X-# Decrypt the command 
X+# Decrypt the command
X+		$opt_d && print LOG "Decrypting $_\n"; 
X 		$commandentered = $cipher->decrypt3(pack("H*", $_), $key);
X+		$opt_d && print LOG " ... got $commandentered\n";
X 		$commandentered =~ s/\s+$//;
X # If the command entered looks like one in the config file, execute it and
X # print it's return code
X@@ -72,6 +89,8 @@
X 	}
X }
X 
X+#################################################################################
X+
X sub Check_Command {
X # If I don't have a config file given, barf the mini-howto
X 	unless ($opt_c) {
X@@ -89,30 +108,31 @@
X 	}
X }
X 
X+###################################################################################
X+
X sub Get_Configs {
X 	my $opt_c = $_[0];
X-	my $line;
X-	my $command;
X-	my $plugin;
X-	my $garbage;
X+
X+	my %commands;
X 
X # Open the config file...
X 	open(FILE, "$opt_c") || die "Cannot open file at $opt_c";
X-	foreach $line (<FILE>) {
X+	foreach my $line (<FILE>) {
X 		chomp($line);
X-# Ignore comments
X-		unless ($line =~ /^#/) {
X+# Ignore comments and blank lines
X+		unless ($line =~ /^#/ or $line =~ /^\s*$/) {
X # If it's a command line, grab the command name and toss it in a name value
X # hash.  The value is the command to execute.
X-			if ($line =~ /command\[.*\]=/) {
X-				($garbage, $plugin) = split(/\=/, $line);
X-				($garbage, $garbage, $command) = split(/(\[|\])/, $line);
X+			if (my ($command,$plugin) = $line =~ /^\s*command\[(.+)\]=(.*)$/) {
X 				$commands{$command} = $plugin;
X+				$opt_d && print LOG "Got command '$command' = $plugin\n";
X # If it's the secret, we want it!
X-			} elsif ($line =~ /secret=/) {
X-				($garbage, $key) = split(/\=/, $line, 2);
X+			} elsif ($line =~ /secret=(.+)/) {
X+				$key = $1;
X 			}
X 		}
X 	}
X 	close(FILE);
X+
X+	return %commands;
X }
X
X
END-of-/usr/ports/net/nrpep/files/patch-aa
echo x - /usr/ports/net/nrpep/files/patch-ab
sed 's/^X//' >/usr/ports/net/nrpep/files/patch-ab << 'END-of-/usr/ports/net/nrpep/files/patch-ab'
X--- Makefile.orig	Wed Jan  5 23:04:22 2000
X+++ Makefile	Wed Apr 10 18:24:16 2002
X@@ -3,50 +3,57 @@
X #
X 
X # 
X-# Configuration Files
X+# Configuration Files 
X #
X 
X #
X # What directory the server program (nrpep) should live in
X #
X-nrpepserverdir = "/usr/sbin"
X+nrpepserverdir = $(PREFIX)/sbin
X 
X #
X # What directory the plugin client should live in
X #
X-nrpepplugindir = "/usr/local/netsaint/libexec"
X+nrpepplugindir = $(PREFIX)/libexec/netsaint
X 
X #
X # What user should own nrpep
X #
X-nrpepowner = "root"
X+nrpepowner = root
X 
X #
X # What group should own nrpep
X #
X-nrpepgroup = "root"
X+nrpepgroup = wheel
X 
X #
X # What user should own check_nrpep
X #
X-checknrpepowner = "netsaint"
X+checknrpepowner = root
X 
X # 
X # What group should own check_nrpep
X #
X-checknrpepgroup = "netsaint"
X+checknrpepgroup = wheel
X 
X #
X # What directory should the nrpep config files go to
X #
X-nrpepconfigdir = "/usr/local/netsaint/etc"
X+nrpepconfigdir = $(PREFIX)/etc/netsaint
X 
X # ***************************************
X # DO NOT CHANGE ANYTHING BELOW THIS POINT
X # ***************************************
X 
X all:
X-	cat README | more
X+	mv nrpep.cfg nrpep.cfg.orig
X+	cat nrpep.cfg.orig | sed -e 's%/usr/local/netsaint/libexec%$(PREFIX)/libexec/netsaint%' > nrpep.cfg
X+
X+install: install-client install-server
X+	if [ ! -d "$(PREFIX)/share/doc/nrpep" ]; then \
X+		mkdir -p $(PREFIX)/share/doc/nrpep; \
X+	fi
X+	cp README $(PREFIX)/share/doc/nrpep
X 
X install-client:
X 	`if [ ! -d "$(nrpepplugindir)" ]; then \
X@@ -55,8 +62,8 @@
X 	`if [ ! -d "$(nrpepconfigdir)" ]; then \
X 	mkdir -p $(nrpepconfigdir); \
X 	fi`
X-	install -b -D -g $(checknrpepgroup) -o $(checknrpepowner) -m 755 check_nrpep $(nrpepplugindir);
X-	install -b -D -g $(checknrpepgroup) -o $(checknrpepowner) -m 644 check_nrpep.cfg $(nrpepconfigdir);
X+	install -g $(checknrpepgroup) -o $(checknrpepowner) -m 755 check_nrpep $(nrpepplugindir);
X+	install -g $(checknrpepgroup) -o $(checknrpepowner) -m 644 check_nrpep.cfg $(nrpepconfigdir);
X 
X install-server:
X 	`if [ ! -d "$(nrpepserverdir)" ]; then \
X@@ -65,8 +72,8 @@
X 	`if [ ! -d "$(nrpepconfigdir)" ]; then \
X 	mkdir -p $(nrpepconfigdir); \
X 	fi`
X-	install -b -D -g $(nrpepgroup) -o $(nrpepowner) -m 755 nrpep $(nrpepserverdir);
X-	install -b -D -g $(nrpepgroup) -o $(nrpepowner) -m 644 nrpep.cfg $(nrpepconfigdir);
X+	install -g $(nrpepgroup) -o $(nrpepowner) -m 755 nrpep $(nrpepserverdir);
X+	install -g $(nrpepgroup) -o $(nrpepowner) -m 644 nrpep.cfg $(nrpepconfigdir);
X 
X uninstall-client:
X 	rm $(nrpepplugindir)/check_nrpep
X@@ -75,3 +82,7 @@
X uninstall-server:
X 	rm $(nrpepserverdir)/nrpep
X 	rm $(nrpepconfigdir)/nrpep.cfg
X+
X+
X+
X+
END-of-/usr/ports/net/nrpep/files/patch-ab
echo x - /usr/ports/net/nrpep/files/patch-ac
sed 's/^X//' >/usr/ports/net/nrpep/files/patch-ac << 'END-of-/usr/ports/net/nrpep/files/patch-ac'
X--- check_nrpep.old	Tue Apr  2 16:52:01 2002
X+++ check_nrpep	Wed Apr 10 17:31:09 2002
X@@ -59,7 +59,7 @@
X 	if ($opts{'f'}) {
X 		&Get_Configs($opts{'f'});
X 	} else {
X-		&Get_Configs("/usr/local/netsaint/etc/check_nrpep.cfg");
X+		&Get_Configs("/usr/local/etc/netsaint/check_nrpep.cfg");
X 	}
X # Longer timeout?  If it's given on the command line use it, otherwise
X # read from the config file
END-of-/usr/ports/net/nrpep/files/patch-ac
echo x - /usr/ports/net/nrpep/pkg-comment
sed 's/^X//' >/usr/ports/net/nrpep/pkg-comment << 'END-of-/usr/ports/net/nrpep/pkg-comment'
XA netsaint addon for running plugins on remote hosts
END-of-/usr/ports/net/nrpep/pkg-comment
echo x - /usr/ports/net/nrpep/pkg-descr
sed 's/^X//' >/usr/ports/net/nrpep/pkg-descr << 'END-of-/usr/ports/net/nrpep/pkg-descr'
XThis addon was designed as a replacemnt for the netsaint_statd and
Xnrpe addons. Although this addon is similiar in function to nrpe, it
Xis written in Perl and implements TripleDES encryption for the data in
Xtransit. It is also designed to run under inetd and make use of the
XTCP Wrappers package for access control.
X
XWWW: www.netsaint.org
X
X- Jon
Xjon@netcraft.com
END-of-/usr/ports/net/nrpep/pkg-descr
echo x - /usr/ports/net/nrpep/pkg-message
sed 's/^X//' >/usr/ports/net/nrpep/pkg-message << 'END-of-/usr/ports/net/nrpep/pkg-message'
X###############################################################
X
XIf you are going to be running the nrpep daemon on this machine,
Xyou will probably want something like the following in /etc/services:
X
X nrpep           8086/tcp # Netsaint nrpep server
X
Xand the following in /etc/inetd.conf:
X
X nrpep   stream  tcp     nowait  nobody  /usr/local/sbin/nrpep   nrpep -c /usr/local/etc/netsaint/nrpep.cfg
X
XThe config files are world readable. If this is a problem for you,
Xthen sort out the file ownership and permissions yourself.
X
XAdditional documentation in $PREFIX/share/doc/nrpep
X
X###############################################################
END-of-/usr/ports/net/nrpep/pkg-message
echo x - /usr/ports/net/nrpep/pkg-plist
sed 's/^X//' >/usr/ports/net/nrpep/pkg-plist << 'END-of-/usr/ports/net/nrpep/pkg-plist'
Xsbin/nrpep
Xetc/netsaint/nrpep.cfg
Xlibexec/netsaint/check_nrpep
Xetc/netsaint/check_nrpep.cfg
Xshare/doc/nrpep/README
X@dirrm share/doc/nrpep
END-of-/usr/ports/net/nrpep/pkg-plist
exit

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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