net-mgmt/ndpmon: resurrect staged ndpmon, take maintainership

Reviewed by:	mat
This commit is contained in:
Kurt Jaeger 2014-09-19 05:16:36 +00:00
parent 67da2f9e1b
commit f5a54dbc5c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=368538
19 changed files with 387 additions and 1 deletions

1
MOVED
View file

@ -6756,7 +6756,6 @@ net-mgmt/nagios-check_kumofs||2014-09-01|Not staged
net-mgmt/nagios-portaudit||2014-09-01|Not staged
net-mgmt/nagios-silfreed-plugins||2014-09-01|Not staged
net-mgmt/nagiostat||2014-09-01|Not staged
net-mgmt/ndpmon||2014-09-01|Not staged
net-mgmt/netams-front||2014-09-01|Not staged
net-mgmt/openvmps||2014-09-01|Not staged
net-mgmt/ramond||2014-09-01|Not staged

View file

@ -140,6 +140,7 @@
SUBDIR += nat
SUBDIR += nbtscan
SUBDIR += ndoutils
SUBDIR += ndpmon
SUBDIR += nedi
SUBDIR += nefu
SUBDIR += net-snmp

94
net-mgmt/ndpmon/Makefile Normal file
View file

@ -0,0 +1,94 @@
# Created by: janos.mohacsi@bsd.hu
# $FreeBSD$
PORTNAME= ndpmon
PORTVERSION= 1.4.0
PORTREVISION= 4
CATEGORIES= net-mgmt ipv6
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${PORTNAME}-1.4/
MAINTAINER= pi@FreeBSD.org
COMMENT= On-link icmpv6 message monitoring and reporting daemon
LICENSE= LGPL21
LICENSE_FILE= ${WRKSRC}/COPYING
OPTIONS_DEFINE= PY4SUITE MACRESOLV
OPTIONS_DEFAULT=
PY4SUITE_DESC= Depend on py-4suite-xml (for generating HTML)
MACRESOLV_DESC= Enable MAC Manufacturer Resolution (use p5-libwww)
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MPY4SUITE}
RUN_DEPENDS+= ${PYTHON_SITELIBDIR}/Ft/Xml/Domlette.py:${PORTSDIR}/textproc/py-4suite-xml
USE_PYTHON= yes
PLIST_SUB+= PY=""
.else
PLIST_SUB+= PY="@comment "
.endif
USES= perl5 tar:tgz
USE_PERL5= run
USE_GNOME= libxml2
USE_RC_SUBR= ndpmonitor
GNU_CONFIGURE= yes
CONFIGURE_ENV= OSTYPE=FreeBSD
CONFIGURE_ARGS= --with-var-datadir=${PREFIX}/var --with-confdir=${ETCDIR} \
--with-libxml2=${LOCALBASE} --cache-file=/dev/null
PORTDOCS= INSTALL README
.if ${PORT_OPTIONS:MMACRESOLV}
CONFIGURE_ARGS+=--enable-mac-resolv
BUILD_DEPENDS+= p5-libwww>=6.05:${PORTSDIR}/www/p5-libwww
RUN_DEPENDS+= p5-libwww>=6.05:${PORTSDIR}/www/p5-libwww
PLIST_SUB+= MACRESOLV=""
.else
PLIST_SUB+= MACRESOLV="@comment "
.endif
post-patch:
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
-e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
${WRKSRC}/ndpmon.8 \
${WRKSRC}/create_html_table.py \
${WRKSRC}/demopipeprogram.pl.sample \
${WRKSRC}/config_ndpmon.xml.in \
${WRKSRC}/config_ndpmon.xml
(cd ${WRKSRC}; ${MAKE} clean)
do-install:
${INSTALL_MAN} ${WRKSRC}/ndpmon.8 ${STAGEDIR}${PREFIX}/man/man8
${INSTALL_PROGRAM} ${WRKSRC}/ndpmon ${STAGEDIR}${PREFIX}/sbin
${MKDIR} ${STAGEDIR}${DATADIR}
${INSTALL_DATA} ${WRKSRC}/*.dtd ${STAGEDIR}${DATADIR}
${INSTALL_SCRIPT} ${WRKSRC}/demopipeprogram.pl.sample ${STAGEDIR}${DATADIR}
.if ${PORT_OPTIONS:MPY4SUITE}
${INSTALL_SCRIPT} ${WRKSRC}/create_html_table.py ${STAGEDIR}${DATADIR}
.endif
.if ${PORT_OPTIONS:MMACRESOLV}
${MKDIR} ${STAGEDIR}${DATADIR}/plugins/mac_resolv
${INSTALL_SCRIPT} ${WRKSRC}/plugins/mac_resolv/make-manuf ${STAGEDIR}${DATADIR}/plugins/mac_resolv
${INSTALL_DATA} ${WRKSRC}/plugins/mac_resolv/*.tmpl ${STAGEDIR}${DATADIR}/plugins/mac_resolv
${INSTALL_DATA} ${WRKSRC}/plugins/mac_resolv/manuf ${STAGEDIR}${DATADIR}/plugins/mac_resolv
.endif
${MKDIR} ${STAGEDIR}${ETCDIR}
${INSTALL_DATA} ${WRKSRC}/config_ndpmon.xml ${STAGEDIR}${ETCDIR}/config_ndpmon.xml-dist
${MKDIR} ${STAGEDIR}${PREFIX}/var/ndpmon
${INSTALL_DATA} ${WRKSRC}/neighbor_list.xml ${STAGEDIR}${PREFIX}/var/ndpmon/neighbor_list.xml
.if ${PORT_OPTIONS:MDOCS}
${MKDIR} ${STAGEDIR}${DOCSDIR}
cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}
.endif
.if ${PORT_OPTIONS:MMACRESOLV}
@${CAT} ${PKGMESSAGE}.MACRESOLV
.endif
.include <bsd.port.mk>

2
net-mgmt/ndpmon/distinfo Normal file
View file

@ -0,0 +1,2 @@
SHA256 (ndpmon-1.4.0.tgz) = 132df9d8d3bfa263025131c713278026ae1ee0a423a91652b7a15259363efaeb
SIZE (ndpmon-1.4.0.tgz) = 321695

View file

@ -0,0 +1,24 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: ndpmonitor
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
. /etc/rc.subr
name="ndpmonitor"
rcvar=ndpmonitor_enable
command="%%PREFIX%%/sbin/ndpmon"
required_files=%%ETCDIR%%/config_ndpmon.xml
load_rc_config $name
: ${ndpmonitor_enable="NO"}
command_args=">/dev/null 2>&1 &"
run_rc_command "$1"

View file

@ -0,0 +1,28 @@
$FreeBSD$
--- config_ndpmon.xml.orig
+++ config_ndpmon.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="config.xsl" ?>
-<!DOCTYPE config_ndpmon SYSTEM "/usr/local/etc/ndpmon/config_ndpmon.dtd">
+<!DOCTYPE config_ndpmon SYSTEM "%%PREFIX%%/share/ndpmon/config_ndpmon.dtd">
<config_ndpmon>
<ignor_autoconf>1</ignor_autoconf>
<syslog_facility>LOG_LOCAL1</syslog_facility>
@@ -8,12 +8,12 @@
<actions_low_pri>
<sendmail>1</sendmail>
<syslog>1</syslog>
- <exec_pipe_program>/usr/local/ndpmon/create_html_table.py</exec_pipe_program>
+ <exec_pipe_program>%%PREFIX%%/share/ndpmon/create_html_table.py</exec_pipe_program>
</actions_low_pri>
<actions_high_pri>
<sendmail>1</sendmail>
<syslog>1</syslog>
- <exec_pipe_program>/usr/local/ndpmon/create_html_table.py</exec_pipe_program>
+ <exec_pipe_program>%%PREFIX%%/share/ndpmon/create_html_table.py</exec_pipe_program>
</actions_high_pri>
<use_reverse_hostlookups>1</use_reverse_hostlookups>
<routers>

View file

@ -0,0 +1,25 @@
--- config_ndpmon.xml.in.orig 2009-08-13 11:22:21.000000000 +0200
+++ config_ndpmon.xml.in 2013-06-10 00:36:17.000000000 +0200
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="config.xsl" ?>
-<!DOCTYPE config_ndpmon SYSTEM "@CONFDIR@/ndpmon/config_ndpmon.dtd">
+<!DOCTYPE config_ndpmon SYSTEM "%%PREFIX%%/share/ndpmon/config_ndpmon.dtd">
<config_ndpmon>
<ignor_autoconf>1</ignor_autoconf>
<syslog_facility>LOG_LOCAL1</syslog_facility>
@@ -8,12 +8,12 @@
<actions_low_pri>
<sendmail>1</sendmail>
<syslog>1</syslog>
- <exec_pipe_program>/usr/local/ndpmon/create_html_table.py</exec_pipe_program>
+ <exec_pipe_program>%%PREFIX%%/share/ndpmon/create_html_table.py</exec_pipe_program>
</actions_low_pri>
<actions_high_pri>
<sendmail>1</sendmail>
<syslog>1</syslog>
- <exec_pipe_program>/usr/local/ndpmon/create_html_table.py</exec_pipe_program>
+ <exec_pipe_program>%%PREFIX%%/share/ndpmon/create_html_table.py</exec_pipe_program>
</actions_high_pri>
<use_reverse_hostlookups>1</use_reverse_hostlookups>
<routers>

View file

@ -0,0 +1,20 @@
$FreeBSD$
--- create_html_table.py.orig 2010-12-18 23:33:50.000000000 +0100
+++ create_html_table.py 2010-12-18 23:35:24.000000000 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!%%LOCALBASE%%/bin/python
# takes in input the alerts via the pipe
# write the alerts in a file in XML format
@@ -11,7 +11,7 @@
from xml.dom import Node
# The file in which we will write the alerts
-alerts = "/var/local/ndpmon/alerts.xml"
+alerts = "%%PREFIX%%/var/ndpmon/alerts.xml"
# The alert itself piped from NDPmon to this script
lines = sys.stdin.readlines()

View file

@ -0,0 +1,21 @@
$FreeBSD$
--- demopipeprogram.pl.sample.orig
+++ demopipeprogram.pl.sample
@@ -1,7 +1,7 @@
#!/usr/bin/perl
my $i=0;
-open DATA, ">>/usr/local/ndpmon/test.txt" or die "Cannot open /usr/local/ndpmon/test.txt for writing\n";
+open DATA, ">>%%PREFIX%%/var/ndpmon/ndpmon_test.txt" or die "Cannot open %%PREFIX%%/var/ndpmon/ndpmon_test.txt for writing\n";
print DATA "-----\n";
while (<STDIN>) {
@@ -14,4 +14,4 @@
}
print DATA "-----\n\n";
-close DATA;
\ No newline at end of file
+close DATA;

View file

@ -0,0 +1,35 @@
$FreeBSD$
--- ndpmon.8.orig
+++ ndpmon.8
@@ -57,12 +57,12 @@
.B -f
flag is used to change the path of the configuration file.
The default is
-.IR /usr/local/ndpmon/config_ndpmon.xml
+.IR %%PREFIX%%/etc/config_ndpmon.xml
.LP
The
.B -e
flag is used to change the path to the DTD file for the configuration file. The default is
-.I /usr/local/ndpmon/config_ndpmon.dtd
+.I %%PREFIX%%/share/ndpmon/config_ndpmon.dtd
.LP
The
.B -n
@@ -83,12 +83,12 @@
The
.B -d
flag is used to change the path to the DTD file for the neighbor cache. The default is
-.I /usr/local/ndpmon/neighbor_list.dtd
+.I %%PREFIX%%/share/ndpmon/neighbor_list.dtd
.LP
The
.B -g
flag is used to change the path to the neighbor cache. The default is
-.I /usr/local/ndpmon/neighbor_list.xml
+.I %%PREFIX%%/var/ndpmon/ndpmon_neighbor_list.xml
.LP
Note that an empty
.I neighbor_cache.xml

View file

@ -0,0 +1,19 @@
--- ndpmon_defs.h.in.orig 2009-08-13 11:22:21.000000000 +0200
+++ ndpmon_defs.h.in 2013-06-09 22:25:30.000000000 +0200
@@ -9,12 +9,12 @@
#include "./plugins/mac_resolv/mac_resolv.h"
#endif
-#define _CONFIG_PATH_ "@CONFDIR@/ndpmon/config_ndpmon.xml"
-#define _CONFIG_DTD_PATH_ "@CONFDIR@/ndpmon/config_ndpmon.dtd"
+#define _CONFIG_PATH_ "@prefix@/etc/ndpmon/config_ndpmon.xml"
+#define _CONFIG_DTD_PATH_ "@prefix@/share/ndpmon/config_ndpmon.dtd"
#define _CACHE_PATH_ "@VARDATADIR@/ndpmon/neighbor_list.xml"
-#define _CACHE_DTD_PATH_ "@VARDATADIR@/ndpmon/neighbor_list.dtd"
+#define _CACHE_DTD_PATH_ "@prefix@/share/ndpmon/neighbor_list.dtd"
#define _DISCOVERY_HISTORY_PATH_ "@VARDATADIR@/ndpmon/discovery_history.dat"
-#define _MANUF_PATH_ "@prefix@/ndpmon/plugins/mac_resolv/manuf"
+#define _MANUF_PATH_ "@prefix@/share/ndpmon/plugins/mac_resolv/manuf"
extern int DEBUG;
extern int learning;

View file

@ -0,0 +1,13 @@
$FreeBSD$
--- neighbor_list.xml.in.orig
+++ neighbor_list.xml.in
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="neighbor.xsl" ?>
<!DOCTYPE neighbor_list
-SYSTEM "@VARDATADIR@/ndpmon/neighbor_list.dtd">
+SYSTEM "@prefix@/share/ndpmon/neighbor_list.dtd">
<neighbor_list>
</neighbor_list>

View file

@ -0,0 +1,15 @@
$FreeBSD$
--- parser.c.orig
+++ parser.c
@@ -77,8 +77,8 @@
write_proc("/proc/sys/net/ipv6/conf/all/accept_ra_defrtr",flag);
write_proc("/proc/sys/net/ipv6/conf/all/accept_ra_pinfo",flag);
write_proc("/proc/sys/net/ipv6/conf/all/accept_redirects",flag);
- }
#endif
+ }
xmlXPathFreeObject (xmlobject);
return;
}

View file

@ -0,0 +1,9 @@
--- plugins/mac_resolv/Makefile.in.orig 2014-09-05 10:53:57 UTC
+++ plugins/mac_resolv/Makefile.in
@@ -7,5 +7,5 @@
-rm -rf *~ *.o
mac_resolv.o: mac_resolv.c
- -./make-manuf
+ -perl ./make-manuf
$(CC) $(FLAGS) `xml2-config --cflags` -c mac_resolv.c -o mac_resolv.o

View file

@ -0,0 +1,14 @@
$FreeBSD$
--- plugins/mac_resolv/make-manuf.orig
+++ plugins/mac_resolv/make-manuf
@@ -27,7 +27,7 @@
$outfile = "manuf";
$inheader = 1;
$ieee_url = "http://standards.ieee.org/regauth/oui/oui_public.txt";
-$cb_url = "http://www.cavebear.com/CaveBear/Ethernet/Ethernet.txt";
+$cb_url = "http://www.cavebear.com/archive/cavebear/Ethernet/Ethernet.txt";
%oui_list = ();
$hp = "[0-9a-fA-F]{2}";
$oui_re = "$hp:$hp:$hp";

View file

@ -0,0 +1,29 @@
$FreeBSD$
--- routers.c.orig
+++ routers.c
@@ -261,9 +261,11 @@
if (tmp->param_flags_reserved&ND_RA_FLAG_OTHER) {
fprintf(stderr,"OTHER ");
}
+/* no support for home agent in FreeBSD
if (tmp->param_flags_reserved&ND_RA_FLAG_HOME_AGENT) {
fprintf(stderr,"HOME_AGENT ");
}
+*/
fprintf(stderr,"]\n");
fprintf(stderr," router lifetime: %u\n", tmp->param_router_lifetime);
fprintf(stderr," reachable timer: %u\n", tmp->param_reachable_timer);
@@ -297,9 +299,11 @@
if (ptmp->param_flags_reserved&ND_OPT_PI_FLAG_AUTO) {
fprintf(stderr,"AUTO ");
}
+/* No suuportin FreeBSD yet
if (ptmp->param_flags_reserved&ND_OPT_PI_FLAG_RADDR) {
fprintf(stderr,"RADDR ");
}
+*/
fprintf(stderr,"]\n");
fprintf(stderr," valid time: %u\n", ptmp->param_valid_time);
fprintf(stderr," preferred time: %u\n", ptmp->param_preferred_time);

