Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 1 | SUMMARY = "The Suricata Engine is an Open Source Next Generation Intrusion Detection and Prevention Engine" |
| 2 | |
| 3 | require suricata.inc |
| 4 | |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 5 | LIC_FILES_CHKSUM = "file://LICENSE;beginline=1;endline=2;md5=c70d8d3310941dcdfcd1e02800a1f548" |
| 6 | |
Andrew Geissler | 59125e0 | 2021-07-23 12:56:22 -0400 | [diff] [blame] | 7 | SRC_URI = "http://www.openinfosecfoundation.org/download/suricata-${PV}.tar.gz" |
| 8 | SRC_URI[sha256sum] = "daf134bb2d7c980035e9ae60f7aaf313323a809340009f26e48110ccde81f602" |
| 9 | |
| 10 | DEPENDS = "lz4 libhtp" |
| 11 | |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 12 | SRC_URI += " \ |
| 13 | file://volatiles.03_suricata \ |
| 14 | file://tmpfiles.suricata \ |
| 15 | file://suricata.yaml \ |
| 16 | file://suricata.service \ |
| 17 | file://run-ptest \ |
| 18 | file://fixup.patch \ |
| 19 | " |
| 20 | |
| 21 | SRC_URI += " \ |
| 22 | crate://crates.io/autocfg/1.0.1 \ |
| 23 | crate://crates.io/semver-parser/0.7.0 \ |
| 24 | crate://crates.io/arrayvec/0.4.12 \ |
| 25 | crate://crates.io/ryu/1.0.5 \ |
| 26 | crate://crates.io/libc/0.2.86 \ |
| 27 | crate://crates.io/bitflags/1.2.1 \ |
| 28 | crate://crates.io/version_check/0.9.2 \ |
| 29 | crate://crates.io/memchr/2.3.4 \ |
| 30 | crate://crates.io/nodrop/0.1.14 \ |
| 31 | crate://crates.io/cfg-if/0.1.9 \ |
| 32 | crate://crates.io/static_assertions/0.3.4 \ |
| 33 | crate://crates.io/getrandom/0.1.16 \ |
| 34 | crate://crates.io/cfg-if/1.0.0 \ |
| 35 | crate://crates.io/siphasher/0.3.3 \ |
| 36 | crate://crates.io/ppv-lite86/0.2.10 \ |
| 37 | crate://crates.io/proc-macro-hack/0.5.19 \ |
| 38 | crate://crates.io/proc-macro2/0.4.30 \ |
| 39 | crate://crates.io/unicode-xid/0.1.0 \ |
| 40 | crate://crates.io/syn/0.15.44 \ |
| 41 | crate://crates.io/build_const/0.2.1 \ |
| 42 | crate://crates.io/num-derive/0.2.5 \ |
| 43 | crate://crates.io/base64/0.11.0 \ |
| 44 | crate://crates.io/widestring/0.4.3 \ |
| 45 | crate://crates.io/md5/0.7.0 \ |
| 46 | crate://crates.io/uuid/0.8.2 \ |
| 47 | crate://crates.io/byteorder/1.4.2 \ |
| 48 | crate://crates.io/semver/0.9.0 \ |
| 49 | crate://crates.io/nom/5.1.1 \ |
| 50 | crate://crates.io/num-traits/0.2.14 \ |
| 51 | crate://crates.io/num-integer/0.1.44 \ |
| 52 | crate://crates.io/num-bigint/0.2.6 \ |
| 53 | crate://crates.io/num-bigint/0.3.1 \ |
| 54 | crate://crates.io/num-rational/0.2.4 \ |
| 55 | crate://crates.io/num-complex/0.2.4 \ |
| 56 | crate://crates.io/num-iter/0.1.42 \ |
| 57 | crate://crates.io/phf_shared/0.8.0 \ |
| 58 | crate://crates.io/crc/1.8.1 \ |
| 59 | crate://crates.io/rustc_version/0.2.3 \ |
| 60 | crate://crates.io/phf/0.8.0 \ |
| 61 | crate://crates.io/lexical-core/0.6.7 \ |
| 62 | crate://crates.io/time/0.1.44 \ |
| 63 | crate://crates.io/quote/0.6.13 \ |
| 64 | crate://crates.io/rand_core/0.5.1 \ |
| 65 | crate://crates.io/rand_chacha/0.2.2 \ |
| 66 | crate://crates.io/rand_pcg/0.2.1 \ |
| 67 | crate://crates.io/num-traits/0.1.43 \ |
| 68 | crate://crates.io/rand/0.7.3 \ |
| 69 | crate://crates.io/enum_primitive/0.1.1 \ |
| 70 | crate://crates.io/phf_generator/0.8.0 \ |
| 71 | crate://crates.io/phf_codegen/0.8.0 \ |
| 72 | crate://crates.io/tls-parser/0.9.4 \ |
| 73 | crate://crates.io/num/0.2.1 \ |
| 74 | crate://crates.io/rusticata-macros/2.1.0 \ |
| 75 | crate://crates.io/ntp-parser/0.4.0 \ |
| 76 | crate://crates.io/der-oid-macro/0.2.0 \ |
| 77 | crate://crates.io/der-parser/3.0.4 \ |
| 78 | crate://crates.io/ipsec-parser/0.5.0 \ |
| 79 | crate://crates.io/x509-parser/0.6.5 \ |
| 80 | crate://crates.io/der-parser/4.1.0 \ |
| 81 | crate://crates.io/snmp-parser/0.6.0 \ |
| 82 | crate://crates.io/kerberos-parser/0.5.0 \ |
| 83 | crate://crates.io/wasi/0.10.0+wasi-snapshot-preview1 \ |
| 84 | crate://crates.io/winapi/0.3.9 \ |
| 85 | crate://crates.io/winapi-i686-pc-windows-gnu/0.4.0 \ |
| 86 | crate://crates.io/winapi-x86_64-pc-windows-gnu/0.4.0 \ |
| 87 | crate://crates.io/log/0.4.0 \ |
| 88 | crate://crates.io/rand_hc/0.2.0 \ |
| 89 | crate://crates.io/wasi/0.9.0+wasi-snapshot-preview1 \ |
Andrew Geissler | 59125e0 | 2021-07-23 12:56:22 -0400 | [diff] [blame] | 90 | crate://crates.io/sawp/0.5.0 \ |
| 91 | crate://crates.io/sawp-modbus/0.5.0 \ |
| 92 | crate://crates.io/brotli/3.3.0 \ |
| 93 | crate://crates.io/flate2/1.0.20 \ |
| 94 | crate://crates.io/alloc-no-stdlib/2.0.1 \ |
| 95 | crate://crates.io/alloc-stdlib/0.2.1 \ |
| 96 | crate://crates.io/brotli-decompressor/2.3.1 \ |
| 97 | crate://crates.io/crc32fast/1.2.1 \ |
| 98 | crate://crates.io/miniz_oxide/0.4.4 \ |
| 99 | crate://crates.io/adler/1.0.2 \ |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 100 | " |
| 101 | |
| 102 | # test case support |
| 103 | SRC_URI += " \ |
| 104 | crate://crates.io/test-case/1.0.1 \ |
| 105 | crate://crates.io/proc-macro2/1.0.1 \ |
| 106 | crate://crates.io/quote/1.0.1 \ |
| 107 | crate://crates.io/syn/1.0.1 \ |
| 108 | crate://crates.io/unicode-xid/0.2.0 \ |
| 109 | " |
| 110 | |
| 111 | inherit autotools pkgconfig python3native systemd ptest cargo |
| 112 | |
| 113 | EXTRA_OECONF += " --disable-debug \ |
| 114 | --disable-gccmarch-native \ |
| 115 | --enable-non-bundled-htp \ |
| 116 | --disable-suricata-update \ |
| 117 | --with-libhtp-includes=${STAGING_INCDIR} --with-libhtp-libraries=${STAGING_LIBDIR} \ |
| 118 | " |
| 119 | |
| 120 | CARGO_SRC_DIR = "rust" |
| 121 | |
| 122 | B = "${S}" |
| 123 | |
| 124 | PACKAGECONFIG ??= "jansson file pcre yaml python pcap cap-ng net nfnetlink nss nspr " |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 125 | PACKAGECONFIG:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'unittests', '', d)}" |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 126 | |
| 127 | PACKAGECONFIG[pcre] = "--with-libpcre-includes=${STAGING_INCDIR} --with-libpcre-libraries=${STAGING_LIBDIR}, ,libpcre ," |
| 128 | PACKAGECONFIG[yaml] = "--with-libyaml-includes=${STAGING_INCDIR} --with-libyaml-libraries=${STAGING_LIBDIR}, ,libyaml ," |
| 129 | PACKAGECONFIG[pcap] = "--with-libpcap-includes=${STAGING_INCDIR} --with-libpcap-libraries=${STAGING_LIBDIR}, ,libpcap" |
| 130 | PACKAGECONFIG[cap-ng] = "--with-libcap_ng-includes=${STAGING_INCDIR} --with-libcap_ng-libraries=${STAGING_LIBDIR}, ,libcap-ng , " |
| 131 | PACKAGECONFIG[net] = "--with-libnet-includes=${STAGING_INCDIR} --with-libnet-libraries=${STAGING_LIBDIR}, , libnet," |
| 132 | PACKAGECONFIG[nfnetlink] = "--with-libnfnetlink-includes=${STAGING_INCDIR} --with-libnfnetlink-libraries=${STAGING_LIBDIR}, ,libnfnetlink ," |
| 133 | PACKAGECONFIG[nfq] = "--enable-nfqueue, --disable-nfqueue,libnetfilter-queue," |
| 134 | |
| 135 | PACKAGECONFIG[jansson] = "--with-libjansson-includes=${STAGING_INCDIR} --with-libjansson-libraries=${STAGING_LIBDIR},,jansson, jansson" |
| 136 | PACKAGECONFIG[file] = ",,file, file" |
| 137 | PACKAGECONFIG[nss] = "--with-libnss-includes=${STAGING_INCDIR} --with-libnss-libraries=${STAGING_LIBDIR}, nss, nss," |
| 138 | PACKAGECONFIG[nspr] = "--with-libnspr-includes=${STAGING_INCDIR} --with-libnspr-libraries=${STAGING_LIBDIR}, nspr, nspr," |
| 139 | PACKAGECONFIG[python] = "--enable-python, --disable-python, python3, python3-core" |
| 140 | PACKAGECONFIG[unittests] = "--enable-unittests, --disable-unittests," |
| 141 | |
| 142 | export logdir = "${localstatedir}/log" |
| 143 | |
| 144 | CACHED_CONFIGUREVARS = "ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes" |
| 145 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 146 | do_configure:prepend () { |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 147 | oe_runconf |
| 148 | } |
| 149 | |
| 150 | do_compile () { |
| 151 | # we do this to bypass the make provided by this pkg |
| 152 | # patches Makefile to skip the subdir |
| 153 | cargo_do_compile |
| 154 | |
| 155 | # Finish building |
| 156 | cd ${S} |
| 157 | make |
| 158 | } |
| 159 | |
| 160 | do_install () { |
| 161 | install -d ${D}${sysconfdir}/suricata |
| 162 | |
| 163 | oe_runmake install DESTDIR=${D} |
| 164 | |
| 165 | install -d ${D}${sysconfdir}/suricata ${D}${sysconfdir}/default/volatiles |
| 166 | install -m 0644 ${WORKDIR}/volatiles.03_suricata ${D}${sysconfdir}/default/volatiles/03_suricata |
| 167 | |
| 168 | install -m 0644 ${S}/threshold.config ${D}${sysconfdir}/suricata |
| 169 | install -m 0644 ${S}/suricata.yaml ${D}${sysconfdir}/suricata |
| 170 | |
| 171 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 172 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 173 | install -m 0644 ${WORKDIR}/tmpfiles.suricata ${D}${sysconfdir}/tmpfiles.d/suricata.conf |
| 174 | |
| 175 | install -d ${D}${systemd_unitdir}/system |
| 176 | sed -e s:/etc:${sysconfdir}:g \ |
| 177 | -e s:/var/run:/run:g \ |
| 178 | -e s:/var:${localstatedir}:g \ |
| 179 | -e s:/usr/bin:${bindir}:g \ |
| 180 | -e s:/bin/kill:${base_bindir}/kill:g \ |
| 181 | -e s:/usr/lib:${libdir}:g \ |
| 182 | ${WORKDIR}/suricata.service > ${D}${systemd_unitdir}/system/suricata.service |
| 183 | fi |
| 184 | |
| 185 | # Remove /var/run as it is created on startup |
| 186 | rm -rf ${D}${localstatedir}/run |
| 187 | |
| 188 | sed -i -e "s:#!.*$:#!${USRBINPATH}/env ${PYTHON_PN}:g" ${D}${bindir}/suricatasc |
| 189 | sed -i -e "s:#!.*$:#!${USRBINPATH}/env ${PYTHON_PN}:g" ${D}${bindir}/suricatactl |
| 190 | } |
| 191 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 192 | pkg_postinst_ontarget:${PN} () { |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 193 | if command -v systemd-tmpfiles >/dev/null; then |
| 194 | systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/suricata.conf |
| 195 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then |
| 196 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 197 | fi |
| 198 | } |
| 199 | |
| 200 | SYSTEMD_PACKAGES = "${PN}" |
| 201 | |
| 202 | PACKAGES =+ "${PN}-python" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 203 | FILES:${PN} += "${systemd_unitdir} ${sysconfdir}/tmpfiles.d" |
| 204 | FILES:${PN}-python = "${bindir}/suricatasc ${PYTHON_SITEPACKAGES_DIR}" |
Andrew Geissler | f1e4406 | 2021-04-15 15:52:46 -0500 | [diff] [blame] | 205 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 206 | CONFFILES:${PN} = "${sysconfdir}/suricata/suricata.yaml" |