summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2020-03-26 01:28:55 +0000
committerArmin Kuster <akuster808@gmail.com>2020-03-27 16:53:25 -0700
commit98a6664408f17560549b94f575e058ed84dd6a0d (patch)
tree106bb6ab0cc25f554fbb8b4f618829db25707272
parent7f7897590c74d0979748397a655fd3b4b49de7f4 (diff)
downloadmeta-security-98a6664408f17560549b94f575e058ed84dd6a0d.tar.gz
arpwatch: add new recipe
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--recipes-scanners/arpwatch/arpwatch_3.0.bb79
-rw-r--r--recipes-scanners/arpwatch/files/arpwatch.conf23
-rw-r--r--recipes-scanners/arpwatch/files/arpwatch.default7
-rw-r--r--recipes-scanners/arpwatch/files/arpwatch_init123
-rw-r--r--recipes-scanners/arpwatch/files/host_contam_fix.patch21
-rw-r--r--recipes-scanners/arpwatch/files/postfix_workaround.patch91
6 files changed, 344 insertions, 0 deletions
diff --git a/recipes-scanners/arpwatch/arpwatch_3.0.bb b/recipes-scanners/arpwatch/arpwatch_3.0.bb
new file mode 100644
index 0000000..9be319a
--- /dev/null
+++ b/recipes-scanners/arpwatch/arpwatch_3.0.bb
@@ -0,0 +1,79 @@
1SUMARRY = "The ethernet monitor program; for keeping track of ethernet/ip address pairings"
2LICENSE = "BSD-4-Clause"
3HOME_PAGE = "http://ee.lbl.gov/"
4LIC_FILES_CHKSUM = "file://configure;md5=212742e55562cf47527d31c2a492411a"
5
6DEPENDS += "libpcap postfix"
7
8SRC_URI = "https://ee.lbl.gov/downloads/arpwatch/${BP}.tar.gz \
9 file://arpwatch.conf \
10 file://arpwatch.default \
11 file://arpwatch_init \
12 file://postfix_workaround.patch \
13 file://host_contam_fix.patch "
14
15SRC_URI[sha256sum] = "82e137e104aca8b1280f5cca0ebe61b978f10eadcbb4c4802c181522ad02b25b"
16
17inherit autotools-brokensep update-rc.d useradd
18
19ARPWATCH_UID ?= "arpwatch"
20ARPWATCH_GID ?= "arpwatch"
21APRWATCH_FROM ?= "root "
22ARPWATH_REPLY ?= "${ARPWATCH_UID}"
23
24EXTRA_OECONF = " --srcdir=${S} --with-watcher=email=${APRWATCH_FROM} --with-watchee=email=${ARPWATH_REPLY}"
25
26CONFIGUREOPTS = " --build=${BUILD_SYS} \
27 --host=${HOST_SYS} \
28 --target=${TARGET_SYS} \
29 --prefix=${prefix} \
30 --exec_prefix=${exec_prefix} \
31 --bindir=${bindir} \
32 --sbindir=${sbindir} \
33 --libexecdir=${libexecdir} \
34 --datadir=${datadir} \
35 --sysconfdir=${sysconfdir} \
36 --sharedstatedir=${sharedstatedir} \
37 --localstatedir=${localstatedir} \
38 --libdir=${libdir} \
39 --includedir=${includedir} \
40 --oldincludedir=${oldincludedir} \
41 --infodir=${infodir} \
42 --mandir=${mandir} \
43 "
44
45do_configure () {
46 ${S}/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
47}
48
49do_install () {
50 install -d ${D}${bindir}
51 install -d ${D}${sbindir}
52 install -d ${D}${mandir}
53 install -d ${D}${sysconfdir}
54 install -d ${D}${sysconfdir}/default
55 install -d ${D}${sysconfdir}/init.d
56 install -d ${D}${prefix}/etc/rc.d
57 install -d ${D}/var/lib/arpwatch
58
59 oe_runmake install DESTDIR=${D}
60 install -m 644 ${WORKDIR}/arpwatch.conf ${D}${sysconfdir}
61 install -m 655 ${WORKDIR}/arpwatch_init ${D}${sysconfdir}/init.d/arpwatch
62 install -m 644 ${WORKDIR}/arpwatch.default ${D}${sysconfdir}/default
63}
64
65INITSCRIPT_NAME = "arpwatch"
66INITSCRIPT_PARAMS = "start 02 2 3 4 5 . stop 20 0 1 6 ."
67
68USERADD_PACKAGES = "${PN}"
69GROUPADD_PARAM_${PN} = "--system ${ARPWATCH_UID}"
70USERADD_PARAM_${PN} = "--system -g ${ARPWATCH_GID} --home-dir \
71 ${localstatedir}/spool/${BPN} \
72 --no-create-home --shell /bin/false ${BPN}"
73
74CONFFILE_FILES = "${sysconfdir}/${PN}.conf"
75
76FILES_${PN} = "${bindir} ${sbindir} ${prefix}/etc/rc.d \
77 ${sysconfdir} /var/lib/arpwatch"
78
79RDEPENDS_${PN} = "libpcap postfix postfix-cfg"
diff --git a/recipes-scanners/arpwatch/files/arpwatch.conf b/recipes-scanners/arpwatch/files/arpwatch.conf
new file mode 100644
index 0000000..67213c9
--- /dev/null
+++ b/recipes-scanners/arpwatch/files/arpwatch.conf
@@ -0,0 +1,23 @@
1# /etc/arpwatch.conf: Debian-specific way to watch multiple interfaces.
2# Format of this configuration file is:
3#
4#<dev1> <arpwatch options for dev1>
5#<dev2> <arpwatch options for dev2>
6#...
7#<devN> <arpwatch options for devN>
8#
9# You can set global options for all interfaces by editing
10# /etc/default/arpwatch
11
12# For example:
13
14eth0
15#eth0 -m root
16#eth1 -m root
17#eth2 -m root
18
19# or, if you have an MTA configured for plussed addressing:
20#
21#eth0 -m root+eth0
22#eth1 -m root+eth1
23#eth2 -m root+eth2
diff --git a/recipes-scanners/arpwatch/files/arpwatch.default b/recipes-scanners/arpwatch/files/arpwatch.default
new file mode 100644
index 0000000..b0a7d8f
--- /dev/null
+++ b/recipes-scanners/arpwatch/files/arpwatch.default
@@ -0,0 +1,7 @@
1# Global options for arpwatch(8).
2
3# Debian: don't report bogons, don't use PROMISC.
4ARGS="-N -p"
5
6# Debian: run as `arpwatch' user. Empty this to run as root.
7RUNAS="arpwatch"
diff --git a/recipes-scanners/arpwatch/files/arpwatch_init b/recipes-scanners/arpwatch/files/arpwatch_init
new file mode 100644
index 0000000..9860c65
--- /dev/null
+++ b/recipes-scanners/arpwatch/files/arpwatch_init
@@ -0,0 +1,123 @@
1#!/bin/sh
2
3PATH=/sbin:/bin:/usr/sbin:/usr/bin
4NAME=arpwatch
5DAEMON=/usr/sbin/$NAME
6DESC="Ethernet/FDDI station monitor daemon"
7DATADIR=/var/lib/$NAME
8RETVAL=0
9
10. /etc/init.d/functions
11
12### You shouldn't touch anything below unless you know what you are doing.
13
14[ -f /etc/default/arpwatch ] && . /etc/default/arpwatch
15
16# Decide whether we have to deal with multiple interfaces.
17CONF=/etc/arpwatch.conf
18MULTIPLE=0
19if [ -r $CONF ]; then
20 grep -c '^[a-z]' $CONF 2>&1 >/dev/null && MULTIPLE=1
21fi
22
23# Check whether we have to drop privileges.
24if [ -n "$RUNAS" ]; then
25 if getent passwd "$RUNAS" >/dev/null; then
26 ARGS="-u ${RUNAS} $ARGS"
27 else
28 RUNAS=""
29 fi
30fi
31
32start_instance () {
33 IFACE=$1
34 INSTANCE=${NAME}-${IFACE}
35 DATAFILE=$DATADIR/${IFACE}.dat
36 IFACE_OPTS="-P /var/run/${INSTANCE}.pid -i ${IFACE} -f ${DATAFILE} $2"
37
38 echo -n "Starting $DESC: "
39 if [ ! -f $DATAFILE ]; then
40 echo -n "(creating $DATAFILE) " :> $DATAFILE
41 fi
42 if [ -n "$RUNAS" ]; then
43 echo -n "(chown $RUNAS $DATAFILE) "
44 chown $RUNAS $DATAFILE
45 fi
46 start-stop-daemon --start --quiet \
47 --pidfile /var/run/${INSTANCE}.pid \
48 --exec $DAEMON -- $IFACE_OPTS $ARGS
49 echo "${INSTANCE}."
50 ps h -C $NAME -o pid,args | \
51 awk "/$IFACE/ { print \$1 }" > /var/run/${INSTANCE}.pid
52}
53
54stop_instance () {
55 IFACE=$1
56 INSTANCE=${NAME}-${IFACE}
57 [ -f /var/run/${INSTANCE}.pid ] || return 0
58 echo -n "Stopping $DESC: "
59 start-stop-daemon --stop --quiet --oknodo \
60 --pidfile /var/run/${INSTANCE}.pid
61 echo "${INSTANCE}."
62 rm -f /var/run/${INSTANCE}.pid
63}
64
65process_loop_break_line () {
66 __IFACE=$1
67 shift
68 __IOPTS="$@"
69}
70
71process_loop () {
72 OPERATION=$1
73 grep '^[a-z]' $CONF 2>/dev/null | \
74 while read LINE
75 do
76 process_loop_break_line $LINE
77 I=$__IFACE
78 I_OPTS="$__IOPTS"
79 $OPERATION $I "$I_OPTS"
80 done
81}
82
83startup () {
84 process_loop start_instance
85}
86
87shutdown () {
88 process_loop stop_instance
89}
90
91case "$1" in
92 start)
93 startup
94 ;;
95 stop)
96 shutdown
97 ;;
98 reload)
99 echo "Reload operation not supported -- use restart."
100 RETVAL=2
101 ;;
102 restart|force-reload)
103 #
104 # If the "reload" option is implemented, move the "force-reload"
105 # option to the "reload" entry above. If not, "force-reload" is
106 # just the same as "restart".
107 #
108 shutdown
109 sleep 1
110 startup
111 ;;
112 status)
113 status_of_proc $DAEMON $NAME
114 ;;
115 *)
116 N=/etc/init.d/$NAME
117 # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
118 echo "Usage: $N {start|stop|restart|force-reload}" >&2
119 RETVAL=2
120 ;;
121esac
122
123exit $RETVAL
diff --git a/recipes-scanners/arpwatch/files/host_contam_fix.patch b/recipes-scanners/arpwatch/files/host_contam_fix.patch
new file mode 100644
index 0000000..7d7ffac
--- /dev/null
+++ b/recipes-scanners/arpwatch/files/host_contam_fix.patch
@@ -0,0 +1,21 @@
1This removes the host contamination
2
3Upstream-Status: Inappropriate [embedded specific]
4
5Signed-off-by: Armin Kuster <akuster808@gmail.com>
6
7Index: arpwatch-3.0/configure
8===================================================================
9--- arpwatch-3.0.orig/configure
10+++ arpwatch-3.0/configure
11@@ -4349,8 +4349,8 @@ fi
12 CC=cc
13 export CC
14 fi
15- V_INCLS="$V_INCLS -I/usr/local/include"
16- LDFLAGS="$LDFLAGS -L/usr/local/lib"
17+ V_INCLS="$V_INCLS "
18+ LDFLAGS="$LDFLAGS "
19 if test "$GCC" != yes ; then
20 { $as_echo "$as_me:${as_lineno-$LINENO}: checking that $CC handles ansi prototypes" >&5
21 $as_echo_n "checking that $CC handles ansi prototypes... " >&6; }
diff --git a/recipes-scanners/arpwatch/files/postfix_workaround.patch b/recipes-scanners/arpwatch/files/postfix_workaround.patch
new file mode 100644
index 0000000..95213f2
--- /dev/null
+++ b/recipes-scanners/arpwatch/files/postfix_workaround.patch
@@ -0,0 +1,91 @@
1Sendmail exists after the system boots. We are using postfix
2so no need to check if it exists.
3
4Upstream-Status: Inappropriate [embedded specific]
5
6Signed-off-by: Armin Kuster <akuster808@gmail.com>
7
8Index: arpwatch-3.0/configure
9===================================================================
10--- arpwatch-3.0.orig/configure
11+++ arpwatch-3.0/configure
12@@ -636,7 +636,6 @@ LBL_LIBS
13 HAVE_FREEBSD_TRUE
14 HAVE_FREEBSD_FALSE
15 PYTHON
16-V_SENDMAIL
17 LIBOBJS
18 INSTALL_DATA
19 INSTALL_SCRIPT
20@@ -5573,53 +5572,6 @@ fi
21 done
22
23
24-# Extract the first word of "sendmail", so it can be a program name with args.
25-set dummy sendmail; ac_word=$2
26-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
27-$as_echo_n "checking for $ac_word... " >&6; }
28-if ${ac_cv_path_V_SENDMAIL+:} false; then :
29- $as_echo_n "(cached) " >&6
30-else
31- case $V_SENDMAIL in
32- [\\/]* | ?:[\\/]*)
33- ac_cv_path_V_SENDMAIL="$V_SENDMAIL" # Let the user override the test with a path.
34- ;;
35- *)
36- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
37-as_dummy="$PATH:/usr/sbin:/usr/lib:/usr/bin:/usr/ucblib:/usr/local/etc"
38-for as_dir in $as_dummy
39-do
40- IFS=$as_save_IFS
41- test -z "$as_dir" && as_dir=.
42- for ac_exec_ext in '' $ac_executable_extensions; do
43- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
44- ac_cv_path_V_SENDMAIL="$as_dir/$ac_word$ac_exec_ext"
45- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
46- break 2
47- fi
48-done
49- done
50-IFS=$as_save_IFS
51-
52- ;;
53-esac
54-fi
55-V_SENDMAIL=$ac_cv_path_V_SENDMAIL
56-if test -n "$V_SENDMAIL"; then
57- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $V_SENDMAIL" >&5
58-$as_echo "$V_SENDMAIL" >&6; }
59-else
60- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
61-$as_echo "no" >&6; }
62-fi
63-
64-
65-
66-if test -z "${V_SENDMAIL}" ; then
67- as_fn_error $? "Can't find sendmail" "$LINENO" 5
68-fi
69-
70-
71 python=${PYTHON:-python}
72 # Extract the first word of "${python}", so it can be a program name with args.
73 set dummy ${python}; ac_word=$2
74Index: arpwatch-3.0/configure.in
75===================================================================
76--- arpwatch-3.0.orig/configure.in
77+++ arpwatch-3.0/configure.in
78@@ -76,13 +76,6 @@ AC_LBL_UNION_WAIT
79 AC_CHECK_LIB(resolv, res_query)
80 AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
81
82-AC_PATH_PROG(V_SENDMAIL, sendmail,,
83- $PATH:/usr/sbin:/usr/lib:/usr/bin:/usr/ucblib:/usr/local/etc)
84-
85-if test -z "${V_SENDMAIL}" ; then
86- AC_MSG_ERROR([Can't find sendmail])
87-fi
88-
89 dnl AC_LBL_CHECK_TYPE(int32_t, int)
90 dnl AC_LBL_CHECK_TYPE(u_int32_t, u_int)
91