10
net-mgmt/ndpmon/pkg-descr Normal file
View file

@ -0,0 +1,10 @@
NDPMon is an equivalent of ArpWatch for IPv6.
NDPMon, Neighbor Discovery Protocol Monitor, is a tool working with
ICMPv6 packets. NDPMon observes the local network to see if nodes
using neighbor discovery messages behave properly. When it detects
a suspicious Neighbor Discovery message, it notifies the administrator
by writing in the syslog and in some cases by sending an email
report.
WWW: http://ndpmon.sourceforge.net

View file

@ -0,0 +1,10 @@
*****************************************************************
* *
* To update to local MAC database run the following commands: *
* *
* cd /usr/local/share/ndpmon/plugins/mac_resolv/ *
* ./make-manuf *
* /usr/local/etc/rc.d/ndpmonitor restart *
* *
*****************************************************************

18
net-mgmt/ndpmon/pkg-plist Normal file
View file

@ -0,0 +1,18 @@
%%ETCDIR%%/config_ndpmon.xml-dist
sbin/ndpmon
man/man8/ndpmon.8.gz
%%DATADIR%%/config_ndpmon.dtd
%%DATADIR%%/demopipeprogram.pl.sample
%%DATADIR%%/neighbor_list.dtd
%%PY%%%%DATADIR%%/create_html_table.py
%%MACRESOLV%%%%DATADIR%%/plugins/mac_resolv/make-manuf
%%MACRESOLV%%%%DATADIR%%/plugins/mac_resolv/manuf.tmpl
%%MACRESOLV%%%%DATADIR%%/plugins/mac_resolv/wka.tmpl
%%MACRESOLV%%%%DATADIR%%/plugins/mac_resolv/manuf
var/ndpmon/neighbor_list.xml
@dirrmtry var/ndpmon
@dirrmtry var
%%MACRESOLV%%@dirrmtry %%DATADIR%%/plugins/mac_resolv
%%MACRESOLV%%@dirrmtry %%DATADIR%%/plugins
@dirrmtry %%DATADIR%%
@dirrmtry %%ETCDIR%%