Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | DESCRIPTION = "Provides file integrity checking and log file monitoring/analysis" |
| 2 | HOMEPAGE = "http://www.la-samhna.de/samhain/" |
Patrick Williams | 03907ee | 2022-05-01 06:28:52 -0500 | [diff] [blame] | 3 | LICENSE = "GPL-2.0-only" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=8ca43cbc842c2336e835926c2166c28b" |
| 5 | |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 6 | PV = "4.4.10" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 7 | |
Andrew Geissler | f31b8bd | 2020-11-30 19:54:56 -0600 | [diff] [blame] | 8 | SRC_URI = "https://la-samhna.de/archive/samhain_signed-${PV}.tar.gz \ |
| 9 | file://${INITSCRIPT_NAME}.init \ |
| 10 | file://${INITSCRIPT_NAME}.default \ |
| 11 | file://samhain.service \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 12 | file://samhain-mips64-aarch64-dnmalloc-hash-fix.patch \ |
| 13 | file://samhain-samhainrc.patch \ |
| 14 | file://samhain-samhainrc-fix-files-dirs-path.patch \ |
| 15 | file://samhain-pid-path.patch \ |
| 16 | file://samhain-sha256-big-endian.patch \ |
| 17 | file://samhain-configure-add-option-for-ps.patch \ |
| 18 | file://samhain-avoid-searching-host-for-postgresql.patch \ |
| 19 | file://samhain-add-LDFLAGS-variable-for-samhain_setpwd.patch \ |
Andrew Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 20 | file://fix-build-with-new-version-attr.patch \ |
Andrew Geissler | 9d3cc05 | 2021-03-31 13:36:22 -0500 | [diff] [blame] | 21 | file://samhain-fix-initializer-element-is-not-constant.patch \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 22 | " |
| 23 | |
Patrick Williams | e760df8 | 2023-05-26 11:10:49 -0500 | [diff] [blame] | 24 | SRC_URI[sha256sum] = "ae6ee8eff3cb111b7fc14a57bcc258443dd0bcf1bfacfdf229935ed053c1ce3d" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 25 | |
| 26 | UPSTREAM_CHECK_URI = "https://www.la-samhna.de/samhain/archive.html" |
| 27 | UPSTREAM_CHECK_REGEX = "samhain_signed-(?P<pver>(\d+(\.\d+)+))\.tar" |
| 28 | |
| 29 | S = "${WORKDIR}/samhain-${PV}" |
| 30 | |
| 31 | inherit autotools-brokensep update-rc.d pkgconfig systemd |
| 32 | |
| 33 | SAMHAIN_PORT ??= "49777" |
| 34 | SAMHAIN_SERVER ??= "NULL" |
| 35 | |
| 36 | INITSCRIPT_NAME = "${BPN}" |
| 37 | INITSCRIPT_PARAMS ?= "defaults" |
| 38 | |
| 39 | SYSTEMD_PACKAGES = "${PN}" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 40 | SYSTEMD_SERVICE:${PN} = "${INITSCRIPT_NAME}.service" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 41 | SYSTEMD_AUTO_ENABLE = "disable" |
| 42 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 43 | # supports mysql|postgresql|oracle|odbc but postgresql is the only one available |
| 44 | |
| 45 | PACKAGECONFIG ??= "postgresql ps \ |
| 46 | ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \ |
| 47 | ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux audit', '', d)} \ |
| 48 | ${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \ |
| 49 | " |
| 50 | |
| 51 | PACKAGECONFIG[postgresql] = "--with-database=postgresql --enable-xml-log PGSQL_INC_DIR=${STAGING_INCDIR} PGSQL_LIB_DIR=${STAGING_LIBDIR}, , postgresql" |
| 52 | PACKAGECONFIG[suidcheck] = "--enable-suidcheck, , " |
| 53 | PACKAGECONFIG[logwatch] = "--enable-login-watch, , " |
| 54 | PACKAGECONFIG[mounts] = "--enable-mounts-check, , " |
| 55 | PACKAGECONFIG[userfiles] = "--enable-userfiles, , " |
| 56 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," |
| 57 | PACKAGECONFIG[selinux] = "--enable-selinux, --disable-selinux, libselinux attr" |
| 58 | PACKAGECONFIG[acl] = " --enable-posix-acl , --disable-posix-acl, acl" |
| 59 | PACKAGECONFIG[audit] = "ac_cv_header_auparse_h=yes,ac_cv_header_auparse_h=no,audit" |
| 60 | PACKAGECONFIG[ps] = "--with-ps-path=${base_bindir}/ps,,,procps" |
| 61 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 62 | EXTRA_OEMAKE:append:aarch64 = " CPPFLAGS+=-DCONFIG_ARCH_AARCH64=1" |
| 63 | EXTRA_OEMAKE:append:mips64 = " CPPFLAGS+=-DCONFIG_ARCH_MIPS64=1" |
Andrew Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 64 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 65 | do_unpack_samhain() { |
| 66 | cd ${WORKDIR} |
| 67 | tar -xzvf samhain-${PV}.tar.gz |
| 68 | } |
| 69 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 70 | python do_unpack:append() { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 71 | bb.build.exec_func('do_unpack_samhain', d) |
| 72 | } |
| 73 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 74 | do_configure:prepend:arm() { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 75 | export sh_cv___va_copy=yes |
| 76 | } |
| 77 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 78 | do_configure:prepend:aarch64() { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 79 | export sh_cv___va_copy=yes |
| 80 | } |
| 81 | |
| 82 | # If we use oe_runconf in do_configure() it will by default |
| 83 | # use the prefix --oldincludedir=/usr/include which is not |
| 84 | # recognized by Samhain's configure script and would invariably |
| 85 | # throw back the error "unrecognized option: --oldincludedir=/usr/include" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 86 | do_configure:prepend () { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 87 | cat << EOF > ${S}/config-site.${BP} |
| 88 | ssp_cv_lib=no |
| 89 | sh_cv_va_copy=yes |
| 90 | EOF |
| 91 | export CONFIG_SITE=${S}/config-site.${BP} |
| 92 | } |
| 93 | |
| 94 | do_configure () { |
| 95 | autoconf -f |
| 96 | ./configure \ |
| 97 | --build=${BUILD_SYS} \ |
| 98 | --host=${HOST_SYS} \ |
| 99 | --target=${TARGET_SYS} \ |
| 100 | --prefix=${prefix} \ |
| 101 | --exec_prefix=${exec_prefix} \ |
| 102 | --bindir=${bindir} \ |
| 103 | --sbindir=${sbindir} \ |
| 104 | --libexecdir=${libexecdir} \ |
| 105 | --datadir=${datadir} \ |
| 106 | --sysconfdir=${sysconfdir} \ |
| 107 | --sharedstatedir=${sharedstatedir} \ |
| 108 | --localstatedir=${localstatedir} \ |
| 109 | --libdir=${libdir} \ |
| 110 | --includedir=${includedir} \ |
| 111 | --infodir=${infodir} \ |
| 112 | --mandir=${mandir} \ |
| 113 | --enable-network=${SAMHAIN_MODE} \ |
| 114 | --with-pid-file=${localstatedir}/run/samhain.pid \ |
| 115 | --with-data-file=${localstatedir}/lib/samhain/samhain_file \ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 116 | ${EXTRA_OECONF} |
| 117 | } |
| 118 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 119 | do_compile:prepend:libc-musl () { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 120 | sed -i 's/^#define HAVE_MALLOC_H.*//' ${B}/config.h |
| 121 | } |
| 122 | |
| 123 | # Install the init script, it's default file, and the extraneous |
| 124 | # documentation. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 125 | do_install:append () { |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 126 | oe_runmake install DESTDIR='${D}' INSTALL=install-boot |
| 127 | |
| 128 | install -D -m 755 ${WORKDIR}/${INITSCRIPT_NAME}.init \ |
| 129 | ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} |
| 130 | |
| 131 | install -D -m 755 ${WORKDIR}/${INITSCRIPT_NAME}.default \ |
| 132 | ${D}${sysconfdir}/default/${INITSCRIPT_NAME} |
| 133 | |
| 134 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
| 135 | if [ "${SAMHAIN_MODE}" = "no" ]; then |
| 136 | install -D -m 0644 ${WORKDIR}/samhain.service ${D}/${systemd_system_unitdir}/samhain.service |
| 137 | else |
| 138 | install -D -m 0644 ${WORKDIR}/samhain.service ${D}/${systemd_system_unitdir}/${BPN}.service |
| 139 | fi |
| 140 | install -D -m 0755 ${WORKDIR}/${BPN}.init ${D}/${libexecdir}/${BPN} |
| 141 | sed -i -e 's,@LIBDIR@,${libexecdir},' \ |
| 142 | -e 's,@SAMHAIN_HELPER@,${BPN},' \ |
| 143 | -e 's,@MODE_NAME@,${MODE_NAME},' \ |
| 144 | ${D}${systemd_system_unitdir}/samhain*.service |
| 145 | fi |
| 146 | |
| 147 | install -d ${D}${docdir}/${BPN} |
| 148 | cp -r docs/* ${D}${docdir}/${BPN} |
| 149 | cp -r scripts ${D}${docdir}/${BPN} |
| 150 | install -d -m 755 ${D}${localstatedir}/samhain |
| 151 | |
| 152 | # Prevent QA warnings about installed ${localstatedir}/run |
| 153 | if [ -d ${D}${localstatedir}/run ]; then |
| 154 | rmdir ${D}${localstatedir}/run |
| 155 | fi |
Andrew Geissler | 1fe918a | 2020-05-15 14:16:47 -0500 | [diff] [blame] | 156 | |
| 157 | rm -rf ${D}${localstatedir}/log |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 158 | } |
| 159 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 160 | FILES:${PN} += "${systemd_system_unitdir}" |