Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [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 python-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 | " |
| 30 | |
| 31 | PACKAGECONFIG ??= "htp jansson file pcre yaml pcap cap-ng net nfnetlink nss nspr" |
| 32 | PACKAGECONFIG_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'unittests', '', d)}" |
| 33 | |
| 34 | PACKAGECONFIG[htp] = "--with-libhtp-includes=${STAGING_INCDIR} --with-libhtp-libraries=${STAGING_LIBDIR}, ,libhtp," |
| 35 | PACKAGECONFIG[pcre] = "--with-libpcre-includes=${STAGING_INCDIR} --with-libpcre-libraries=${STAGING_LIBDIR}, ,libpcre ," |
| 36 | PACKAGECONFIG[yaml] = "--with-libyaml-includes=${STAGING_INCDIR} --with-libyaml-libraries=${STAGING_LIBDIR}, ,libyaml ," |
| 37 | PACKAGECONFIG[pcap] = "--with-libpcap-includes=${STAGING_INCDIR} --with-libpcap-libraries=${STAGING_LIBDIR}, ,libpcap ," |
| 38 | PACKAGECONFIG[cap-ng] = "--with-libcap_ng-includes=${STAGING_INCDIR} --with-libcap_ng-libraries=${STAGING_LIBDIR}, ,libcap-ng , " |
| 39 | PACKAGECONFIG[net] = "--with-libnet-includes=${STAGING_INCDIR} --with-libnet-libraries=${STAGING_LIBDIR}, , libnet," |
| 40 | PACKAGECONFIG[nfnetlink] = "--with-libnfnetlink-includes=${STAGING_INCDIR} --with-libnfnetlink-libraries=${STAGING_LIBDIR}, ,libnfnetlink ," |
| 41 | PACKAGECONFIG[nfq] = "--enable-nfqueue, --disable-nfqueue,libnetfilter-queue," |
| 42 | |
| 43 | PACKAGECONFIG[jansson] = "--with-libjansson-includes=${STAGING_INCDIR} --with-libjansson-libraries=${STAGING_LIBDIR},,jansson, jansson" |
| 44 | PACKAGECONFIG[file] = ",,file, file" |
| 45 | PACKAGECONFIG[nss] = "--with-libnss-includes=${STAGING_INCDIR} --with-libnss-libraries=${STAGING_LIBDIR}, nss, nss," |
| 46 | PACKAGECONFIG[nspr] = "--with-libnspr-includes=${STAGING_INCDIR} --with-libnspr-libraries=${STAGING_LIBDIR}, nspr, nspr," |
| 47 | PACKAGECONFIG[python] = "--enable-python, --disable-python, python, python" |
| 48 | PACKAGECONFIG[unittests] = "--enable-unittests, --disable-unittests," |
| 49 | |
| 50 | export logdir = "${localstatedir}/log" |
| 51 | |
| 52 | do_install_append () { |
| 53 | |
| 54 | install -d ${D}${sysconfdir}/suricata |
| 55 | |
| 56 | oe_runmake install-conf DESTDIR=${D} |
| 57 | |
| 58 | # mimic move of downloaded rules to e_sysconfrulesdir |
| 59 | cp -rf ${WORKDIR}/rules ${D}${sysconfdir}/suricata |
| 60 | |
| 61 | oe_runmake install-rules DESTDIR=${D} |
| 62 | |
| 63 | install -d ${D}${sysconfdir}/suricata ${D}${sysconfdir}/default/volatiles |
| 64 | install -m 0644 ${WORKDIR}/volatiles.03_suricata ${D}${sysconfdir}/default/volatiles/volatiles.03_suricata |
| 65 | |
| 66 | install -m 0644 ${S}/threshold.config ${D}${sysconfdir}/suricata |
| 67 | |
| 68 | install -d ${D}${systemd_unitdir}/system |
| 69 | sed -e s:/etc:${sysconfdir}:g \ |
| 70 | -e s:/var/run:/run:g \ |
| 71 | -e s:/var:${localstatedir}:g \ |
| 72 | -e s:/usr/bin:${bindir}:g \ |
| 73 | -e s:/bin/kill:${base_bindir}/kill:g \ |
| 74 | -e s:/usr/lib:${libdir}:g \ |
| 75 | ${WORKDIR}/suricata.service > ${D}${systemd_unitdir}/system/suricata.service |
| 76 | |
| 77 | # Remove /var/run as it is created on startup |
| 78 | rm -rf ${D}${localstatedir}/run |
| 79 | |
| 80 | } |
| 81 | |
| 82 | pkg_postinst_ontarget_${PN} () { |
| 83 | if [ -e /etc/init.d/populate-volatile.sh ] ; then |
| 84 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 85 | fi |
| 86 | } |
| 87 | |
| 88 | SYSTEMD_PACKAGES = "${PN}" |
| 89 | |
| 90 | PACKAGES =+ "${PN}-socketcontrol" |
| 91 | FILES_${PN} += "${systemd_unitdir}" |
| 92 | FILES_${PN}-socketcontrol = "${bindir}/suricatasc ${PYTHON_SITEPACKAGES_DIR}" |
| 93 | |
| 94 | CONFFILES_${PN} = "${sysconfdir}/suricata/suricata.yaml" |
| 95 | |
| 96 | RDEPENDS_${PN}-python = "python" |