diff options
author | Armin Kuster <akuster808@gmail.com> | 2019-03-30 14:14:13 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2019-03-31 10:37:09 -0700 |
commit | 1460d9b86dfc8100cf6bd112ec01dfc0ce19da39 (patch) | |
tree | e75d67841f27dbd7370b7c5e8994c731f024e026 /recipes-ids/samhain | |
parent | 75e609f7b14b57b27143ec9e8d818fc5fab6d106 (diff) | |
download | meta-security-1460d9b86dfc8100cf6bd112ec01dfc0ce19da39.tar.gz |
reorg ids: move ids recipes to recipes-ids
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'recipes-ids/samhain')
23 files changed, 1268 insertions, 0 deletions
diff --git a/recipes-ids/samhain/files/run-ptest b/recipes-ids/samhain/files/run-ptest new file mode 100755 index 0000000..2a4a765 --- /dev/null +++ b/recipes-ids/samhain/files/run-ptest | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/bin/sh | ||
2 | current_dir=$(dirname $(readlink -f $0)) | ||
3 | $current_dir/cutest | ||
diff --git a/recipes-ids/samhain/files/samhain-add-LDFLAGS-variable-for-samhain_setpwd.patch b/recipes-ids/samhain/files/samhain-add-LDFLAGS-variable-for-samhain_setpwd.patch new file mode 100644 index 0000000..088a938 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-add-LDFLAGS-variable-for-samhain_setpwd.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From ae79606a6745dbbd429d1d4671dfe3045d735057 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jackie Huang <jackie.huang@windriver.com> | ||
3 | Date: Thu, 14 Sep 2017 13:26:55 +0800 | ||
4 | Subject: [PATCH] Add LDFLAGS variable for compiling samhain_setpwd | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
9 | --- | ||
10 | Makefile.in | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/Makefile.in b/Makefile.in | ||
14 | index 01de987..49356cf 100644 | ||
15 | --- a/Makefile.in | ||
16 | +++ b/Makefile.in | ||
17 | @@ -1128,7 +1128,7 @@ sh_tiger_i.o: $(srcsrc)/$(TIGER_SRC) Makefile config_xor.h | ||
18 | samhain_setpwd: encode config_xor.h $(srcsrc)/samhain_setpwd.c | ||
19 | @echo '$(COMPILE) -o samhain_setpwd $(srcsrc)/samhain_setpwd.c'; \ | ||
20 | ./encode $(XOR_CODE) $(srcsrc)/samhain_setpwd.c; \ | ||
21 | - $(COMPILE) -o samhain_setpwd x_samhain_setpwd.c; \ | ||
22 | + $(COMPILE) $(LDFLAGS) -o samhain_setpwd x_samhain_setpwd.c; \ | ||
23 | rm x_samhain_setpwd.c | ||
24 | |||
25 | samhain_stealth: encode config_xor.h $(srcsrc)/samhain_stealth.c | ||
26 | -- | ||
27 | 2.11.0 | ||
28 | |||
diff --git a/recipes-ids/samhain/files/samhain-avoid-searching-host-for-postgresql.patch b/recipes-ids/samhain/files/samhain-avoid-searching-host-for-postgresql.patch new file mode 100644 index 0000000..6bf67e0 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-avoid-searching-host-for-postgresql.patch | |||
@@ -0,0 +1,134 @@ | |||
1 | From 3e2ca7e06b16ceff6d12beb5113312f6525df595 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jackie Huang <jackie.huang@windriver.com> | ||
3 | Date: Thu, 14 Sep 2017 11:02:12 +0800 | ||
4 | Subject: [PATCH] configure.ac: avoid searching host for postgresql | ||
5 | |||
6 | Upstream-Status: Inappropriate [cross compile specific] | ||
7 | |||
8 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
9 | --- | ||
10 | configure.ac | 101 +++-------------------------------------------------------- | ||
11 | 1 file changed, 5 insertions(+), 96 deletions(-) | ||
12 | |||
13 | diff --git a/configure.ac b/configure.ac | ||
14 | index a224c68..f658d53 100644 | ||
15 | --- a/configure.ac | ||
16 | +++ b/configure.ac | ||
17 | @@ -1278,90 +1278,11 @@ AC_ARG_WITH(database, | ||
18 | AC_DEFINE(WITH_POSTGRES) | ||
19 | AC_DEFINE(WITH_DATABASE) | ||
20 | # | ||
21 | - PGCONF="no" | ||
22 | - MY_PATH="${PATH}:/usr/local/bin:/usr/local/pgsql/bin" | ||
23 | - OLD_IFS="$IFS" | ||
24 | - IFS=":" | ||
25 | - for ff in ${MY_PATH} | ||
26 | - do | ||
27 | - if test -f "$ff/pg_config" | ||
28 | - then | ||
29 | - PGCONF="$ff/pg_config" | ||
30 | - fi | ||
31 | - done | ||
32 | - IFS="${OLD_IFS}" | ||
33 | - # | ||
34 | - # | ||
35 | - if test "x${PGCONF}" = "xno" | ||
36 | - then | ||
37 | - AC_MSG_CHECKING(for PostgreSQL in /usr/local/pgsql /usr/pgsql /usr/local /usr PGSQL_HOME) | ||
38 | - pgsql_directory="/usr/local/pgsql /usr/pgsql /usr/local /usr ${PGSQL_HOME}" | ||
39 | - for i in $pgsql_directory; do | ||
40 | - if test -r $i/include/pgsql/libpq-fe.h; then | ||
41 | - PGSQL_INC_DIR=$i/include | ||
42 | - PGSQL_DIR=$i | ||
43 | - # use AC_CHECK_HEADERS to check for pgsql/libpq-fe.h | ||
44 | - fi | ||
45 | - done | ||
46 | - if test -z "$PGSQL_DIR"; then | ||
47 | - for i in $pgsql_directory; do | ||
48 | - if test -r $i/include/postgresql/libpq-fe.h; then | ||
49 | - PGSQL_INC_DIR=$i/include | ||
50 | - PGSQL_DIR=$i | ||
51 | - fi | ||
52 | - done | ||
53 | - fi | ||
54 | - if test -z "$PGSQL_DIR"; then | ||
55 | - for i in $pgsql_directory; do | ||
56 | - if test -r $i/include/libpq-fe.h; then | ||
57 | - PGSQL_INC_DIR=$i/include | ||
58 | - PGSQL_DIR=$i | ||
59 | - fi | ||
60 | - done | ||
61 | - fi | ||
62 | - | ||
63 | - if test -z "$PGSQL_DIR"; then | ||
64 | - tmp="" | ||
65 | - for i in $pgsql_directory; do | ||
66 | - tmp="$tmp $i/include $i/include/pgsql $i/include/postgresql" | ||
67 | - done | ||
68 | - FAIL_MESSAGE("PostgreSQL header file (libpq-fe.h)", $tmp) | ||
69 | - fi | ||
70 | - | ||
71 | - for i in lib lib/pgsql lib/postgresql; do | ||
72 | - str="$PGSQL_DIR/$i/libpq.*" | ||
73 | - for j in `echo $str`; do | ||
74 | - if test -r $j; then | ||
75 | - PGSQL_LIB_DIR="$PGSQL_DIR/$i" | ||
76 | - break 2 | ||
77 | - fi | ||
78 | - done | ||
79 | - done | ||
80 | - | ||
81 | - if test -z "$PGSQL_LIB_DIR"; then | ||
82 | - for ff in $pgsql_directory; do | ||
83 | - for i in lib lib/pgsql lib/postgresql; do | ||
84 | - str="$ff/$i/libpq.*" | ||
85 | - for j in `echo $str`; do | ||
86 | - if test -r $j; then | ||
87 | - PGSQL_LIB_DIR="$ff/$i" | ||
88 | - break 3 | ||
89 | - fi | ||
90 | - done | ||
91 | - done | ||
92 | - done | ||
93 | - fi | ||
94 | - | ||
95 | - if test -z "$PGSQL_LIB_DIR"; then | ||
96 | - tmp="" | ||
97 | - for i in $pgsql_directory; do | ||
98 | - tmp="$i/lib $i/lib/pgsql $i/lib/postgresql" | ||
99 | - done | ||
100 | - FAIL_MESSAGE("postgresql library libpq", $tmp) | ||
101 | - fi | ||
102 | - | ||
103 | - AC_MSG_RESULT(yes) | ||
104 | - | ||
105 | + if test -z "${PGSQL_LIB_DIR}" ; then | ||
106 | + FAIL_MESSAGE("PGSQL_LIB_DIR is not set!") | ||
107 | + elif test -z "${PGSQL_INC_DIR}" ; then | ||
108 | + FAIL_MESSAGE("PGSQL_INC_DIR is not set!") | ||
109 | + else | ||
110 | LIBS="$LIBS -L${PGSQL_LIB_DIR} -lpq -lm" | ||
111 | if test x"$enable_static" = xyes; then | ||
112 | LIBS="$LIBS -L${PGSQL_LIB_DIR} -lpq -lcrypt -lm" | ||
113 | @@ -1370,18 +1291,6 @@ AC_ARG_WITH(database, | ||
114 | fi | ||
115 | # CFLAGS="$CFLAGS -I${PGSQL_INC_DIR}" | ||
116 | CPPFLAGS="$CPPFLAGS -I${PGSQL_INC_DIR}" | ||
117 | - AC_CHECK_HEADERS(pgsql/libpq-fe.h) | ||
118 | - AC_CHECK_HEADERS(postgresql/libpq-fe.h) | ||
119 | - else | ||
120 | - pg_lib_dir=`${PGCONF} --libdir` | ||
121 | - if test x"$enable_static" = xyes; then | ||
122 | - LIBS="$LIBS -L${pg_lib_dir} -lpq -lcrypt -lm" | ||
123 | - else | ||
124 | - LIBS="$LIBS -L${pg_lib_dir} -lpq -lm" | ||
125 | - fi | ||
126 | - pg_inc_dir=`${PGCONF} --includedir` | ||
127 | - # CFLAGS="$CFLAGS -I${pg_inc_dir}" | ||
128 | - CPPFLAGS="$CPPFLAGS -I${pg_inc_dir}" | ||
129 | fi | ||
130 | elif test "x${withval}" = "xodbc"; then | ||
131 | AC_MSG_CHECKING(for odbc in /usr /usr/local ODBC_HOME) | ||
132 | -- | ||
133 | 2.11.0 | ||
134 | |||
diff --git a/recipes-ids/samhain/files/samhain-client.default b/recipes-ids/samhain/files/samhain-client.default new file mode 100644 index 0000000..9899577 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-client.default | |||
@@ -0,0 +1,3 @@ | |||
1 | # Set this to "yes" to start the server, after you configure it, of | ||
2 | # course. | ||
3 | SAMHAIN_CLIENT_START="no" \ No newline at end of file | ||
diff --git a/recipes-ids/samhain/files/samhain-client.init b/recipes-ids/samhain/files/samhain-client.init new file mode 100644 index 0000000..d5fabed --- /dev/null +++ b/recipes-ids/samhain/files/samhain-client.init | |||
@@ -0,0 +1,122 @@ | |||
1 | #!/bin/bash | ||
2 | # chkconfig: 2345 99 10 | ||
3 | # description: File Integrity Checking Daemon | ||
4 | # | ||
5 | # processname: samhain | ||
6 | # config : /etc/samhainrc | ||
7 | # logfile : /var/log/samhain_log | ||
8 | # database: /var/lib/samhain/samhain_file | ||
9 | # | ||
10 | |||
11 | NAME=samhain | ||
12 | DAEMON=/usr/sbin/samhain | ||
13 | RETVAL=0 | ||
14 | PIDFILE=/var/run/samhain.pid | ||
15 | |||
16 | . /etc/default/rcS | ||
17 | |||
18 | . /etc/default/samhain-client | ||
19 | |||
20 | if [ "x$SAMHAIN_CLIENT_START" != "xyes" ]; then | ||
21 | echo "${0}: client disabled in /etc/default/samhain-client" | ||
22 | exit 0 | ||
23 | fi | ||
24 | |||
25 | if [ -x $DAEMON ]; then | ||
26 | : | ||
27 | else | ||
28 | echo "${0}: executable ${DAEMON} not found" | ||
29 | exit 1 | ||
30 | fi | ||
31 | |||
32 | if [ ! -e /var/lib/samhain/samhain_file ]; then | ||
33 | echo "${0}: /var/lib/samhain/samhain_file does not exist. You must" | ||
34 | echo " run 'samhain -t init' before samhian-client can start." | ||
35 | exit 1 | ||
36 | fi | ||
37 | |||
38 | samhain_done() | ||
39 | { | ||
40 | if [ $RETVAL -eq 0 ]; then | ||
41 | echo "." | ||
42 | else | ||
43 | echo " failed." | ||
44 | fi | ||
45 | } | ||
46 | |||
47 | log_stat_msg () { | ||
48 | case "$1" in | ||
49 | 0) | ||
50 | echo "Service $NAME: Running"; | ||
51 | ;; | ||
52 | 1) | ||
53 | echo "Service $NAME: Stopped and /var/run pid file exists"; | ||
54 | ;; | ||
55 | 3) | ||
56 | echo "Service $NAME: Stopped"; | ||
57 | ;; | ||
58 | *) | ||
59 | echo "Service $NAME: Status unknown"; | ||
60 | ;; | ||
61 | esac | ||
62 | } | ||
63 | |||
64 | case "$1" in | ||
65 | start) | ||
66 | # | ||
67 | # Remove a stale PID file, if found | ||
68 | # | ||
69 | if test -f ${PIDFILE}; then | ||
70 | /bin/rm -f ${PIDFILE} | ||
71 | fi | ||
72 | # | ||
73 | echo -n "Starting ${NAME}" | ||
74 | start-stop-daemon --start --quiet --exec $DAEMON | ||
75 | RETVAL=$? | ||
76 | samhain_done | ||
77 | ;; | ||
78 | |||
79 | stop) | ||
80 | echo -n "Stopping $NAME" | ||
81 | start-stop-daemon --stop --quiet --exec $DAEMON | ||
82 | RETVAL=$? | ||
83 | |||
84 | # | ||
85 | # Remove a stale PID file, if found | ||
86 | # | ||
87 | if test -f ${PIDFILE}; then | ||
88 | /bin/rm -f ${PIDFILE} | ||
89 | fi | ||
90 | if test -S /var/run/${NAME}.sock; then | ||
91 | /bin/rm -f /var/run/${NAME}.sock | ||
92 | fi | ||
93 | samhain_done | ||
94 | ;; | ||
95 | |||
96 | restart) | ||
97 | $0 stop | ||
98 | sleep 3 | ||
99 | $0 start | ||
100 | RETVAL=$? | ||
101 | ;; | ||
102 | |||
103 | reload|force-reload) | ||
104 | echo -n "Reloading $NAME configuration files" | ||
105 | start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON | ||
106 | RETVAL=$? | ||
107 | samhain_done | ||
108 | ;; | ||
109 | |||
110 | status) | ||
111 | $DAEMON status | ||
112 | RETVAL=$? | ||
113 | log_stat_msg ${RETVAL} | ||
114 | ;; | ||
115 | |||
116 | *) | ||
117 | echo "$0 usage: {start|stop|status|restart|reload}" | ||
118 | exit 1 | ||
119 | ;; | ||
120 | esac | ||
121 | |||
122 | exit $RETVAL | ||
diff --git a/recipes-ids/samhain/files/samhain-configure-add-option-for-ps.patch b/recipes-ids/samhain/files/samhain-configure-add-option-for-ps.patch new file mode 100644 index 0000000..8de0735 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-configure-add-option-for-ps.patch | |||
@@ -0,0 +1,108 @@ | |||
1 | From 02a143f0068cbc6cea71359169210fbb3606d4bb Mon Sep 17 00:00:00 2001 | ||
2 | From: Jackie Huang <jackie.huang@windriver.com> | ||
3 | Date: Mon, 18 Jan 2016 00:24:57 -0500 | ||
4 | Subject: [PATCH] configure: add option for ps | ||
5 | |||
6 | The configure searches hardcoded host paths for PSPATH | ||
7 | and run ps commands to decide PSARG which will fail | ||
8 | on host without ps: | ||
9 | | configure: error: Cannot find ps in any of /usr/ucb /bin /usr/bin | ||
10 | |||
11 | So add an option so we can specify the ps at configure | ||
12 | to avoid host contamination. | ||
13 | |||
14 | Upstream-Status: Inappropriate [cross compile specific] | ||
15 | |||
16 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
17 | --- | ||
18 | aclocal.m4 | 2 +- | ||
19 | configure.ac | 60 ++++++++++-------------------------------------------------- | ||
20 | 2 files changed, 11 insertions(+), 51 deletions(-) | ||
21 | |||
22 | diff --git a/aclocal.m4 b/aclocal.m4 | ||
23 | index a2e59a6..cd20a2f 100644 | ||
24 | --- a/aclocal.m4 | ||
25 | +++ b/aclocal.m4 | ||
26 | @@ -409,7 +409,7 @@ x_includes=NONE | ||
27 | x_libraries=NONE | ||
28 | DESTDIR= | ||
29 | SH_ENABLE_OPTS="selinux posix-acl asm ssp db-reload xml-log message-queue login-watch process-check port-check mounts-check logfile-monitor userfiles debug ptrace static network udp nocl stealth micro-stealth install-name identity khide suidcheck base largefile mail external-scripts encrypt srp dnmalloc ipv6 shellexpand suid" | ||
30 | -SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver kcheck gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file" | ||
31 | +SH_WITH_OPTS="prelude libprelude-prefix database libwrap cflags libs console altconsole timeserver alttimeserver rnd egd-socket port logserver altlogserver kcheck gpg keyid checksum fp recipient sender trusted tmp-dir config-file log-file pid-file state-dir data-file html-file ps-path" | ||
32 | |||
33 | # Installation directory options. | ||
34 | # These are left unexpanded so users can "make install exec_prefix=/foo" | ||
35 | diff --git a/configure.ac b/configure.ac | ||
36 | index 5910b1f..8c3e087 100644 | ||
37 | --- a/configure.ac | ||
38 | +++ b/configure.ac | ||
39 | @@ -730,56 +730,16 @@ then | ||
40 | fi | ||
41 | AC_CHECK_HEADERS(gmp.h) | ||
42 | |||
43 | -AC_MSG_CHECKING([for ps]) | ||
44 | -PS= | ||
45 | -for ff in /usr/ucb /bin /usr/bin; do | ||
46 | - if test -x "$ff/ps"; then | ||
47 | - PS="$ff/ps" | ||
48 | - AC_MSG_RESULT([$PS]) | ||
49 | - break | ||
50 | - fi | ||
51 | -done | ||
52 | -if test x$PS = x | ||
53 | -then | ||
54 | - AC_MSG_RESULT([no]) | ||
55 | - AC_MSG_ERROR([Cannot find ps in any of /usr/ucb /bin /usr/bin]) | ||
56 | -fi | ||
57 | -AC_DEFINE_UNQUOTED([PSPATH], _("$PS"), [Path to ps]) | ||
58 | - | ||
59 | -AC_MSG_CHECKING([how to use ps]) | ||
60 | -$PS ax >/dev/null 2>&1 | ||
61 | -if test $? -eq 0; then | ||
62 | - case "$host_os" in | ||
63 | - *openbsd*) | ||
64 | - one=`$PS akx | wc -l` | ||
65 | - ;; | ||
66 | - *) | ||
67 | - one=`$PS ax | wc -l` | ||
68 | - ;; | ||
69 | - esac | ||
70 | -else | ||
71 | - one=0 | ||
72 | -fi | ||
73 | -$PS -e >/dev/null 2>&1 | ||
74 | -if test $? -eq 0; then | ||
75 | - two=`$PS -e | wc -l` | ||
76 | -else | ||
77 | - two=0 | ||
78 | -fi | ||
79 | -if test $one -ge $two | ||
80 | -then | ||
81 | - case "$host_os" in | ||
82 | - *openbsd*) | ||
83 | - PSARG="akx" | ||
84 | - ;; | ||
85 | - *) | ||
86 | - PSARG="ax" | ||
87 | - ;; | ||
88 | - esac | ||
89 | -else | ||
90 | - PSARG="-e" | ||
91 | -fi | ||
92 | -AC_DEFINE_UNQUOTED([PSARG], _("$PSARG"), [Argument for ps]) | ||
93 | +AC_ARG_WITH(ps-path, | ||
94 | + [ --with-ps-path=PATH set path to ps command ], | ||
95 | + [ | ||
96 | + if test "x${withval}" != xno; then | ||
97 | + pspath="${withval}" | ||
98 | + AC_DEFINE_UNQUOTED([PSPATH], _("${pspath}"), [Path to ps]) | ||
99 | + AC_DEFINE_UNQUOTED([PSARG], _("ax"), [Argument for ps]) | ||
100 | + fi | ||
101 | + ]) | ||
102 | + | ||
103 | AC_MSG_RESULT([$PS $PSARG]) | ||
104 | |||
105 | dnl ***************************************** | ||
106 | -- | ||
107 | 1.9.1 | ||
108 | |||
diff --git a/recipes-ids/samhain/files/samhain-cross-compile.patch b/recipes-ids/samhain/files/samhain-cross-compile.patch new file mode 100644 index 0000000..7f80a5c --- /dev/null +++ b/recipes-ids/samhain/files/samhain-cross-compile.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | From f63908427b2adb1792c59edbe38618e14ef5bc7b Mon Sep 17 00:00:00 2001 | ||
2 | From: Jackie Huang <jackie.huang@windriver.com> | ||
3 | Date: Fri, 15 Jan 2016 00:48:58 -0500 | ||
4 | Subject: [PATCH] Enable obfuscating binaries natively. | ||
5 | |||
6 | Enable obfuscating binaries natively. | ||
7 | |||
8 | The samhain build process involves an obfuscation step that attempts to | ||
9 | defeat decompilation or other binary analysis techniques which might reveal | ||
10 | secret information that should be known only to the system administrator. | ||
11 | The obfuscation step builds several applications which run on the build host | ||
12 | and then generate target code, which is then built into target binaries. | ||
13 | |||
14 | This patch creates a basic infrastructure that supports building the | ||
15 | obfuscation binaries natively then cross-compiling the target code by adding | ||
16 | a special configure option. In the absence of this option the old behaviour | ||
17 | is preserved. | ||
18 | |||
19 | Upstream-Status: Inappropriate [cross compile specific] | ||
20 | |||
21 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
22 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
23 | --- | ||
24 | Makefile.in | 4 +--- | ||
25 | 1 file changed, 1 insertion(+), 3 deletions(-) | ||
26 | |||
27 | diff --git a/Makefile.in b/Makefile.in | ||
28 | index 684e92b..fb090e2 100644 | ||
29 | --- a/Makefile.in | ||
30 | +++ b/Makefile.in | ||
31 | @@ -54,7 +54,7 @@ selectconfig = @selectconfig@ | ||
32 | top_builddir = . | ||
33 | |||
34 | INSTALL = @INSTALL@ | ||
35 | -INSTALL_PROGRAM = @INSTALL@ -s -m 700 | ||
36 | +INSTALL_PROGRAM = @INSTALL@ -m 700 | ||
37 | INSTALL_SHELL = @INSTALL@ -m 700 | ||
38 | INSTALL_DATA = @INSTALL@ -m 600 | ||
39 | INSTALL_MAN = @INSTALL@ -m 644 | ||
40 | @@ -525,8 +525,6 @@ install-program: $(PROGRAMS) sstrip | ||
41 | echo " $(INSTALL_PROGRAM) $$p $$target"; \ | ||
42 | $(INSTALL_PROGRAM) $$p $$target; \ | ||
43 | chmod 0700 $$target; \ | ||
44 | - echo " ./sstrip $$target"; \ | ||
45 | - ./sstrip $$target; \ | ||
46 | else \ | ||
47 | echo " $(INSTALL_SHELL) $$p $$target"; \ | ||
48 | $(INSTALL_SHELL) $$p $$target; \ | ||
49 | -- | ||
50 | 1.9.1 | ||
51 | |||
diff --git a/recipes-ids/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch b/recipes-ids/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch new file mode 100644 index 0000000..0608660 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-mips64-aarch64-dnmalloc-hash-fix.patch | |||
@@ -0,0 +1,44 @@ | |||
1 | commit 0f6bdc219e598de08a3f37887efa5dfa50e2b996 | ||
2 | Author: Aws Ismail <aws.ismail@windriver.com> | ||
3 | Date: Fri Jun 22 15:47:08 2012 -0400 | ||
4 | |||
5 | Hash fix for MIPS64 and AARCH64 | ||
6 | |||
7 | Samhain uses the addresses of local variables in generating hash | ||
8 | values. The hashing function is designed only for 32-bit values. | ||
9 | For MIPS64 when a 64-bit address is passed in the resulting hash | ||
10 | exceeds the limits of the underlying mechanism and samhain | ||
11 | ultimately fails. The solution is to simply take the lower | ||
12 | 32-bits of the address and use that in generating hash values. | ||
13 | |||
14 | Signed-off-by: Greg Moffatt <greg.moffatt@windriver.com> | ||
15 | |||
16 | Upstream-Status: Pending | ||
17 | |||
18 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
19 | Signed-off-by: Jackie Huang <jackie.huang@windriver.com> | ||
20 | |||
21 | diff --git a/src/dnmalloc.c b/src/dnmalloc.c | ||
22 | index da9a5c5..fc91400 100644 | ||
23 | --- a/src/dnmalloc.c | ||
24 | +++ b/src/dnmalloc.c | ||
25 | @@ -2703,11 +2703,19 @@ static void freecilst_add(chunkinfoptr p) { | ||
26 | } | ||
27 | |||
28 | /* Calculate the hash table entry for a chunk */ | ||
29 | +#if defined(CONFIG_ARCH_MIPS64) || defined(CONFIG_ARCH_AARCH64) | ||
30 | +#ifdef STARTHEAP_IS_ZERO | ||
31 | +#define hash(p) ((((unsigned long) p) & 0x7fffffff) >> 7) | ||
32 | +#else | ||
33 | +#define hash(p) ((((unsigned long) p - (unsigned long) startheap) & 0x7fffffff) >> 7) | ||
34 | +#endif | ||
35 | +#else | ||
36 | #ifdef STARTHEAP_IS_ZERO | ||
37 | #define hash(p) (((unsigned long) p) >> 7) | ||
38 | #else | ||
39 | #define hash(p) (((unsigned long) p - (unsigned long) startheap) >> 7) | ||
40 | #endif | ||
41 | +#endif /* CONFIG_ARCH_MIPS64 */ | ||
42 | |||
43 | static void | ||
44 | hashtable_add (chunkinfoptr ci) | ||
diff --git a/recipes-ids/samhain/files/samhain-not-run-ptest-on-host.patch b/recipes-ids/samhain/files/samhain-not-run-ptest-on-host.patch new file mode 100644 index 0000000..5284313 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-not-run-ptest-on-host.patch | |||
@@ -0,0 +1,24 @@ | |||
1 | not run test on host, since we are doing cross-compile | ||
2 | |||
3 | Upstream-status: Inappropriate [cross compile specific] | ||
4 | |||
5 | Signed-off-by: Roy Li <rongqing.li@windriver.com> | ||
6 | --- | ||
7 | Makefile.in | 1 - | ||
8 | 1 file changed, 1 deletion(-) | ||
9 | |||
10 | diff --git a/Makefile.in b/Makefile.in | ||
11 | index e1b32a8..74bfdc9 100644 | ||
12 | --- a/Makefile.in | ||
13 | +++ b/Makefile.in | ||
14 | @@ -1234,7 +1234,6 @@ intcutest: internal.h $(OBJECTS) $(CUTEST_OBJECTS) sh_tiger_i.o $(srcsrc)/CuTest | ||
15 | rm x_samhain.c; \ | ||
16 | $(LINK) sh_tiger_i.o $(CUTEST_OBJECTS) CuTestMain.o CuTest.o $(OBJECTS) $(LIBS_TRY); \ | ||
17 | test -f ./intcutest && mv ./intcutest ./cutest; \ | ||
18 | - ./cutest | ||
19 | |||
20 | runcutest: | ||
21 | gdb ./cutest | ||
22 | -- | ||
23 | 1.7.10.4 | ||
24 | |||
diff --git a/recipes-ids/samhain/files/samhain-pid-path.patch b/recipes-ids/samhain/files/samhain-pid-path.patch new file mode 100644 index 0000000..592bd16 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-pid-path.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | commit a932b03b65edeb02ccad2fce06bfa68a8f2fbb04 | ||
2 | Author: Aws Ismail <aws.ismail@windriver.com> | ||
3 | Date: Thu Jan 10 16:29:05 2013 -0500 | ||
4 | |||
5 | Set the PID Lock path for samhain.pid | ||
6 | |||
7 | The explicit path for samhain.pid inorder | ||
8 | for samhain to work properly after it initial | ||
9 | database build. | ||
10 | |||
11 | Upstream-Status: Inappropriate [configuration] | ||
12 | |||
13 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
14 | |||
15 | diff --git a/samhainrc.linux b/samhainrc.linux | ||
16 | index 10a8176..a7b06e6 100644 | ||
17 | --- a/samhainrc.linux | ||
18 | +++ b/samhainrc.linux | ||
19 | @@ -639,7 +639,7 @@ SetFileCheckTime = 86400 | ||
20 | |||
21 | ## Path to the PID file | ||
22 | # | ||
23 | -# SetLockfilePath = (default: compiled-in) | ||
24 | +SetLockfilePath = /run/samhain.pid | ||
25 | |||
26 | |||
27 | ## The digest/checksum/hash algorithm | ||
diff --git a/recipes-ids/samhain/files/samhain-samhainrc-fix-files-dirs-path.patch b/recipes-ids/samhain/files/samhain-samhainrc-fix-files-dirs-path.patch new file mode 100644 index 0000000..dad6b15 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-samhainrc-fix-files-dirs-path.patch | |||
@@ -0,0 +1,61 @@ | |||
1 | From 00fb527e45da42550156197647e01de9a6b1ad52 Mon Sep 17 00:00:00 2001 | ||
2 | From: Wenzong Fan <wenzong.fan@windriver.com> | ||
3 | Date: Mon, 3 Mar 2014 01:50:01 -0500 | ||
4 | Subject: [PATCH] fix real path for some files/dirs | ||
5 | |||
6 | Upstream-Status: Inappropriate [configuration] | ||
7 | |||
8 | Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com> | ||
9 | --- | ||
10 | samhainrc.linux | 15 +++++++-------- | ||
11 | 1 file changed, 7 insertions(+), 8 deletions(-) | ||
12 | |||
13 | diff --git a/samhainrc.linux b/samhainrc.linux | ||
14 | index e9727b4..7775d83 100644 | ||
15 | --- a/samhainrc.linux | ||
16 | +++ b/samhainrc.linux | ||
17 | @@ -93,7 +93,6 @@ dir = 99/etc | ||
18 | ## | ||
19 | file = /etc/mtab | ||
20 | file = /etc/fstab | ||
21 | -file = /etc/adjtime | ||
22 | file = /etc/motd | ||
23 | file = /etc/lvm/lvm.conf | ||
24 | |||
25 | @@ -153,11 +152,11 @@ dir = 99/var | ||
26 | |||
27 | [IgnoreAll] | ||
28 | dir = -1/var/cache | ||
29 | -dir = -1/var/lock | ||
30 | -dir = -1/var/mail | ||
31 | -dir = -1/var/run | ||
32 | +dir = -1/run/lock | ||
33 | +dir = -1/var/spool/mail | ||
34 | +dir = -1/run | ||
35 | dir = -1/var/spool | ||
36 | -dir = -1/var/tmp | ||
37 | +dir = -1/var/volatile/tmp | ||
38 | |||
39 | |||
40 | [Attributes] | ||
41 | @@ -167,7 +166,7 @@ dir = -1/var/tmp | ||
42 | file = /var/lib/rpm/__db.00? | ||
43 | |||
44 | file = /var/lib/logrotate.status | ||
45 | -file = /var/lib/random-seed | ||
46 | +file = /var/lib/urandom/random-seed | ||
47 | |||
48 | |||
49 | [GrowingLogFiles] | ||
50 | @@ -176,7 +175,7 @@ file = /var/lib/random-seed | ||
51 | ## are ignored. Logfile rotation will cause a report because of shrinking | ||
52 | ## size and different inode. | ||
53 | ## | ||
54 | -dir = 99/var/log | ||
55 | +dir = 99/var/volatile/log | ||
56 | |||
57 | [Attributes] | ||
58 | # | ||
59 | -- | ||
60 | 1.7.9.5 | ||
61 | |||
diff --git a/recipes-ids/samhain/files/samhain-samhainrc.patch b/recipes-ids/samhain/files/samhain-samhainrc.patch new file mode 100644 index 0000000..145700a --- /dev/null +++ b/recipes-ids/samhain/files/samhain-samhainrc.patch | |||
@@ -0,0 +1,158 @@ | |||
1 | commit 4c6658441eb3ffc4e51ed70f78cbdab046957580 | ||
2 | Author: Aws Ismail <aws.ismail@windriver.com> | ||
3 | Date: Fri Jun 22 16:38:20 2012 -0400 | ||
4 | |||
5 | Make samhainrc OE-friendly. | ||
6 | |||
7 | Patch the samhainrc that will be installed | ||
8 | as part of the 'make install' step to more | ||
9 | accurately reflect what will be found, and | ||
10 | what will be of concern, on a OE install. | ||
11 | |||
12 | Upstream-Status: Inappropriate [configuration] | ||
13 | |||
14 | Signed-off-by: Aws Ismail <aws.ismail@windriver.com> | ||
15 | |||
16 | diff --git a/samhainrc.linux b/samhainrc.linux | ||
17 | index 9bc5ca4..10a8176 100644 | ||
18 | --- a/samhainrc.linux | ||
19 | +++ b/samhainrc.linux | ||
20 | @@ -74,7 +74,6 @@ dir = 0/ | ||
21 | [Attributes] | ||
22 | file = /tmp | ||
23 | file = /dev | ||
24 | -file = /media | ||
25 | file = /proc | ||
26 | file = /sys | ||
27 | |||
28 | @@ -93,19 +92,10 @@ dir = 99/etc | ||
29 | ## check permission and ownership | ||
30 | ## | ||
31 | file = /etc/mtab | ||
32 | +file = /etc/fstab | ||
33 | file = /etc/adjtime | ||
34 | file = /etc/motd | ||
35 | -file = /etc/lvm/.cache | ||
36 | - | ||
37 | -# On Ubuntu, these are in /var/lib rather than /etc | ||
38 | -file = /etc/cups/certs | ||
39 | -file = /etc/cups/certs/0 | ||
40 | - | ||
41 | -# managed by fstab-sync on Fedora Core | ||
42 | -file = /etc/fstab | ||
43 | - | ||
44 | -# modified when booting | ||
45 | -file = /etc/sysconfig/hwconf | ||
46 | +file = /etc/lvm/lvm.conf | ||
47 | |||
48 | # There are files in /etc that might change, thus changing the directory | ||
49 | # timestamps. Put it here as 'file', and in the ReadOnly section as 'dir'. | ||
50 | @@ -147,10 +137,6 @@ dir = 99/dev | ||
51 | ## | ||
52 | dir = -1/dev/pts | ||
53 | |||
54 | -# dir = -1/dev/.udevdb | ||
55 | - | ||
56 | -file = /dev/ppp | ||
57 | - | ||
58 | # | ||
59 | # --------- /usr ----------- | ||
60 | # | ||
61 | @@ -167,50 +153,21 @@ dir = 99/var | ||
62 | |||
63 | [IgnoreAll] | ||
64 | dir = -1/var/cache | ||
65 | -dir = -1/var/backups | ||
66 | -dir = -1/var/games | ||
67 | -dir = -1/var/gdm | ||
68 | dir = -1/var/lock | ||
69 | dir = -1/var/mail | ||
70 | dir = -1/var/run | ||
71 | dir = -1/var/spool | ||
72 | dir = -1/var/tmp | ||
73 | -dir = -1/var/lib/texmf | ||
74 | -dir = -1/var/lib/scrollkeeper | ||
75 | |||
76 | |||
77 | [Attributes] | ||
78 | |||
79 | -dir = /var/lib/nfs | ||
80 | -dir = /var/lib/pcmcia | ||
81 | - | ||
82 | # /var/lib/rpm changes if packets are installed; | ||
83 | # /var/lib/rpm/__db.00[123] even more frequently | ||
84 | file = /var/lib/rpm/__db.00? | ||
85 | |||
86 | -file = /var/lib/acpi-support/vbestate | ||
87 | -file = /var/lib/alsa/asound.state | ||
88 | -file = /var/lib/apt/lists/lock | ||
89 | -file = /var/lib/apt/lists/partial | ||
90 | -file = /var/lib/cups/certs | ||
91 | -file = /var/lib/cups/certs/0 | ||
92 | -file = /var/lib/dpkg/lock | ||
93 | -file = /var/lib/gdm | ||
94 | -file = /var/lib/gdm/.cookie | ||
95 | -file = /var/lib/gdm/.gdmfifo | ||
96 | -file = /var/lib/gdm/:0.Xauth | ||
97 | -file = /var/lib/gdm/:0.Xservers | ||
98 | -file = /var/lib/logrotate/status | ||
99 | -file = /var/lib/mysql | ||
100 | -file = /var/lib/mysql/ib_logfile0 | ||
101 | -file = /var/lib/mysql/ibdata1 | ||
102 | -file = /var/lib/slocate | ||
103 | -file = /var/lib/slocate/slocate.db | ||
104 | -file = /var/lib/slocate/slocate.db.tmp | ||
105 | -file = /var/lib/urandom | ||
106 | -file = /var/lib/urandom/random-seed | ||
107 | +file = /var/lib/logrotate.status | ||
108 | file = /var/lib/random-seed | ||
109 | -file = /var/lib/xkb | ||
110 | |||
111 | |||
112 | [GrowingLogFiles] | ||
113 | @@ -325,7 +282,7 @@ IgnoreMissing = /var/lib/slocate/slocate.db.tmp | ||
114 | |||
115 | ## Console | ||
116 | ## | ||
117 | -# PrintSeverity=info | ||
118 | +PrintSeverity=warn | ||
119 | |||
120 | ## Logfile | ||
121 | ## | ||
122 | @@ -333,7 +290,7 @@ IgnoreMissing = /var/lib/slocate/slocate.db.tmp | ||
123 | |||
124 | ## Syslog | ||
125 | ## | ||
126 | -# SyslogSeverity=none | ||
127 | +SyslogSeverity=info | ||
128 | |||
129 | ## Remote server (yule) | ||
130 | ## | ||
131 | @@ -556,7 +513,8 @@ ChecksumTest=check | ||
132 | ## and I/O limit (kilobytes per second; 0 == off) | ||
133 | ## to reduce load on host. | ||
134 | # | ||
135 | -# SetNiceLevel = 0 | ||
136 | +# By default we configure samhain to be nice with everything else on the system | ||
137 | +SetNiceLevel = 10 | ||
138 | # SetIOLimit = 0 | ||
139 | |||
140 | ## The version string to embed in file signature databases | ||
141 | @@ -565,13 +523,14 @@ ChecksumTest=check | ||
142 | |||
143 | ## Interval between time stamp messages | ||
144 | # | ||
145 | -# SetLoopTime = 60 | ||
146 | -SetLoopTime = 600 | ||
147 | +# Log a timestamp every hour | ||
148 | +SetLoopTime = 3600 | ||
149 | |||
150 | ## Interval between file checks | ||
151 | # | ||
152 | # SetFileCheckTime = 600 | ||
153 | -SetFileCheckTime = 7200 | ||
154 | +# One file system check per day | ||
155 | +SetFileCheckTime = 86400 | ||
156 | |||
157 | ## Alternative: crontab-like schedule | ||
158 | # | ||
diff --git a/recipes-ids/samhain/files/samhain-server-volatiles b/recipes-ids/samhain/files/samhain-server-volatiles new file mode 100644 index 0000000..6b80709 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-server-volatiles | |||
@@ -0,0 +1 @@ | |||
d daemon daemon 0775 /var/log/yule none | |||
diff --git a/recipes-ids/samhain/files/samhain-server.default b/recipes-ids/samhain/files/samhain-server.default new file mode 100644 index 0000000..bc3d67c --- /dev/null +++ b/recipes-ids/samhain/files/samhain-server.default | |||
@@ -0,0 +1,3 @@ | |||
1 | # Set this to "yes" to start the server, after you configure it, of | ||
2 | # course. | ||
3 | SAMHAIN_SERVER_START="no" \ No newline at end of file | ||
diff --git a/recipes-ids/samhain/files/samhain-server.init b/recipes-ids/samhain/files/samhain-server.init new file mode 100644 index 0000000..c456e51 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-server.init | |||
@@ -0,0 +1,116 @@ | |||
1 | #!/bin/bash | ||
2 | # chkconfig: 2345 98 11 | ||
3 | # description: File Integrity Checking Daemon | ||
4 | # | ||
5 | # processname: yule | ||
6 | # config : /etc/yulerc | ||
7 | # logfile : /var/log/yule/yule_log | ||
8 | # database: /var/lib/yule/yule_file | ||
9 | # | ||
10 | |||
11 | NAME=yule | ||
12 | DAEMON=/usr/sbin/yule | ||
13 | RETVAL=0 | ||
14 | PIDFILE=/var/run/yule.pid | ||
15 | |||
16 | . /etc/default/rcS | ||
17 | |||
18 | . /etc/default/samhain-server | ||
19 | |||
20 | if [ "x$SAMHAIN_SERVER_START" != "xyes" ]; then | ||
21 | echo "${0}: server disabled in /etc/default/samhain-server" | ||
22 | exit 0 | ||
23 | fi | ||
24 | |||
25 | if [ -x $DAEMON ]; then | ||
26 | : | ||
27 | else | ||
28 | echo "${0}: executable ${DAEMON} not found" | ||
29 | exit 1 | ||
30 | fi | ||
31 | |||
32 | samhain_done() | ||
33 | { | ||
34 | if [ $RETVAL -eq 0 ]; then | ||
35 | echo "." | ||
36 | else | ||
37 | echo " failed." | ||
38 | fi | ||
39 | } | ||
40 | |||
41 | log_stat_msg () { | ||
42 | case "$1" in | ||
43 | 0) | ||
44 | echo "Service $NAME: Running"; | ||
45 | ;; | ||
46 | 1) | ||
47 | echo "Service $NAME: Stopped and /var/run pid file exists"; | ||
48 | ;; | ||
49 | 3) | ||
50 | echo "Service $NAME: Stopped"; | ||
51 | ;; | ||
52 | *) | ||
53 | echo "Service $NAME: Status unknown"; | ||
54 | ;; | ||
55 | esac | ||
56 | } | ||
57 | |||
58 | case "$1" in | ||
59 | start) | ||
60 | # | ||
61 | # Remove a stale PID file, if found | ||
62 | # | ||
63 | if test -f ${PIDFILE}; then | ||
64 | /bin/rm -f ${PIDFILE} | ||
65 | fi | ||
66 | # | ||
67 | echo -n "Starting ${NAME}" | ||
68 | start-stop-daemon --start --quiet --exec $DAEMON | ||
69 | RETVAL=$? | ||
70 | samhain_done | ||
71 | ;; | ||
72 | |||
73 | stop) | ||
74 | echo -n "Stopping $NAME" | ||
75 | start-stop-daemon --stop --quiet --exec $DAEMON | ||
76 | RETVAL=$? | ||
77 | |||
78 | # | ||
79 | # Remove a stale PID file, if found | ||
80 | # | ||
81 | if test -f ${PIDFILE}; then | ||
82 | /bin/rm -f ${PIDFILE} | ||
83 | fi | ||
84 | if test -S /var/run/${NAME}.sock; then | ||
85 | /bin/rm -f /var/run/${NAME}.sock | ||
86 | fi | ||
87 | samhain_done | ||
88 | ;; | ||
89 | |||
90 | restart) | ||
91 | $0 stop | ||
92 | sleep 3 | ||
93 | $0 start | ||
94 | RETVAL=$? | ||
95 | ;; | ||
96 | |||
97 | reload|force-reload) | ||
98 | echo -n "Reloading $NAME configuration files" | ||
99 | start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON | ||
100 | RETVAL=$? | ||
101 | samhain_done | ||
102 | ;; | ||
103 | |||
104 | status) | ||
105 | $DAEMON status | ||
106 | RETVAL=$? | ||
107 | log_stat_msg ${RETVAL} | ||
108 | ;; | ||
109 | |||
110 | *) | ||
111 | echo "$0 usage: {start|stop|status|restart|reload}" | ||
112 | exit 1 | ||
113 | ;; | ||
114 | esac | ||
115 | |||
116 | exit $RETVAL | ||
diff --git a/recipes-ids/samhain/files/samhain-sha256-big-endian.patch b/recipes-ids/samhain/files/samhain-sha256-big-endian.patch new file mode 100644 index 0000000..3065c73 --- /dev/null +++ b/recipes-ids/samhain/files/samhain-sha256-big-endian.patch | |||
@@ -0,0 +1,22 @@ | |||
1 | samhain: fix sha256 for big-endian machines | ||
2 | |||
3 | After computing the digest, big-endian machines would | ||
4 | memset() the digest to the first byte of state instead | ||
5 | of using memcpy() to transfer it. | ||
6 | |||
7 | Upstream-Status: Pending | ||
8 | |||
9 | Signed-off-by: Joe Slater <jslater@windriver.com> | ||
10 | |||
11 | |||
12 | --- a/src/sh_checksum.c | ||
13 | +++ b/src/sh_checksum.c | ||
14 | @@ -468,7 +468,7 @@ void SHA256_Final(sha2_byte digest[], SH | ||
15 | } | ||
16 | } | ||
17 | #else | ||
18 | - memset(d, context->state, SHA256_DIGEST_LENGTH); | ||
19 | + memcpy(d, context->state, SHA256_DIGEST_LENGTH); | ||
20 | /* bcopy(context->state, d, SHA256_DIGEST_LENGTH); */ | ||
21 | #endif | ||
22 | } | ||
diff --git a/recipes-ids/samhain/files/samhain-standalone.default b/recipes-ids/samhain/files/samhain-standalone.default new file mode 100644 index 0000000..507a59f --- /dev/null +++ b/recipes-ids/samhain/files/samhain-standalone.default | |||
@@ -0,0 +1,3 @@ | |||
1 | # Set this to "yes" to start the server, after you configure it, of | ||
2 | # course. | ||
3 | SAMHAIN_STANDALONE_START="no" | ||
diff --git a/recipes-ids/samhain/files/samhain-standalone.init b/recipes-ids/samhain/files/samhain-standalone.init new file mode 100644 index 0000000..2f23bff --- /dev/null +++ b/recipes-ids/samhain/files/samhain-standalone.init | |||
@@ -0,0 +1,123 @@ | |||
1 | #!/bin/sh | ||
2 | # chkconfig: 2345 99 10 | ||
3 | # description: File Integrity Checking Daemon | ||
4 | # | ||
5 | # processname: samhain | ||
6 | # config : /etc/samhainrc | ||
7 | # logfile : /var/log/samhain_log | ||
8 | # database: /var/lib/samhain/samhain_file | ||
9 | # | ||
10 | |||
11 | NAME=samhain | ||
12 | DAEMON=/usr/sbin/samhain | ||
13 | RETVAL=0 | ||
14 | VERBOSE=yes | ||
15 | PIDFILE=/var/run/samhain.pid | ||
16 | |||
17 | . /etc/default/samhain-standalone | ||
18 | |||
19 | if [ "x$SAMHAIN_STANDALONE_START" != "xyes" ]; then | ||
20 | echo "${0}: samhain disabled in /etc/default/samhain-standalone" | ||
21 | exit 0 | ||
22 | fi | ||
23 | |||
24 | if [ -x $DAEMON ]; then | ||
25 | : | ||
26 | else | ||
27 | echo "${0}: executable ${DAEMON} not found" | ||
28 | exit 1 | ||
29 | fi | ||
30 | |||
31 | if [ ! -e /var/lib/samhain/samhain_file ]; then | ||
32 | echo "${0}: /var/lib/samhain/samhain_file does not exist. You must" | ||
33 | echo " run 'samhain -t init' before samhian can start." | ||
34 | exit 1 | ||
35 | fi | ||
36 | |||
37 | samhain_done() | ||
38 | { | ||
39 | if [ $RETVAL -eq 0 ]; then | ||
40 | echo "." | ||
41 | else | ||
42 | echo " failed." | ||
43 | fi | ||
44 | } | ||
45 | |||
46 | log_stat_msg () { | ||
47 | case "$1" in | ||
48 | 0) | ||
49 | echo "Service $NAME: Running"; | ||
50 | ;; | ||
51 | 1) | ||
52 | echo "Service $NAME: Stopped and /var/run pid file exists"; | ||
53 | ;; | ||
54 | 3) | ||
55 | echo "Service $NAME: Stopped"; | ||
56 | ;; | ||
57 | *) | ||
58 | echo "Service $NAME: Status unknown"; | ||
59 | ;; | ||
60 | esac | ||
61 | } | ||
62 | |||
63 | case "$1" in | ||
64 | start) | ||
65 | # | ||
66 | # Remove a stale PID file, if found | ||
67 | # | ||
68 | if test -f ${PIDFILE}; then | ||
69 | /bin/rm -f ${PIDFILE} | ||
70 | fi | ||
71 | |||
72 | echo -n "Starting ${NAME}" | ||
73 | start-stop-daemon --start --quiet --exec $DAEMON | ||
74 | RETVAL=$? | ||
75 | samhain_done | ||
76 | exit $RETVAL | ||
77 | ;; | ||
78 | stop) | ||
79 | echo -n "Stopping $NAME" | ||
80 | start-stop-daemon --stop --quiet --exec $DAEMON | ||
81 | RETVAL=$? | ||
82 | samhain_done | ||
83 | # | ||
84 | # Remove a stale PID file, if found | ||
85 | # | ||
86 | if test -f ${PIDFILE}; then | ||
87 | /bin/rm -f ${PIDFILE} | ||
88 | fi | ||
89 | if test -S /var/run/${NAME}.sock; then | ||
90 | /bin/rm -f /var/run/${NAME}.sock | ||
91 | fi | ||
92 | ;; | ||
93 | |||
94 | restart) | ||
95 | $0 stop | ||
96 | sleep 3 | ||
97 | $0 start | ||
98 | RETVAL=$? | ||
99 | ;; | ||
100 | |||
101 | reload|force-reload) | ||
102 | echo -n "Reloading $NAME configuration files" | ||
103 | start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON | ||
104 | RETVAL=$? | ||
105 | samhain_done | ||
106 | ;; | ||
107 | |||
108 | status) | ||
109 | if pidof -o %PPID $DAEMON > /dev/null; then | ||
110 | echo "Samhain running" | ||
111 | RETVAL=0 | ||
112 | else | ||
113 | echo "Samhain not running" | ||
114 | RETVAL=1 | ||
115 | fi | ||
116 | ;; | ||
117 | *) | ||
118 | echo "$0 usage: {start|stop|status|restart|reload}" | ||
119 | exit 1 | ||
120 | ;; | ||
121 | esac | ||
122 | |||
123 | exit $RETVAL | ||
diff --git a/recipes-ids/samhain/files/samhain.service b/recipes-ids/samhain/files/samhain.service new file mode 100644 index 0000000..e4f216a --- /dev/null +++ b/recipes-ids/samhain/files/samhain.service | |||
@@ -0,0 +1,12 @@ | |||
1 | [Unit] | ||
2 | Description=Samhain @MODE_NAME@ Daemon | ||
3 | After=syslog.target network.target | ||
4 | |||
5 | [Service] | ||
6 | Type=forking | ||
7 | RemainAfterExit=yes | ||
8 | ExecStart=@LIBDIR@/@SAMHAIN_HELPER@ start | ||
9 | ExecStop=@LIBDIR@/@SAMHAIN_HELPER@ stop | ||
10 | |||
11 | [Install] | ||
12 | WantedBy=multi-user.target | ||
diff --git a/recipes-ids/samhain/samhain-client_4.3.2.bb b/recipes-ids/samhain/samhain-client_4.3.2.bb new file mode 100644 index 0000000..812408e --- /dev/null +++ b/recipes-ids/samhain/samhain-client_4.3.2.bb | |||
@@ -0,0 +1,11 @@ | |||
1 | INITSCRIPT_PARAMS = "defaults 15 85" | ||
2 | |||
3 | require samhain.inc | ||
4 | |||
5 | # Let the default Logserver be 127.0.0.1 | ||
6 | EXTRA_OECONF += " \ | ||
7 | --with-logserver=${SAMHAIN_SERVER} \ | ||
8 | --with-port=${SAMHAIN_PORT} \ | ||
9 | " | ||
10 | |||
11 | RDEPENDS_${PN} = "acl zlib attr bash" | ||
diff --git a/recipes-ids/samhain/samhain-server_4.3.2.bb b/recipes-ids/samhain/samhain-server_4.3.2.bb new file mode 100644 index 0000000..9341d44 --- /dev/null +++ b/recipes-ids/samhain/samhain-server_4.3.2.bb | |||
@@ -0,0 +1,20 @@ | |||
1 | INITSCRIPT_PARAMS = "defaults 14 86" | ||
2 | |||
3 | require samhain.inc | ||
4 | |||
5 | DEPENDS = "gmp" | ||
6 | |||
7 | SRC_URI += "file://samhain-server-volatiles" | ||
8 | |||
9 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
10 | |||
11 | do_install_append() { | ||
12 | install -d ${D}${sysconfdir}/default/volatiles | ||
13 | install -m 0644 ${WORKDIR}/samhain-server-volatiles \ | ||
14 | ${D}${sysconfdir}/default/volatiles/samhain-server | ||
15 | |||
16 | install -m 700 samhain-install.sh init/samhain.startLinux \ | ||
17 | init/samhain.startLSB ${D}/var/lib/samhain | ||
18 | } | ||
19 | |||
20 | RDEPENDS_${PN} += "gmp bash perl" | ||
diff --git a/recipes-ids/samhain/samhain-standalone_4.3.2.bb b/recipes-ids/samhain/samhain-standalone_4.3.2.bb new file mode 100644 index 0000000..4fed9e9 --- /dev/null +++ b/recipes-ids/samhain/samhain-standalone_4.3.2.bb | |||
@@ -0,0 +1,31 @@ | |||
1 | require samhain.inc | ||
2 | |||
3 | SRC_URI += "file://samhain-not-run-ptest-on-host.patch \ | ||
4 | file://run-ptest \ | ||
5 | " | ||
6 | |||
7 | PROVIDES += "samhain" | ||
8 | |||
9 | SYSTEMD_SERVICE_${PN} = "samhain.service" | ||
10 | |||
11 | inherit ptest | ||
12 | |||
13 | do_compile() { | ||
14 | if [ "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'yes', 'no', d)}" = "yes" ]; then | ||
15 | oe_runmake cutest | ||
16 | rm -f ${S}*.o config_xor.h internal.h | ||
17 | fi | ||
18 | oe_runmake "$@" | ||
19 | } | ||
20 | |||
21 | do_install_append() { | ||
22 | ln -sf ${INITSCRIPT_NAME} ${D}${sysconfdir}/init.d/samhain | ||
23 | } | ||
24 | |||
25 | do_install_ptest() { | ||
26 | mkdir -p ${D}${PTEST_PATH} | ||
27 | install ${S}/cutest ${D}${PTEST_PATH} | ||
28 | } | ||
29 | |||
30 | RPROVIDES_${PN} += "samhain" | ||
31 | RCONFLICTS_${PN} = "samhain-client samhain-server" | ||
diff --git a/recipes-ids/samhain/samhain.inc b/recipes-ids/samhain/samhain.inc new file mode 100644 index 0000000..1b9af39 --- /dev/null +++ b/recipes-ids/samhain/samhain.inc | |||
@@ -0,0 +1,163 @@ | |||
1 | DESCRIPTION = "Provides file integrity checking and log file monitoring/analysis" | ||
2 | HOMEPAGE = "http://www.la-samhna.de/samhain/" | ||
3 | LICENSE = "GPLv2" | ||
4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=8ca43cbc842c2336e835926c2166c28b" | ||
5 | |||
6 | |||
7 | SRC_URI = "http://la-samhna.de/archive/samhain_signed-${PV}.tar.gz \ | ||
8 | file://samhain-cross-compile.patch \ | ||
9 | file://samhain-mips64-aarch64-dnmalloc-hash-fix.patch \ | ||
10 | file://samhain-samhainrc.patch \ | ||
11 | file://samhain-samhainrc-fix-files-dirs-path.patch \ | ||
12 | file://samhain-pid-path.patch \ | ||
13 | file://samhain-sha256-big-endian.patch \ | ||
14 | file://samhain-configure-add-option-for-ps.patch \ | ||
15 | file://samhain-avoid-searching-host-for-postgresql.patch \ | ||
16 | file://samhain-add-LDFLAGS-variable-for-samhain_setpwd.patch \ | ||
17 | file://${INITSCRIPT_NAME}.init \ | ||
18 | file://${INITSCRIPT_NAME}.default \ | ||
19 | file://samhain.service \ | ||
20 | " | ||
21 | |||
22 | SRC_URI[md5sum] = "eae4674164d7c78f5bb39c72b7029c8b" | ||
23 | SRC_URI[sha256sum] = "0582864ef56ab796031e8e611ed66c48adeb3a30ec34e1a8d0088572442035fc" | ||
24 | |||
25 | UPSTREAM_CHECK_URI = "https://www.la-samhna.de/samhain/archive.html" | ||
26 | UPSTREAM_CHECK_REGEX = "samhain_signed-(?P<pver>(\d+(\.\d+)+))\.tar" | ||
27 | |||
28 | S = "${WORKDIR}/samhain-${PV}" | ||
29 | |||
30 | inherit autotools-brokensep update-rc.d pkgconfig systemd | ||
31 | |||
32 | SAMHAIN_PORT ??= "49777" | ||
33 | SAMHAIN_SERVER ??= "NULL" | ||
34 | |||
35 | INITSCRIPT_NAME = "${BPN}" | ||
36 | INITSCRIPT_PARAMS ?= "defaults" | ||
37 | |||
38 | SYSTEMD_PACKAGES = "${PN}" | ||
39 | SYSTEMD_SERVICE_${PN} = "${INITSCRIPT_NAME}.service" | ||
40 | SYSTEMD_AUTO_ENABLE = "disable" | ||
41 | |||
42 | # mode mapping: | ||
43 | # BPN MODE_NAME SAMHAIN_MODE | ||
44 | # samhain-standalone standalone no | ||
45 | # samhain-client client client | ||
46 | # samhain-server server server | ||
47 | MODE_NAME = "${@d.getVar('BPN').split('-')[1]}" | ||
48 | SAMHAIN_MODE = "${@oe.utils.ifelse(d.getVar('MODE_NAME') == 'standalone', 'no', '${MODE_NAME}')}" | ||
49 | |||
50 | # supports mysql|postgresql|oracle|odbc but postgresql is the only one available | ||
51 | |||
52 | PACKAGECONFIG ??= "postgresql ps \ | ||
53 | ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \ | ||
54 | ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux audit', '', d)} \ | ||
55 | ${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \ | ||
56 | " | ||
57 | |||
58 | PACKAGECONFIG[postgresql] = "--with-database=postgresql --enable-xml-log PGSQL_INC_DIR=${STAGING_INCDIR} PGSQL_LIB_DIR=${STAGING_LIBDIR}, , postgresql" | ||
59 | PACKAGECONFIG[suidcheck] = "--enable-suidcheck, , " | ||
60 | PACKAGECONFIG[logwatch] = "--enable-login-watch, , " | ||
61 | PACKAGECONFIG[mounts] = "--enable-mounts-check, , " | ||
62 | PACKAGECONFIG[userfiles] = "--enable-userfiles, , " | ||
63 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," | ||
64 | PACKAGECONFIG[selinux] = "--enable-selinux, --disable-selinux, libselinux attr" | ||
65 | PACKAGECONFIG[acl] = " --enable-posix-acl , --disable-posix-acl, acl" | ||
66 | PACKAGECONFIG[audit] = "ac_cv_header_auparse_h=yes,ac_cv_header_auparse_h=no,audit" | ||
67 | PACKAGECONFIG[ps] = "--with-ps-path=${base_bindir}/ps,,,procps" | ||
68 | |||
69 | do_unpack_samhain() { | ||
70 | cd ${WORKDIR} | ||
71 | tar -xzvf samhain-${PV}.tar.gz | ||
72 | } | ||
73 | |||
74 | python do_unpack_append() { | ||
75 | bb.build.exec_func('do_unpack_samhain', d) | ||
76 | } | ||
77 | |||
78 | do_configure_prepend_arm() { | ||
79 | export sh_cv___va_copy=yes | ||
80 | } | ||
81 | |||
82 | do_configure_prepend_aarch64() { | ||
83 | export sh_cv___va_copy=yes | ||
84 | } | ||
85 | |||
86 | # If we use oe_runconf in do_configure() it will by default | ||
87 | # use the prefix --oldincludedir=/usr/include which is not | ||
88 | # recognized by Samhain's configure script and would invariably | ||
89 | # throw back the error "unrecognized option: --oldincludedir=/usr/include" | ||
90 | do_configure_prepend () { | ||
91 | cat << EOF > ${S}/config-site.${BP} | ||
92 | ssp_cv_lib=no | ||
93 | sh_cv_va_copy=yes | ||
94 | EOF | ||
95 | export CONFIG_SITE=${S}/config-site.${BP} | ||
96 | } | ||
97 | |||
98 | do_configure () { | ||
99 | autoconf -f | ||
100 | ./configure \ | ||
101 | --build=${BUILD_SYS} \ | ||
102 | --host=${HOST_SYS} \ | ||
103 | --target=${TARGET_SYS} \ | ||
104 | --prefix=${prefix} \ | ||
105 | --exec_prefix=${exec_prefix} \ | ||
106 | --bindir=${bindir} \ | ||
107 | --sbindir=${sbindir} \ | ||
108 | --libexecdir=${libexecdir} \ | ||
109 | --datadir=${datadir} \ | ||
110 | --sysconfdir=${sysconfdir} \ | ||
111 | --sharedstatedir=${sharedstatedir} \ | ||
112 | --localstatedir=${localstatedir} \ | ||
113 | --libdir=${libdir} \ | ||
114 | --includedir=${includedir} \ | ||
115 | --infodir=${infodir} \ | ||
116 | --mandir=${mandir} \ | ||
117 | --enable-network=${SAMHAIN_MODE} \ | ||
118 | --with-pid-file=${localstatedir}/run/samhain.pid \ | ||
119 | --with-data-file=${localstatedir}/lib/samhain/samhain_file \ | ||
120 | --disable-dnmalloc \ | ||
121 | ${EXTRA_OECONF} | ||
122 | } | ||
123 | |||
124 | do_compile_prepend_libc-musl () { | ||
125 | sed -i 's/^#define HAVE_MALLOC_H.*//' ${B}/config.h | ||
126 | } | ||
127 | |||
128 | # Install the init script, it's default file, and the extraneous | ||
129 | # documentation. | ||
130 | do_install_append () { | ||
131 | oe_runmake install DESTDIR='${D}' INSTALL=install-boot | ||
132 | |||
133 | install -D -m 755 ${WORKDIR}/${INITSCRIPT_NAME}.init \ | ||
134 | ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} | ||
135 | |||
136 | install -D -m 755 ${WORKDIR}/${INITSCRIPT_NAME}.default \ | ||
137 | ${D}${sysconfdir}/default/${INITSCRIPT_NAME} | ||
138 | |||
139 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
140 | if [ "${SAMHAIN_MODE}" = "no" ]; then | ||
141 | install -D -m 0644 ${WORKDIR}/samhain.service ${D}/${systemd_system_unitdir}/samhain.service | ||
142 | else | ||
143 | install -D -m 0644 ${WORKDIR}/samhain.service ${D}/${systemd_system_unitdir}/${BPN}.service | ||
144 | fi | ||
145 | install -D -m 0755 ${WORKDIR}/${BPN}.init ${D}/${libexecdir}/${BPN} | ||
146 | sed -i -e 's,@LIBDIR@,${libexecdir},' \ | ||
147 | -e 's,@SAMHAIN_HELPER@,${BPN},' \ | ||
148 | -e 's,@MODE_NAME@,${MODE_NAME},' \ | ||
149 | ${D}${systemd_system_unitdir}/samhain*.service | ||
150 | fi | ||
151 | |||
152 | install -d ${D}${docdir}/${BPN} | ||
153 | cp -r docs/* ${D}${docdir}/${BPN} | ||
154 | cp -r scripts ${D}${docdir}/${BPN} | ||
155 | install -d -m 755 ${D}${localstatedir}/samhain | ||
156 | |||
157 | # Prevent QA warnings about installed ${localstatedir}/run | ||
158 | if [ -d ${D}${localstatedir}/run ]; then | ||
159 | rmdir ${D}${localstatedir}/run | ||
160 | fi | ||
161 | } | ||
162 | |||
163 | FILES_${PN} += "${systemd_system_unitdir}" | ||