diff options
Diffstat (limited to 'recipes-ids/suricata/suricata_7.0.0.bb')
-rw-r--r-- | recipes-ids/suricata/suricata_7.0.0.bb | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/recipes-ids/suricata/suricata_7.0.0.bb b/recipes-ids/suricata/suricata_7.0.0.bb new file mode 100644 index 0000000..a52f081 --- /dev/null +++ b/recipes-ids/suricata/suricata_7.0.0.bb | |||
@@ -0,0 +1,126 @@ | |||
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 = "http://www.openinfosecfoundation.org/download/suricata-${PV}.tar.gz" | ||
8 | SRC_URI[sha256sum] = "7bcd1313118366451465dc3f8385a3f6aadd084ffe44dd257dda8105863bb769" | ||
9 | |||
10 | DEPENDS = "lz4 libhtp" | ||
11 | |||
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 | inherit autotools pkgconfig python3native systemd ptest cargo cargo-update-recipe-crates | ||
22 | |||
23 | require ${BPN}-crates.inc | ||
24 | |||
25 | EXTRA_OECONF += " --disable-debug \ | ||
26 | --disable-gccmarch-native \ | ||
27 | --enable-non-bundled-htp \ | ||
28 | --disable-suricata-update \ | ||
29 | --with-libhtp-includes=${STAGING_INCDIR} --with-libhtp-libraries=${STAGING_LIBDIR} \ | ||
30 | " | ||
31 | |||
32 | CARGO_SRC_DIR = "rust" | ||
33 | |||
34 | CARGO_BUILD_FLAGS:remove = "--frozen" | ||
35 | CARGO_BUILD_FLAGS:append = " --offline" | ||
36 | |||
37 | B = "${S}" | ||
38 | |||
39 | # nfnetlink has a dependancy to meta-networking | ||
40 | PACKAGECONFIG ??= "jansson file pcre2 yaml python pcap cap-ng net nss nspr " | ||
41 | PACKAGECONFIG:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'unittests', '', d)}" | ||
42 | |||
43 | PACKAGECONFIG[pcre2] = "--with-libpcre2-includes=${STAGING_INCDIR} --with-libpcre2-libraries=${STAGING_LIBDIR}, ,libpcre2 ," | ||
44 | PACKAGECONFIG[yaml] = "--with-libyaml-includes=${STAGING_INCDIR} --with-libyaml-libraries=${STAGING_LIBDIR}, ,libyaml ," | ||
45 | PACKAGECONFIG[pcap] = "--with-libpcap-includes=${STAGING_INCDIR} --with-libpcap-libraries=${STAGING_LIBDIR}, ,libpcap" | ||
46 | PACKAGECONFIG[cap-ng] = "--with-libcap_ng-includes=${STAGING_INCDIR} --with-libcap_ng-libraries=${STAGING_LIBDIR}, ,libcap-ng , " | ||
47 | PACKAGECONFIG[net] = "--with-libnet-includes=${STAGING_INCDIR} --with-libnet-libraries=${STAGING_LIBDIR}, , libnet," | ||
48 | PACKAGECONFIG[nfnetlink] = "--with-libnfnetlink-includes=${STAGING_INCDIR} --with-libnfnetlink-libraries=${STAGING_LIBDIR}, ,libnfnetlink ," | ||
49 | PACKAGECONFIG[nfq] = "--enable-nfqueue, --disable-nfqueue,libnetfilter-queue," | ||
50 | |||
51 | PACKAGECONFIG[jansson] = "--with-libjansson-includes=${STAGING_INCDIR} --with-libjansson-libraries=${STAGING_LIBDIR},,jansson, jansson" | ||
52 | PACKAGECONFIG[file] = ",,file, file" | ||
53 | PACKAGECONFIG[nss] = "--with-libnss-includes=${STAGING_INCDIR} --with-libnss-libraries=${STAGING_LIBDIR}, nss, nss," | ||
54 | PACKAGECONFIG[nspr] = "--with-libnspr-includes=${STAGING_INCDIR} --with-libnspr-libraries=${STAGING_LIBDIR}, nspr, nspr," | ||
55 | PACKAGECONFIG[python] = "--enable-python, --disable-python, python3, python3-core" | ||
56 | PACKAGECONFIG[unittests] = "--enable-unittests, --disable-unittests," | ||
57 | |||
58 | export logdir = "${localstatedir}/log" | ||
59 | |||
60 | CACHED_CONFIGUREVARS = "ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes" | ||
61 | |||
62 | do_configure:prepend () { | ||
63 | # use host for RUST_SURICATA_LIB_XC_DIR | ||
64 | sed -i -e 's,\${host_alias},${RUST_HOST_SYS},' ${S}/configure.ac | ||
65 | sed -i -e 's,libsuricata_rust.a,libsuricata.a,' ${S}/configure.ac | ||
66 | oe_runconf | ||
67 | } | ||
68 | |||
69 | do_compile () { | ||
70 | # we do this to bypass the make provided by this pkg | ||
71 | # patches Makefile to skip the subdir | ||
72 | cargo_do_compile | ||
73 | |||
74 | # Finish building | ||
75 | cd ${S} | ||
76 | make | ||
77 | } | ||
78 | |||
79 | do_install () { | ||
80 | install -d ${D}${sysconfdir}/suricata | ||
81 | |||
82 | oe_runmake install DESTDIR=${D} | ||
83 | |||
84 | install -d ${D}${sysconfdir}/suricata ${D}${sysconfdir}/default/volatiles | ||
85 | install -m 0644 ${WORKDIR}/volatiles.03_suricata ${D}${sysconfdir}/default/volatiles/03_suricata | ||
86 | |||
87 | install -m 0644 ${S}/threshold.config ${D}${sysconfdir}/suricata | ||
88 | install -m 0644 ${S}/suricata.yaml ${D}${sysconfdir}/suricata | ||
89 | |||
90 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
91 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
92 | install -m 0644 ${WORKDIR}/tmpfiles.suricata ${D}${sysconfdir}/tmpfiles.d/suricata.conf | ||
93 | |||
94 | install -d ${D}${systemd_unitdir}/system | ||
95 | sed -e s:/etc:${sysconfdir}:g \ | ||
96 | -e s:/var/run:/run:g \ | ||
97 | -e s:/var:${localstatedir}:g \ | ||
98 | -e s:/usr/bin:${bindir}:g \ | ||
99 | -e s:/bin/kill:${base_bindir}/kill:g \ | ||
100 | -e s:/usr/lib:${libdir}:g \ | ||
101 | ${WORKDIR}/suricata.service > ${D}${systemd_unitdir}/system/suricata.service | ||
102 | fi | ||
103 | |||
104 | # Remove /var/run as it is created on startup | ||
105 | rm -rf ${D}${localstatedir}/run | ||
106 | |||
107 | sed -i -e "s:#!.*$:#!${USRBINPATH}/env ${PYTHON_PN}:g" ${D}${bindir}/suricatasc | ||
108 | sed -i -e "s:#!.*$:#!${USRBINPATH}/env ${PYTHON_PN}:g" ${D}${bindir}/suricatactl | ||
109 | sed -i -e "s:#!.*$:#!${USRBINPATH}/env ${PYTHON_PN}:g" ${D}${libdir}/suricata/python/suricata/sc/suricatasc.py | ||
110 | } | ||
111 | |||
112 | pkg_postinst_ontarget:${PN} () { | ||
113 | if command -v systemd-tmpfiles >/dev/null; then | ||
114 | systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/suricata.conf | ||
115 | elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then | ||
116 | ${sysconfdir}/init.d/populate-volatile.sh update | ||
117 | fi | ||
118 | } | ||
119 | |||
120 | SYSTEMD_PACKAGES = "${PN}" | ||
121 | |||
122 | PACKAGES =+ "${PN}-python" | ||
123 | FILES:${PN} += "${systemd_unitdir} ${sysconfdir}/tmpfiles.d" | ||
124 | FILES:${PN}-python = "${bindir}/suricatasc ${PYTHON_SITEPACKAGES_DIR}" | ||
125 | |||
126 | CONFFILES:${PN} = "${sysconfdir}/suricata/suricata.yaml" | ||