SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

38
net/mon/server/Makefile Normal file
View file

@ -0,0 +1,38 @@
COMMENT = service monitoring daemon
DISTNAME = mon-${V}
REVISION = 13
WANTLIB = c
RUN_DEPENDS = devel/p5-Time-Period
NO_TEST = Yes
EG_DIR = ${PREFIX}/share/examples/mon/
post-configure:
${SUBST_CMD} ${WRKSRC}/etc/example.cf ${WRKSRC}/etc/very-simple.cf \
${WRKSRC}/mon.d/Makefile ${WRKSRC}/mon.d/fping.monitor
do-build:
@cd ${WRKSRC}/mon.d && env -i ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS}
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/mon ${PREFIX}/bin/mon
${INSTALL_MAN} ${WRKSRC}/doc/mon.8 ${PREFIX}/man/man8/
${INSTALL_DATA_DIR} ${PREFIX}/lib/mon
${INSTALL_DATA_DIR} ${PREFIX}/lib/mon/{mon.d,alert.d}
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/mon/
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/mon/
${INSTALL_DATA} ${WRKSRC}/etc/snmpvar.def ${EG_DIR}
${INSTALL_DATA} ${WRKSRC}/etc/syslog-monitor.conf ${EG_DIR}
${INSTALL_DATA} ${WRKSRC}/etc/*.cf ${EG_DIR}
${INSTALL_DATA} ${WRKSRC}/doc/README.* ${PREFIX}/share/doc/mon/
${INSTALL_SCRIPT} ${WRKSRC}/mon.d/*.monitor ${PREFIX}/lib/mon/mon.d/
${INSTALL_SCRIPT} ${WRKSRC}/alert.d/*.alert ${PREFIX}/lib/mon/alert.d/
@cd ${WRKSRC}/mon.d && env -i ${MAKE_ENV} \
${MAKE_PROGRAM} ${ALL_FAKE_FLAGS} -f ${MAKE_FILE} ${FAKE_TARGET}
.include <bsd.port.mk>

2
net/mon/server/distinfo Normal file
View file

@ -0,0 +1,2 @@
SHA256 (mon-1.2.0.tar.gz) = l/V6JhQYplIoIGEtRtqwCcTcQHW5Iz9a/YOpE2+edTU=
SIZE (mon-1.2.0.tar.gz) = 298884

View file

@ -0,0 +1,59 @@
--- alert.d/irc.alert.orig Wed Apr 28 15:49:08 2010
+++ alert.d/irc.alert Wed Apr 28 15:49:18 2010
@@ -22,6 +22,8 @@
# -N num try num different nicks before giving up
# -p secs when showing detail, pause secs between
# sending each line. secs may be fractional.
+# -P port
+# -e encrypt (ie use ssl)
#
# Jim Trocki, trockij@arctic.org
#
@@ -45,11 +47,12 @@
#
use strict;
use IO::Socket::INET;
+use IO::Socket::SSL;
use Getopt::Std;
use English;
my %opt;
-getopts ("s:g:h:t:uTOjc:S:U:n:dN:p:", \%opt);
+getopts ("s:g:h:t:uTOjc:S:U:n:dN:p:P:e", \%opt);
my $CHAN = $opt{"c"} || "mon";
my $NICK = $opt{"n"} || "mon";
@@ -58,6 +61,7 @@ my $SERVER = $opt{"S"} || die "must supply server via
my $NICK_TRIES = $opt{"N"} || 5;
my $PAUSE = $opt{"p"} || 0;
my $TIMEOUT = 10;
+my $PORT = $opt{"P"} || 6667;
#
# read in what the mon server sends us about the alert
@@ -82,11 +86,20 @@ eval
#
# make the connection
#
- my $s = new IO::Socket::INET (
- "PeerAddr" => "$SERVER:6667",
- "Proto" => "tcp",
- "Timeout" => 10,
- );
+ my $s;
+ if ( $opt{"e"} ) {
+ $s = new IO::Socket::SSL (
+ "PeerAddr" => "$SERVER:$PORT",
+ "Proto" => "tcp",
+ "Timeout" => 10,
+ );
+ } else {
+ $s = new IO::Socket::INET (
+ "PeerAddr" => "$SERVER:$PORT",
+ "Proto" => "tcp",
+ "Timeout" => 10,
+ );
+ }
die if (!defined $s);

View file

@ -0,0 +1,11 @@
--- alert.d/mail.alert.orig Mon Oct 12 16:03:19 2009
+++ alert.d/mail.alert Mon Oct 12 16:03:30 2009
@@ -46,7 +46,7 @@ $ALERT = $opt_u ? "UPALERT" : "ALERT";
$t = localtime($opt_t);
($wday,$mon,$day,$tm) = split (/\s+/, $t);
-open (MAIL, "| /usr/lib/sendmail -oi -t $mailfrom") ||
+open (MAIL, "| /usr/sbin/sendmail -oi -t $mailfrom") ||
die "could not open pipe to mail: $!\n";
print MAIL <<EOF;
To: $mailaddrs

View file

@ -0,0 +1,17 @@
--- etc/example.cf.orig Mon Jun 25 15:10:08 2007
+++ etc/example.cf Mon Oct 12 14:10:36 2009
@@ -17,9 +17,11 @@
#
# global options
#
-cfbasedir = /usr/lib/mon/etc
-alertdir = /usr/lib/mon/alert.d
-mondir = /usr/lib/mon/mon.d
+cfbasedir = ${SYSCONFDIR}/mon/
+alertdir = ${PREFIX}/lib/mon/alert.d
+mondir = ${PREFIX}/lib/mon/mon.d
+statedir = /var/mon/state.d
+logdir = /var/mon/log.d
maxprocs = 20
histlength = 100
randstart = 60s

View file

@ -0,0 +1,51 @@
Index: etc/very-simple.cf
--- etc/very-simple.cf.orig
+++ etc/very-simple.cf
@@ -5,30 +5,40 @@
#
-alertdir = /usr/lib/mon/alert.d
-mondir = /usr/lib/mon/mon.d
+alertdir = ${PREFIX}/lib/mon/alert.d
+mondir = ${PREFIX}/lib/mon/mon.d
+cfbasedir = ${SYSCONFDIR}/mon/
+statedir = /var/mon/state.d
+logdir = /var/mon/log.d
maxprocs = 20
histlength = 100
randstart = 60s
+dtlogging = yes
#
# define groups of hosts to monitor
#
hostgroup servers localhost
-hostgroup mail mailhost
-
watch servers
service ping
interval 5m
- monitor fping.monitor
+ monitor ping.monitor
period wd {Mon-Fri} hr {7am-10pm}
alert mail.alert root@localhost
alertevery 1h
period wd {Sat-Sun}
alert mail.alert root@localhost
- service telnet
+ service ssh
interval 10m
- monitor telnet.monitor
+ monitor tcp.monitor -p 22
period wd {Mon-Fri} hr {7am-10pm}
alertevery 1h
alertafter 2 30m
alert mail.alert root@localhost
+ service smtp
+ interval 10m
+ monitor smtp.monitor
+ period wd {Mon-Fri} hr {7am-10pm}
+ alertevery 1h
+ alertafter 2 30m
+ alert mail.alert root@localhost
+ upalert mail.alert root@localhost

View file

@ -0,0 +1,29 @@
--- mon.d/Makefile.orig Wed Jun 9 07:18:05 2004
+++ mon.d/Makefile Wed Dec 10 16:20:41 2008
@@ -3,14 +3,15 @@
#
# compiles on Linux, Solaris 2.5, Solaris 2.6, and AIX Version 4.2
#
-CC = gcc
-CFLAGS = -O2 -Wall -g
-LDFLAGS =
-LDLIBS =
+CC ?= gcc
+CFLAGS ?= -O2 -Wall -g
+LDFLAGS ?=
+LDLIBS ?=
+PREFIX ?= ${PREFIX}
# uncomment next line for Solaris
# LDLIBS = -lnsl -lsocket
-MONPATH=/usr/lib/mon
+MONPATH=$(PREFIX)/lib/mon
DIALIN_MONITOR_REAL=$(MONPATH)/mon.d/dialin.monitor
PROGS = rpc.monitor dialin.monitor.wrap
@@ -31,4 +32,4 @@ clean:
install:
install -d $(MONPATH)/mon.d
install rpc.monitor $(MONPATH)/mon.d/
- install -g uucp -m 02555 dialin.monitor.wrap $(MONPATH)/mon.d/
+ install dialin.monitor.wrap $(MONPATH)/mon.d/

View file

@ -0,0 +1,27 @@
defined(@array) is deprecated. Avoid mon to display
annoying warnings.
--- mon.d/dns.monitor.orig Thu Apr 14 14:24:18 2011
+++ mon.d/dns.monitor Thu Apr 14 14:24:43 2011
@@ -168,18 +168,18 @@ if ( $#ARGV < 0 ) {
exit -1;
}
if (!$CachingServer) {
- if (!defined(@Master)) {
+ if (!@Master) {
print STDERR "$Program: The zone master server must be specified\n";
usage();
exit -1;
}
- if ( !defined(@Zones) ) {
+ if ( !@Zones ) {
print STDERR "$Program: At least one zone must be specified\n";
usage();
exit -1;
}
} else {
- if ( !defined(@Queries) ) {
+ if ( !@Queries ) {
print STDERR "$Program: At least one query must be specified\n";
usage();
exit -1;

View file

@ -0,0 +1,20 @@
--- mon.d/fping.monitor.orig Mon Oct 12 15:55:27 2009
+++ mon.d/fping.monitor Mon Oct 12 15:56:44 2009
@@ -50,7 +50,7 @@ usage if ($opt{"h"});
my $TIMEOUT = $opt{"t"} || 2000;
my $RETRIES = $opt{"r"} || 3;
-my $CMD = "fping -e -r $RETRIES -t $TIMEOUT";
+my $CMD = "${LOCALBASE}/sbin/fping -e -r $RETRIES -t $TIMEOUT";
my $START_TIME = time;
my $END_TIME;
my %details;
@@ -221,7 +221,7 @@ if ($opt{"T"} && @unreachable)
{
foreach my $host (@unreachable)
{
- system ("traceroute -w 3 $host 2>&1");
+ system ("/usr/sbin/traceroute -w 3 $host 2>&1");
}
print "\n";

View file

@ -0,0 +1,11 @@
Index: mon.d/rpc.monitor.c
--- mon.d/rpc.monitor.c.orig
+++ mon.d/rpc.monitor.c
@@ -42,6 +42,7 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <rpc/rpc.h>

15
net/mon/server/pkg/DESCR Normal file
View file

@ -0,0 +1,15 @@
mon is a tool for monitoring the availability of services, and sending alerts
on prescribed events. Services are defined as anything tested by a "monitor"
program, which can be something as simple as pinging a system, or as complex
as analyzing the results of an application-level transaction. Alerts are
actions such as sending emails, making submissions to ticketing systems, or
triggering resource fail-over in a high-availability cluster.
A design goal of mon is to maintain simplicity and provide the right
abstractions for monitoring so that the system can be scalable, easy to use,
and trivial to extend for the widest variety of applications. The learning
curve is very shallow for initial installation, configuration, and
customization. Monitors and alerts are simple to write using any language, and
simple to incorporate into a site configuration. Reporting and control
functionality is easily customized with the aid of a TCP-based protocol
interface.

96
net/mon/server/pkg/PLIST Normal file
View file

@ -0,0 +1,96 @@
@newgroup _mon:643
@newuser _mon:643:_mon::Mon Server:/var/empty:/bin/sh
bin/mon
lib/mon/
lib/mon/alert.d/
lib/mon/alert.d/file.alert
lib/mon/alert.d/irc.alert
lib/mon/alert.d/mail.alert
lib/mon/alert.d/netpage.alert
lib/mon/alert.d/qpage.alert
lib/mon/alert.d/snpp.alert
lib/mon/alert.d/test.alert
lib/mon/alert.d/trap.alert
lib/mon/mon.d/
lib/mon/mon.d/asyncreboot.monitor
lib/mon/mon.d/cpqhealth.monitor
lib/mon/mon.d/dialin.monitor
@bin lib/mon/mon.d/dialin.monitor.wrap
lib/mon/mon.d/dns-query.monitor
lib/mon/mon.d/dns.monitor
lib/mon/mon.d/file_change.monitor
lib/mon/mon.d/foundry-chassis.monitor
lib/mon/mon.d/fping.monitor
lib/mon/mon.d/freespace.monitor
lib/mon/mon.d/ftp.monitor
lib/mon/mon.d/hpnp.monitor
lib/mon/mon.d/http.monitor
lib/mon/mon.d/http_tppnp.monitor
lib/mon/mon.d/imap.monitor
lib/mon/mon.d/ldap.monitor
lib/mon/mon.d/local-syslog.monitor
lib/mon/mon.d/lpd.monitor
lib/mon/mon.d/mon.monitor
lib/mon/mon.d/msql-mysql.monitor
lib/mon/mon.d/na_quota.monitor
lib/mon/mon.d/netappfree.monitor
lib/mon/mon.d/nntp.monitor
lib/mon/mon.d/ntpdate.monitor
lib/mon/mon.d/phttp.monitor
lib/mon/mon.d/ping.monitor
lib/mon/mon.d/pop3.monitor
lib/mon/mon.d/process.monitor
lib/mon/mon.d/radius.monitor
lib/mon/mon.d/rd.monitor
lib/mon/mon.d/reboot.monitor
@bin lib/mon/mon.d/rpc.monitor
lib/mon/mon.d/seq.monitor
lib/mon/mon.d/silkworm.monitor
lib/mon/mon.d/smtp.monitor
lib/mon/mon.d/smtp3.monitor
lib/mon/mon.d/snmpdiskspace.monitor
lib/mon/mon.d/snmpvar.monitor
lib/mon/mon.d/tcp.monitor
lib/mon/mon.d/telnet.monitor
lib/mon/mon.d/trace.monitor
lib/mon/mon.d/traceroute.monitor
lib/mon/mon.d/up_rtt.monitor
lib/mon/mon.d/xedia-ipsec-tunnel.monitor
@man man/man8/mon.8
share/doc/mon/
share/doc/mon/README.alerts
share/doc/mon/README.cgi-bin
share/doc/mon/README.hints
share/doc/mon/README.mon.cgi
share/doc/mon/README.monitors
share/doc/mon/README.msql-mysql.monitor
share/doc/mon/README.paging
share/doc/mon/README.protocol
share/doc/mon/README.rpc.monitor
share/doc/mon/README.snmpdiskspace.monitor
share/doc/mon/README.snmpvar.monitor
share/doc/mon/README.software
share/doc/mon/README.syslog.monitor
share/doc/mon/README.traps
share/doc/mon/README.variables
share/doc/pkg-readmes/${PKGSTEM}
share/examples/mon/
@owner _mon
@group _mon
@sample ${SYSCONFDIR}/mon/
share/examples/mon/auth.cf
@sample ${SYSCONFDIR}/mon/auth.cf
share/examples/mon/example.cf
share/examples/mon/mon.cgi.cf
share/examples/mon/na_quota.cf
share/examples/mon/netappfree.cf
share/examples/mon/snmpdiskspace.cf
share/examples/mon/snmpopt.cf
share/examples/mon/snmpvar.cf
share/examples/mon/snmpvar.def
share/examples/mon/syslog-monitor.conf
share/examples/mon/very-simple.cf
@sample ${SYSCONFDIR}/mon/mon.cf
@sample /var/mon/state.d/
@sample /var/mon/log.d/
@rcscript ${RCDIR}/mon

28
net/mon/server/pkg/README Normal file
View file

@ -0,0 +1,28 @@
+-----------------------------------------------------------------------
| Running ${PKGSTEM} on OpenBSD
+-----------------------------------------------------------------------
mon is a tool for monitoring the availability of services and sending alerts
on prescribed events.
This is a small howto to get mon running in a basic setup.
1. Edit ${SYSCONFDIR}/mon/mon.cf to fit your needs.
2. You may need additional perl modules in order to use some monitors.
Check your monitor file with perl -c.
Example: perl -c ${TRUEPREFIX}/lib/mon/mon.d/dns.monitor
3. Launch mon in debug mode:
/usr/bin/install -d -o _mon /var/run/mon
su -l _mon -c "${TRUEPREFIX}/bin/mon -c /etc/mon/mon.cf -d -P /var/run/mon/mon.pid"
4. When everything is ok, launch mon as a daemon:
${RCDIR}/mon start
Random hints:
* To use fping.monitor you must install fping.
* If you need a graphical interface, please install mon-client which contains
a simple cgi.

16
net/mon/server/pkg/mon.rc Normal file
View file

@ -0,0 +1,16 @@
#!/bin/ksh
daemon="${TRUEPREFIX}/bin/mon"
daemon_flags="-c ${SYSCONFDIR}/mon/mon.cf -f -P /var/run/mon/mon.pid"
daemon_user="_mon"
. /etc/rc.d/rc.subr
pexp="/usr/bin/perl ${daemon}${daemon_flags:+ ${daemon_flags}}"
rc_reload=NO
rc_pre() {
/usr/bin/install -d -o _mon /var/run/mon
}
rc_cmd $1