diff options
author | shaun <shaun@FreeBSD.org> | 2006-07-13 08:11:12 +0800 |
---|---|---|
committer | shaun <shaun@FreeBSD.org> | 2006-07-13 08:11:12 +0800 |
commit | 054feab76d8a9411698d05681b6da32194529b89 (patch) | |
tree | c5276489eb2d6f3129000ffd38bfd721ecfc57ad /net-mgmt/netdisco/files | |
parent | 9805165001ef8bfd0995532edecb2d9573ac41d1 (diff) | |
download | freebsd-ports-gnome-054feab76d8a9411698d05681b6da32194529b89.tar.gz freebsd-ports-gnome-054feab76d8a9411698d05681b6da32194529b89.tar.zst freebsd-ports-gnome-054feab76d8a9411698d05681b6da32194529b89.zip |
Add net-mgmt/netdisco - a powerful web-based tool for managing and
mapping moderate to large sized networks.
PR: ports/95563
Submitted by: shaun (me)
Approved by: ahze (mentor, implicit)
Diffstat (limited to 'net-mgmt/netdisco/files')
-rw-r--r-- | net-mgmt/netdisco/files/netdisco.sh.in | 42 | ||||
-rw-r--r-- | net-mgmt/netdisco/files/patch-netdisco | 35 | ||||
-rw-r--r-- | net-mgmt/netdisco/files/patch-netdisco.conf | 68 | ||||
-rw-r--r-- | net-mgmt/netdisco/files/patch-netdisco.crontab | 46 | ||||
-rw-r--r-- | net-mgmt/netdisco/files/patch-netdisco_apache.conf | 59 | ||||
-rw-r--r-- | net-mgmt/netdisco/files/patch-netdisco_apache_dir.conf | 13 | ||||
-rw-r--r-- | net-mgmt/netdisco/files/patch-sql_pg_init | 15 | ||||
-rw-r--r-- | net-mgmt/netdisco/files/pkg-install.in | 38 | ||||
-rw-r--r-- | net-mgmt/netdisco/files/pkg-message.in | 29 |
9 files changed, 345 insertions, 0 deletions
diff --git a/net-mgmt/netdisco/files/netdisco.sh.in b/net-mgmt/netdisco/files/netdisco.sh.in new file mode 100644 index 000000000000..5128a8847276 --- /dev/null +++ b/net-mgmt/netdisco/files/netdisco.sh.in @@ -0,0 +1,42 @@ +#!/bin/sh +# +# PROVIDE: netdisco +# REQUIRE: DAEMON +# BEFORE: LOGIN + +. %%RC_SUBR%% + +name="netdisco" +rcvar=`set_rcvar` + +load_rc_config $name + +: ${netdisco_enable="NO"} +: ${netdisco_user="netdisco"} +: ${netdisco_group="netdisco"} + +start_cmd=${name}_start +stop_cmd=${name}_stop +restart_cmd=${name}_restart +status_cmd=${name}_status + +command="%%PREFIX%%/bin/netdisco" +required_files="%%PREFIX%%/etc/netdisco.conf" + +netdisco_start() { + %%PREFIX%%/bin/netdisco -p start +} + +netdisco_stop() { + %%PREFIX%%/bin/netdisco -p stop +} + +netdisco_restart() { + %%PREFIX%%/bin/netdisco -p restart +} + +netdisco_status() { + %%PREFIX%%/bin/netdisco -p status +} + +run_rc_command "$1" diff --git a/net-mgmt/netdisco/files/patch-netdisco b/net-mgmt/netdisco/files/patch-netdisco new file mode 100644 index 000000000000..fa3867285044 --- /dev/null +++ b/net-mgmt/netdisco/files/patch-netdisco @@ -0,0 +1,35 @@ +--- netdisco.orig Mon Dec 6 23:45:47 2004 ++++ netdisco Sun Apr 9 23:45:16 2006 +@@ -114,7 +114,7 @@ + &header if (grep(/^([aABdeEFgIikKmMOprRTu]|expire-nodes-subnet)$/,keys %args) and !$BatchMode); + + # Parse Config File - Check for -C, then in current dir, then in default dir. +-foreach my $c ($args{C},"$FindBin::Bin/netdisco.conf",'/usr/local/netdisco/netdisco.conf') { ++foreach my $c ($args{C},"$FindBin::Bin/netdisco.conf",'%%PREFIX%%/etc/netdisco/netdisco.conf') { + if (defined $c and -r $c){ + $configfile = $c; + print "Using Config File : $configfile\n" if $DEBUG; +@@ -600,9 +600,9 @@ + + my ($file_name,$want_time,$no_header) = @_; + +- my $file_path = $CONFIG{datadir} || 'data'; +- my $home = $CONFIG{home} || '/usr/local/netdisco'; +- $file_path = "$home/$file_path"; ++ my $file_path = $CONFIG{datadir} || '%%DBDIR%%/netdisco'; ++ my $home = $CONFIG{home} || '%%DATADIR%%'; ++# $file_path = "$home/$file_path"; + + my $extension = defined $CONFIG{logextension} ? $CONFIG{logextension} : 'log'; + +@@ -3328,8 +3328,8 @@ + =cut + sub admin_daemon_pid { + my $pid = shift; +- my $pid_file = $CONFIG{daemon_pid} || 'netdisco_daemon.pid'; +- $pid_file = "$CONFIG{home}/$pid_file"; ++ my $pid_file = $CONFIG{daemon_pid} || '%%RUNDIR%%/netdisco_daemon.pid'; ++# $pid_file = "$CONFIG{home}/$pid_file"; + + if (defined $pid) { + print "Writing pid:$pid to $pid_file\n" if $DEBUG; diff --git a/net-mgmt/netdisco/files/patch-netdisco.conf b/net-mgmt/netdisco/files/patch-netdisco.conf new file mode 100644 index 000000000000..ee40a0b449de --- /dev/null +++ b/net-mgmt/netdisco/files/patch-netdisco.conf @@ -0,0 +1,68 @@ +--- netdisco.conf.orig Tue Nov 16 19:18:10 2004 ++++ netdisco.conf Sat Apr 8 22:53:52 2006 +@@ -12,8 +12,8 @@ + + # ---- General Settings ---- + domain = .mycompany.com +-home = /usr/local/netdisco +-topofile = netdisco-topology.txt ++home = %%DATADIR%% ++topofile = %%PREFIX%%/etc/netdisco-topology.txt + timeout = 90 + macsuck_timeout = 90 + #macsuck_all_vlans = true +@@ -21,6 +21,7 @@ + #macsuck_no = + #discover_no = + #arpnip_no = 192.168.5.5,192.168.0.0/24,192.168.2.1,192.168.5.0/26 ++mibshome = %%DATADIR%%/mibs + + # -- Database Maintenance and Data Removal -- + expire_devices = 60 +@@ -29,7 +30,7 @@ + + # ---- Admin Panel Daemon Settings ---- + daemon_bg = true +-daemon_pid = netdisco_daemon.pid ++daemon_pid = %%RUNDIR%%/netdisco.pid + daemon_poll = 2 + + # ---- Port Control Settings --- +@@ -44,7 +45,7 @@ + # Data Archiving and Logging + compresslogs = true + compress = /usr/bin/gzip -f +-datadir = data ++datadir = %%DBDIR%%/netdisco + logextension = txt + #nmis_dump = netdisco_nmis + +@@ -77,24 +78,24 @@ + snmpretries = 3 + snmpver = 2 + # remove any vendors not in use on your network from below line. Do not remove rfc or net-snmp. +-mibdirs = $home/mibs/allied,$home/mibs/asante,$home/mibs/cisco,$home/mibs/hp,$home/mibs/nortel,$home/mibs/rfc,$home/mibs/net-snmp ++mibdirs = $mibshome/mibs/allied,$mibshome/mibs/asante,$mibshome/mibs/cisco,$mibshome/mibs/hp,$mibshome/mibs/nortel,$mibshome/mibs/rfc,$mibshome/mibs/net-snmp + + # ---- Graph Settings ---- + edge_color = wheat + +-graph = html/netmap.gif ++graph = netmap.gif + graph_bg = black + graph_color = white + #graph_dir = net_dir.gif + graph_epsilon = 6 + graph_layout = twopi # try neato too +-graph_map = html/netmap.map ++graph_map = netmap.map + graph_overlap = scale + graph_nodesep = 2 + graph_ranksep = .3 + #graph_raw = graph_raw.dot + graph_splines = false +-#graph_svg = html/netmap.svg ++#graph_svg = netmap.svg + graph_timeout = 90 + graph_x = 30 + graph_y = 30 diff --git a/net-mgmt/netdisco/files/patch-netdisco.crontab b/net-mgmt/netdisco/files/patch-netdisco.crontab new file mode 100644 index 000000000000..b889f3c891bd --- /dev/null +++ b/net-mgmt/netdisco/files/patch-netdisco.crontab @@ -0,0 +1,46 @@ +--- netdisco.crontab.orig Sun Dec 5 02:14:26 2004 ++++ netdisco.crontab Sat Apr 8 23:11:20 2006 +@@ -4,34 +4,34 @@ + # $Id: netdisco.crontab,v 1.7 2004/12/05 02:14:26 maxbaker Exp $ + + #MAILTO=max +-PATH=/bin:/usr/bin:/usr/local/bin ++PATH=/bin:/usr/bin:%%PREFIX%%/bin + + # -- Weekly -- + + # Walk network for new devices once a week (Wed @ 14:00) +-0 14 * * 3 /usr/local/netdisco/netdisco -b -r center_network_device ++0 14 * * 3 %%PREFIX%%/bin/netdisco -b -r center_network_device + + # -- Daily -- + + # Backup at 1am every day +-0 1 * * * /usr/local/netdisco/netdisco -b -B ++0 1 * * * %%PREFIX%%/bin/netdisco -b -B + + # Restart admin panel daemon nightly +-0 2 * * * /usr/local/netdisco/netdisco -p restart ++0 2 * * * %%PREFIX%%/bin/netdisco -p restart + + # Refresh Graph every day +-0 3 * * * /usr/local/netdisco/netdisco -b -g 2>&1 ++0 3 * * * %%PREFIX%%/bin/netdisco -b -g 2>&1 + + # Refresh Devices at 9:00 every day +-0 9 * * * /usr/local/netdisco/netdisco -b -R ++0 9 * * * %%PREFIX%%/bin/netdisco -b -R + + # -- Hourly -- + + # Arp Nip every hour on the half hour +-30 * * * * /usr/local/netdisco/netdisco -b -a ++30 * * * * %%PREFIX%%/bin/netdisco -b -a + + # Mac Suck every 2 hours +-0 */2 * * * /usr/local/netdisco/netdisco -b -m ++0 */2 * * * %%PREFIX%%/bin/netdisco -b -m + + # Grab NetBios Info from Nodes three times a day +-0 8,13,21 * * * /usr/local/netdisco/netdisco -b -w ++0 8,13,21 * * * %%PREFIX%%/bin/netdisco -b -w diff --git a/net-mgmt/netdisco/files/patch-netdisco_apache.conf b/net-mgmt/netdisco/files/patch-netdisco_apache.conf new file mode 100644 index 000000000000..816517be41eb --- /dev/null +++ b/net-mgmt/netdisco/files/patch-netdisco_apache.conf @@ -0,0 +1,59 @@ +--- netdisco_apache.conf.orig Sun Mar 7 19:13:49 2004 ++++ netdisco_apache.conf Sun Apr 9 17:44:59 2006 +@@ -2,25 +2,35 @@ + # This file applied to the global server space. + # $Id: netdisco_apache.conf,v 1.12 2004/03/07 19:13:49 maxbaker Exp $ + ++#Apache 2.x --- ++%%APACHE2%%LoadModule apreq_module /usr/local/libexec/apache2/mod_apreq2.so ++#-------------- ++ + # Pool Database Connections + PerlModule Apache::DBI + +-<Directory /usr/local/netdisco/html> ++#Apache 2.x --- ++%%APACHE2%%PerlModule CGI ++%%APACHE2%%PerlModule Apache2::Request ++%%APACHE2%%PerlModule Apache2::compat ++#-------------- ++ ++<Directory %%WWWDATADIR%%> + order allow,deny + allow from all + </Directory> + ++<Directory %%WWWDATADIR%%/mason> ++ order allow,deny ++ deny from all ++</Directory> ++ + <Perl> + # Preload the netdisco module into global server space. + # and parse the config file only once. + { package HTML::Mason::Commands; +- use lib '/usr/local/netdisco'; + use netdisco qw/:all/; +- &netdisco::config('/usr/local/netdisco/netdisco.conf'); +- +- # Uncomment next two lines to setup switch reverse proxy. +- #use lib '/usr/local/netdisco/switch'; +- #use Apache::ProxyRewriteMax; ++ &netdisco::config('%%PREFIX%%/etc/netdisco/netdisco.conf'); + } + + # Setup Mason and Session Handler +@@ -30,10 +40,11 @@ + use strict; + + my $ah = new HTML::Mason::ApacheHandler( +- comp_root => '/usr/local/netdisco/html', +- data_dir => '/usr/local/netdisco/mason', ++ comp_root => '%%WWWDATADIR%%', ++ data_dir => '%%WWWDATADIR%%/mason', + request_class => 'MasonX::Request::WithApacheSession', + session_class => 'Apache::Session::Postgres', ++%%APACHE2%% args_method => 'mod_perl', + session_commit => 1, + session_use_cookie => 1, + session_cookie_expires => '+1y', diff --git a/net-mgmt/netdisco/files/patch-netdisco_apache_dir.conf b/net-mgmt/netdisco/files/patch-netdisco_apache_dir.conf new file mode 100644 index 000000000000..8426d95bbbce --- /dev/null +++ b/net-mgmt/netdisco/files/patch-netdisco_apache_dir.conf @@ -0,0 +1,13 @@ +--- netdisco_apache_dir.conf.orig Wed May 7 02:07:35 2003 ++++ netdisco_apache_dir.conf Sat Apr 8 23:44:17 2006 +@@ -1,8 +1,8 @@ + # Apache Configuration for Netdisco + # This is applied to each virtual server + +-Alias /netdisco "/usr/local/netdisco/html/" +-Alias /netdisco/ "/usr/local/netdisco/html/" ++Alias /netdisco "%%WWWDATADIR%%" ++Alias /netdisco/ "%%WWWDATADIR%%" + + <Location /netdisco> + Options +Indexes diff --git a/net-mgmt/netdisco/files/patch-sql_pg_init b/net-mgmt/netdisco/files/patch-sql_pg_init new file mode 100644 index 000000000000..37fceec4a732 --- /dev/null +++ b/net-mgmt/netdisco/files/patch-sql_pg_init @@ -0,0 +1,15 @@ +--- sql/pg_init.orig Sat Apr 8 23:07:02 2006 ++++ sql/pg_init Sat Apr 8 23:06:21 2006 +@@ -5,10 +5,10 @@ + + # Change these to match your setup + # Linux Default +-SYSDBUSER=postgres ++# SYSDBUSER=postgres + + # BSD Default +-# SYSDBUSER=pgsql ++SYSDBUSER=pgsql + + DB=netdisco + diff --git a/net-mgmt/netdisco/files/pkg-install.in b/net-mgmt/netdisco/files/pkg-install.in new file mode 100644 index 000000000000..5b32b469bcab --- /dev/null +++ b/net-mgmt/netdisco/files/pkg-install.in @@ -0,0 +1,38 @@ +#!/bin/sh + +if [ x"$2" != x"POST-INSTALL" ]; then + exit 0 +fi + +USER=netdisco +GROUP=${USER} +UID=840 +GID=${UID} +USERS_HOME="/nonexistent" + +if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi +fi + +if ! pw usershow "${USER}" 2>/dev/null 1>&2; then + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -s "/bin/sh" -d ${USERS_HOME} -c "netdisco user"; \ + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi +fi + +chown -R ${USER}:${GROUP} ${PKG_PREFIX}/etc/netdisco +chmod 660 ${PKG_PREFIX}/etc/netdisco/* + +chown ${USER}:${GROUP} %%DBDIR%%/netdisco + +exit 0 diff --git a/net-mgmt/netdisco/files/pkg-message.in b/net-mgmt/netdisco/files/pkg-message.in new file mode 100644 index 000000000000..acf97b393e8f --- /dev/null +++ b/net-mgmt/netdisco/files/pkg-message.in @@ -0,0 +1,29 @@ +------------------------------------------------------------------------ +Netdisco has been installed. + +In order to get up and running, there are a few more steps to complete: + + 1) Run the following to create and initialise the netdisco database: + + sh %%DATADIR%%/sql/pg_init + sh %%DATADIR%%/sql/pg_run + sh %%DATADIR%%/sql/pg_all + + 2) Examine all the configuration files in %%PREFIX%%/etc/netdisco, + and modify them to suit your needs. + + 3) Add an initial admin user by running 'netdisco -u' + + 4) Import the OUI database: netdisco -o + + 5) Edit %%PREFIX%%/etc/netdisco/netdisco.crontab and change + center_network_device to one of your core routers/switches. Then + install the crontab: + + crontab -u netdisco %%PREFIX%%/etc/netdisco/netdisco.crontab + + 6) Add netdisco_enable="YES" to /etc/rc.conf, and then run + %%PREFIX%%/etc/rc.d/netdisco to start the admin daemon. + + 7) Apache must be stopped/started (a graceful restart won't work) +------------------------------------------------------------------------ |