Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | SUMMARY = "The Suricata Engine is an Open Source Next Generation Intrusion Detection and Prevention Engine" |
| 2 | |
| 3 | require suricata.inc |
| 4 | |
| 5 | LIC_FILES_CHKSUM = "file://LICENSE;beginline=1;endline=2;md5=c70d8d3310941dcdfcd1e02800a1f548" |
| 6 | |
| 7 | SRC_URI += "file://emerging.rules.tar.gz;name=rules" |
| 8 | |
| 9 | SRC_URI += " \ |
| 10 | file://volatiles.03_suricata \ |
| 11 | file://suricata.yaml \ |
| 12 | file://suricata.service \ |
| 13 | file://run-ptest \ |
| 14 | " |
| 15 | |
| 16 | SRC_URI[rules.md5sum] = "205c5e5b54e489207ed892c03ad75b33" |
| 17 | SRC_URI[rules.sha256sum] = "4aa81011b246875a57181c6a0569ca887845e366904bcaf0043220f33bd69798" |
| 18 | |
| 19 | inherit autotools-brokensep pkgconfig python3-dir systemd ptest |
| 20 | |
| 21 | CFLAGS += "-D_DEFAULT_SOURCE" |
| 22 | |
| 23 | CACHED_CONFIGUREVARS = "ac_cv_header_htp_htp_h=yes ac_cv_lib_htp_htp_conn_create=yes \ |
| 24 | ac_cv_path_HAVE_WGET=no ac_cv_path_HAVE_CURL=no " |
| 25 | |
| 26 | EXTRA_OECONF += " --disable-debug \ |
| 27 | --enable-non-bundled-htp \ |
| 28 | --disable-gccmarch-native \ |
| 29 | --disable-suricata-update \ |
| 30 | " |
| 31 | |
| 32 | PACKAGECONFIG ??= "htp jansson file pcre yaml pcap cap-ng net nfnetlink nss nspr" |
| 33 | PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'unittests', '', d)}" |
| 34 | |
| 35 | PACKAGECONFIG[htp] = "--with-libhtp-includes=${STAGING_INCDIR} --with-libhtp-libraries=${STAGING_LIBDIR}, ,libhtp," |
| 36 | PACKAGECONFIG[pcre] = "--with-libpcre-includes=${STAGING_INCDIR} --with-libpcre-libraries=${STAGING_LIBDIR}, ,libpcre ," |
| 37 | PACKAGECONFIG[yaml] = "--with-libyaml-includes=${STAGING_INCDIR} --with-libyaml-libraries=${STAGING_LIBDIR}, ,libyaml ," |
| 38 | PACKAGECONFIG[pcap] = "--with-libpcap-includes=${STAGING_INCDIR} --with-libpcap-libraries=${STAGING_LIBDIR}, ,libpcap ," |
| 39 | PACKAGECONFIG[cap-ng] = "--with-libcap_ng-includes=${STAGING_INCDIR} --with-libcap_ng-libraries=${STAGING_LIBDIR}, ,libcap-ng , " |
| 40 | PACKAGECONFIG[net] = "--with-libnet-includes=${STAGING_INCDIR} --with-libnet-libraries=${STAGING_LIBDIR}, , libnet," |
| 41 | PACKAGECONFIG[nfnetlink] = "--with-libnfnetlink-includes=${STAGING_INCDIR} --with-libnfnetlink-libraries=${STAGING_LIBDIR}, ,libnfnetlink ," |
| 42 | PACKAGECONFIG[nfq] = "--enable-nfqueue, --disable-nfqueue,libnetfilter-queue," |
| 43 | |
| 44 | PACKAGECONFIG[jansson] = "--with-libjansson-includes=${STAGING_INCDIR} --with-libjansson-libraries=${STAGING_LIBDIR},,jansson, jansson" |
| 45 | PACKAGECONFIG[file] = ",,file, file" |
| 46 | PACKAGECONFIG[nss] = "--with-libnss-includes=${STAGING_INCDIR} --with-libnss-libraries=${STAGING_LIBDIR}, nss, nss," |
| 47 | PACKAGECONFIG[nspr] = "--with-libnspr-includes=${STAGING_INCDIR} --with-libnspr-libraries=${STAGING_LIBDIR}, nspr, nspr," |
| 48 | PACKAGECONFIG[python] = "--enable-python, --disable-python, python3, python3" |
| 49 | PACKAGECONFIG[unittests] = "--enable-unittests, --disable-unittests," |
| 50 | |
| 51 | export logdir = "${localstatedir}/log" |
| 52 | |
| 53 | do_install_append () { |
| 54 | |
| 55 | install -d ${D}${sysconfdir}/suricata |
| 56 | |
| 57 | oe_runmake install-conf DESTDIR=${D} |
| 58 | |
| 59 | # mimic move of downloaded rules to e_sysconfrulesdir |
| 60 | cp -rf ${WORKDIR}/rules ${D}${sysconfdir}/suricata |
| 61 | |
| 62 | oe_runmake install-rules DESTDIR=${D} |
| 63 | |
| 64 | install -d ${D}${sysconfdir}/suricata ${D}${sysconfdir}/default/volatiles |
| 65 | install -m 0644 ${WORKDIR}/volatiles.03_suricata ${D}${sysconfdir}/default/volatiles/volatiles.03_suricata |
| 66 | |
| 67 | install -m 0644 ${S}/threshold.config ${D}${sysconfdir}/suricata |
| 68 | |
| 69 | install -d ${D}${systemd_unitdir}/system |
| 70 | sed -e s:/etc:${sysconfdir}:g \ |
| 71 | -e s:/var/run:/run:g \ |
| 72 | -e s:/var:${localstatedir}:g \ |
| 73 | -e s:/usr/bin:${bindir}:g \ |
| 74 | -e s:/bin/kill:${base_bindir}/kill:g \ |
| 75 | -e s:/usr/lib:${libdir}:g \ |
| 76 | ${WORKDIR}/suricata.service > ${D}${systemd_unitdir}/system/suricata.service |
| 77 | |
| 78 | # Remove /var/run as it is created on startup |
| 79 | rm -rf ${D}${localstatedir}/run |
| 80 | |
| 81 | } |
| 82 | |
| 83 | pkg_postinst_ontarget_${PN} () { |
| 84 | if [ -e /etc/init.d/populate-volatile.sh ] ; then |
| 85 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 86 | fi |
| 87 | } |
| 88 | |
| 89 | SYSTEMD_PACKAGES = "${PN}" |
| 90 | |
| 91 | PACKAGES =+ "${PN}-socketcontrol" |
| 92 | FILES_${PN} += "${systemd_unitdir}" |
| 93 | FILES_${PN}-socketcontrol = "${bindir}/suricatasc ${PYTHON_SITEPACKAGES_DIR}" |
| 94 | |
| 95 | CONFFILES_${PN} = "${sysconfdir}/suricata/suricata.yaml" |
| 96 | |
| 97 | RDEPENDS_${PN}-python = "python" |