1DESCRIPTION = "Provides file integrity checking and log file monitoring/analysis" 2HOMEPAGE = "http://www.la-samhna.de/samhain/" 3LICENSE = "GPLv2" 4LIC_FILES_CHKSUM = "file://LICENSE;md5=8ca43cbc842c2336e835926c2166c28b" 5 6PV = "4.3.3" 7 8SRC_URI = "http://la-samhna.de/archive/samhain_signed-${PV}.tar.gz \ 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://fix-build-with-new-version-attr.patch \ 18 file://${INITSCRIPT_NAME}.init \ 19 file://${INITSCRIPT_NAME}.default \ 20 file://samhain.service \ 21 " 22 23SRC_URI[md5sum] = "7be46ae7d03f53ba21afafd41cff8926" 24SRC_URI[sha256sum] = "33ad4bc3dad4699694553bd9635a6b5827939f965d1f0f05fce0b4e9cdadf21b" 25 26UPSTREAM_CHECK_URI = "https://www.la-samhna.de/samhain/archive.html" 27UPSTREAM_CHECK_REGEX = "samhain_signed-(?P<pver>(\d+(\.\d+)+))\.tar" 28 29S = "${WORKDIR}/samhain-${PV}" 30 31inherit autotools-brokensep update-rc.d pkgconfig systemd 32 33SAMHAIN_PORT ??= "49777" 34SAMHAIN_SERVER ??= "NULL" 35 36INITSCRIPT_NAME = "${BPN}" 37INITSCRIPT_PARAMS ?= "defaults" 38 39SYSTEMD_PACKAGES = "${PN}" 40SYSTEMD_SERVICE_${PN} = "${INITSCRIPT_NAME}.service" 41SYSTEMD_AUTO_ENABLE = "disable" 42 43# mode mapping: 44# BPN MODE_NAME SAMHAIN_MODE 45# samhain-standalone standalone no 46# samhain-client client client 47# samhain-server server server 48MODE_NAME = "${@d.getVar('BPN').split('-')[1]}" 49SAMHAIN_MODE = "${@oe.utils.ifelse(d.getVar('MODE_NAME') == 'standalone', 'no', '${MODE_NAME}')}" 50 51# supports mysql|postgresql|oracle|odbc but postgresql is the only one available 52 53PACKAGECONFIG ??= "postgresql ps \ 54 ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \ 55 ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux audit', '', d)} \ 56 ${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \ 57" 58 59PACKAGECONFIG[postgresql] = "--with-database=postgresql --enable-xml-log PGSQL_INC_DIR=${STAGING_INCDIR} PGSQL_LIB_DIR=${STAGING_LIBDIR}, , postgresql" 60PACKAGECONFIG[suidcheck] = "--enable-suidcheck, , " 61PACKAGECONFIG[logwatch] = "--enable-login-watch, , " 62PACKAGECONFIG[mounts] = "--enable-mounts-check, , " 63PACKAGECONFIG[userfiles] = "--enable-userfiles, , " 64PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," 65PACKAGECONFIG[selinux] = "--enable-selinux, --disable-selinux, libselinux attr" 66PACKAGECONFIG[acl] = " --enable-posix-acl , --disable-posix-acl, acl" 67PACKAGECONFIG[audit] = "ac_cv_header_auparse_h=yes,ac_cv_header_auparse_h=no,audit" 68PACKAGECONFIG[ps] = "--with-ps-path=${base_bindir}/ps,,,procps" 69 70EXTRA_OEMAKE_append_aarch64 = " CPPFLAGS+=-DCONFIG_ARCH_AARCH64=1" 71EXTRA_OEMAKE_append_mips64 = " CPPFLAGS+=-DCONFIG_ARCH_MIPS64=1" 72 73do_unpack_samhain() { 74 cd ${WORKDIR} 75 tar -xzvf samhain-${PV}.tar.gz 76} 77 78python do_unpack_append() { 79 bb.build.exec_func('do_unpack_samhain', d) 80} 81 82do_configure_prepend_arm() { 83 export sh_cv___va_copy=yes 84} 85 86do_configure_prepend_aarch64() { 87 export sh_cv___va_copy=yes 88} 89 90# If we use oe_runconf in do_configure() it will by default 91# use the prefix --oldincludedir=/usr/include which is not 92# recognized by Samhain's configure script and would invariably 93# throw back the error "unrecognized option: --oldincludedir=/usr/include" 94do_configure_prepend () { 95 cat << EOF > ${S}/config-site.${BP} 96ssp_cv_lib=no 97sh_cv_va_copy=yes 98EOF 99 export CONFIG_SITE=${S}/config-site.${BP} 100} 101 102do_configure () { 103 autoconf -f 104 ./configure \ 105 --build=${BUILD_SYS} \ 106 --host=${HOST_SYS} \ 107 --target=${TARGET_SYS} \ 108 --prefix=${prefix} \ 109 --exec_prefix=${exec_prefix} \ 110 --bindir=${bindir} \ 111 --sbindir=${sbindir} \ 112 --libexecdir=${libexecdir} \ 113 --datadir=${datadir} \ 114 --sysconfdir=${sysconfdir} \ 115 --sharedstatedir=${sharedstatedir} \ 116 --localstatedir=${localstatedir} \ 117 --libdir=${libdir} \ 118 --includedir=${includedir} \ 119 --infodir=${infodir} \ 120 --mandir=${mandir} \ 121 --enable-network=${SAMHAIN_MODE} \ 122 --with-pid-file=${localstatedir}/run/samhain.pid \ 123 --with-data-file=${localstatedir}/lib/samhain/samhain_file \ 124 ${EXTRA_OECONF} 125} 126 127do_compile_prepend_libc-musl () { 128 sed -i 's/^#define HAVE_MALLOC_H.*//' ${B}/config.h 129} 130 131# Install the init script, it's default file, and the extraneous 132# documentation. 133do_install_append () { 134 oe_runmake install DESTDIR='${D}' INSTALL=install-boot 135 136 install -D -m 755 ${WORKDIR}/${INITSCRIPT_NAME}.init \ 137 ${D}${sysconfdir}/init.d/${INITSCRIPT_NAME} 138 139 install -D -m 755 ${WORKDIR}/${INITSCRIPT_NAME}.default \ 140 ${D}${sysconfdir}/default/${INITSCRIPT_NAME} 141 142 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then 143 if [ "${SAMHAIN_MODE}" = "no" ]; then 144 install -D -m 0644 ${WORKDIR}/samhain.service ${D}/${systemd_system_unitdir}/samhain.service 145 else 146 install -D -m 0644 ${WORKDIR}/samhain.service ${D}/${systemd_system_unitdir}/${BPN}.service 147 fi 148 install -D -m 0755 ${WORKDIR}/${BPN}.init ${D}/${libexecdir}/${BPN} 149 sed -i -e 's,@LIBDIR@,${libexecdir},' \ 150 -e 's,@SAMHAIN_HELPER@,${BPN},' \ 151 -e 's,@MODE_NAME@,${MODE_NAME},' \ 152 ${D}${systemd_system_unitdir}/samhain*.service 153 fi 154 155 install -d ${D}${docdir}/${BPN} 156 cp -r docs/* ${D}${docdir}/${BPN} 157 cp -r scripts ${D}${docdir}/${BPN} 158 install -d -m 755 ${D}${localstatedir}/samhain 159 160 # Prevent QA warnings about installed ${localstatedir}/run 161 if [ -d ${D}${localstatedir}/run ]; then 162 rmdir ${D}${localstatedir}/run 163 fi 164 165 rm -rf ${D}${localstatedir}/log 166} 167 168FILES_${PN} += "${systemd_system_unitdir}" 169