From 9d0673651c57438d51e18c6b8ca894d0491b2df3 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 24 Aug 2022 20:48:34 +0100 Subject: gentoo auto-resync : 24:08:2022 - 20:48:33 --- net-analyzer/Manifest.gz | Bin 45053 -> 45053 bytes net-analyzer/suricata/Manifest | 5 +- net-analyzer/suricata/files/suricata.confd | 62 +++++++ net-analyzer/suricata/files/suricata.initd | 147 +++++++++++++++++ net-analyzer/suricata/suricata-6.0.6-r1.ebuild | 217 +++++++++++++++++++++++++ net-analyzer/suricata/suricata-6.0.6.ebuild | 214 ------------------------ 6 files changed, 430 insertions(+), 215 deletions(-) create mode 100644 net-analyzer/suricata/files/suricata.confd create mode 100644 net-analyzer/suricata/files/suricata.initd create mode 100644 net-analyzer/suricata/suricata-6.0.6-r1.ebuild delete mode 100644 net-analyzer/suricata/suricata-6.0.6.ebuild (limited to 'net-analyzer') diff --git a/net-analyzer/Manifest.gz b/net-analyzer/Manifest.gz index 8d9df5d66798..d1df137bdd90 100644 Binary files a/net-analyzer/Manifest.gz and b/net-analyzer/Manifest.gz differ diff --git a/net-analyzer/suricata/Manifest b/net-analyzer/suricata/Manifest index 8009b63bf52e..1d0bacdaac37 100644 --- a/net-analyzer/suricata/Manifest +++ b/net-analyzer/suricata/Manifest @@ -5,10 +5,13 @@ AUX suricata-5.0.1_default-config.patch 813 BLAKE2B 5758447f2dc6fa50bb6a388c2c83 AUX suricata-5.0.6_configure-no-sphinx-pdflatex-automagic.patch 938 BLAKE2B 3f5434808567cd314cdc5287397c2f215eca44e775ead00db7095f88798fc86d595418bf4c340c3686f20a43f7a8705985d954ef4ec6c799d9c12036151387c6 SHA512 4b6ca7dbfa61f26f44f83cf1300d428c3322bdad00bed2e8d1820dd8f74c3bbf335a12df05243a0e2d1c35da2cf5b85155ef7b1609790bcfc74ec084daf5d631 AUX suricata-5.0.7_configure-no-hyperscan-automagic.patch 739 BLAKE2B 38e73c88d8cee3476b96adee1304a9429d326591b2131fb2f4167e94d3b616a6390f783bfc88922322487548c54b8ddeff5bda5c5e510641965ad5e6615262bc SHA512 bff09105b0908b141857f4804a909cc2ea0d3a2def2215bc3c52e31aea35acd20738606bd6f1c6b6f12a78ac63d86bf8a20cd68aa53ce0692754608d4c38097b AUX suricata-6.0.0_default-config.patch 833 BLAKE2B a8a63f838452531feb9f1b69e9756c0385338f4a1b8f6c36b22052cc7f8a41cd07e31b882e2e89402c5eb43e599390cf6922f9dcfc869416d57aa3426516f8f9 SHA512 8edff1be84dbe29a140889040a7d9310ee8dc5ab82cf9ff64298ecfab07a75853caa7ac907cf191a62a1c2de9833311fd090eb2f82c9d3745b5f3fc01adf6efd +AUX suricata.confd 2771 BLAKE2B c9f9ac6707f71ace993bcf730df5aab11a6e59fcbb636140a110d2ec636587bca600938af55a7d709ed0994c38095c0a8d505d2af9912ea3aaf1be20e098043f SHA512 4c8c1d0c101e850b39358605451df37427bb94f1b55836078aeb0b4e3720f5bdef01d4bc9d4ddfb3436c822c7bd8796112409421a7d90cf40ec81a6a24c3d6dd +AUX suricata.initd 5475 BLAKE2B 6f824b26d87d1519ac16bdb78bb2f3391040341ee709663b102ea8989d7ca3f38a475efc2796d7e78da35dbb54d327bb2e18e463fdc19880af1ed20e42a38a14 SHA512 0006e34f24f2cf967cc1e44ec626b53aaeee535a3810aa5ad71175f28b5649b2dbaadd2a97f10b8f4adb37d45b9e5fb0991aa92276183869531cb79887d742df AUX suricata.service 501 BLAKE2B 00631ada0d2993eae97a028ef950b031b91bb3af346ee3538bd7f0deb9d76bb8552761b4666a3ac80673fe31ffd95424f2ff71e35db0f5fe6667b32478fab4c4 SHA512 4e4e87735731fd0e18ab26e536e7904833a19ce8785ffdd15b22d494673c73044137908feee74800486960f9efd09d1ddc2c75a490a2e35ef06caf23c7439a0c AUX suricata.tmpfiles 24 BLAKE2B 150b74a6775137704915015871ab4455b8d0b9204a75c398ea746e9194b0c0a787904f9015b98f36a685fac0dbb0fcb43746096dd403bf882afa5dfef12af94d SHA512 1530aed4efb35f988e2f0134388ea11ffc3ba1f217845a2c5dd47f947983ed4d343126e49d66a86ca7894ff60b5134464ddbe07509dcc80c001131f09cb7e2dd DIST suricata-5.0.10.tar.gz 29391642 BLAKE2B b5c83b9882e89894c3dedb7f536d584a20bbeab24236752e528171db6589a6308422c8b0be4f433fc63b8cfc227aa0b67935a4aece943b10f4577398ea9ed467 SHA512 c59719d42a236ac7421e0bcf6894f113c8f7518e2b5dde558cbe57c12b68b86ef700bae3f4047c6b2677a784061951fc9d058e9f59b11846279da06e9649ac56 DIST suricata-6.0.6.tar.gz 32651139 BLAKE2B de0a73c618c1e2777019de6b29be5224db1885840cba8d05ad4a83fc082408e5d8b16d2c6055701f5d279852a99bea5dea01bed58ad0148afd76c1158e693f16 SHA512 184e5a2f3a68de33198f6f0e681710b3f04ed083081ef989dba77d1afb78922c5afdcdaa18ca92c6ed79b98134a3c42b13e1f3e91d20ea10ca74a692f93c5101 +DIST suricata-6.0.6.tar.gz.sig 566 BLAKE2B 07a1d3ccf434eb0bff36009d36b449ed3295e78ca217efc3bfb722169f80e513621878077e5d2e6a5085db6dff3dfcb0d37ca3d125b590b4ba56a6135293377b SHA512 8dc242af8d176699c710c27ec4ebc37c1363ebed1601de9a6f5a81a393079eff4680e6912674872861d905cfe85dfa610c2a66a9a79980603868bb9d515ffe29 EBUILD suricata-5.0.10.ebuild 6651 BLAKE2B bbc891ad292548d698f229233615875afa85bfe5700724348065a86cf5ba866c9bee00a3ed62462109c10c9ba7eeab1b6d2b2a08fd3c459dac4d5fd84e2252cf SHA512 b5466d2a19e7864f0d94c3767301689d6cf4ae03954b253066408e5cc5a020264c31ee4489fd1fa648471298086338d44c8849e672a97880985eb9fa6b36db30 -EBUILD suricata-6.0.6.ebuild 6798 BLAKE2B 57e3dcc0facd0590258807f9709a4dfdffd7903fd329609d3ea4c8bf0f53322310ced6ca8b89f211e885cefa4148405fd123e93bdb6b7a9338879898f1c49484 SHA512 73b4b1c3e09fad5280658bcc1f9504d7d1ab04433c7c60a4901bee6e99829fcea75bffb5c798bc26a9866b2e8765c802a4a039e4f466a3eb013563312224fb84 +EBUILD suricata-6.0.6-r1.ebuild 7035 BLAKE2B de85c131d288e7f1879627f39596167f24ce5762028087cb4f6419727a29e9b3f101b62337ca9da8a4be70656b4caafe2788ece8bd6357372e229fbdeb798cc6 SHA512 4f8d7c21850027b32de1d5a60395802c41846dcf632a67c6d23853b38db407ad0601edbe3d7b5644e11d6c6b8bc7a687d305a8455fdeec544de9b38668f43ea6 MISC metadata.xml 1047 BLAKE2B 8418aaa86ecf0e2baaf3f927c764dd8f0471f29c0b691ec3baac6988291e9e591ea4263b89a4a25b44cc2642d58bbffcfa5fdecd628ea101e4dd3d67e1914515 SHA512 1e6e38f2d0cd4335e274ab1ac72a445a3bfdd7a5c028d06a387e0f879cf7859681856ff03986816d5dae1ac841958652003b5c8057187885c579a695f8bc11cd diff --git a/net-analyzer/suricata/files/suricata.confd b/net-analyzer/suricata/files/suricata.confd new file mode 100644 index 000000000000..7f22113dbf0d --- /dev/null +++ b/net-analyzer/suricata/files/suricata.confd @@ -0,0 +1,62 @@ +# Config file for /etc/init.d/suricata* + +# Where config files are stored. Default: + +# SURICATA_DIR="/etc/suricata" + +# Pass options to each suricata service. +# +# You can launch more than one service at the same time with different options. +# This can be useful in a multi-queue gateway, for example. +# You can expand on the Suricata inline example found at: +# http://suricata.readthedocs.io/en/latest/setting-up-ipsinline-for-linux.html +# Instead of configuring iptables to send traffic to just one queue, you can configure it to "load balance" +# on several queues. You can then have a Suricata instance processing traffic for each queue. +# This should help improve performance on the gateway/firewall. +# +# Suppose you configured iptables to use queues 0 and 1 named q0 and q1. You can now do the following: +# ln -s /etc/init.d/suricata /etc/init.d/suricata.q0 +# ln -s /etc/init.d/suricata /etc/init.d/suricata.q1 +# cp /etc/suricata/suricata.yaml /etc/suricata/suricata-q0.yaml +# cp /etc/suricata/suricata.yaml /etc/suricata/suricata-q1.yaml +# +# Edit both suricata-q{0,1}.yaml files and set values accordingly. +# You can override these yaml config file names with SURICATA_CONF* below (optional). +# This allows you to use the same yaml config file for multiple instances as long as you override +# sensible options such as the log file paths. +# SURICATA_CONF_q0="suricata-queues.yaml" +# SURICATA_CONF_q1="suricata-queues.yaml" +# SURICATA_CONF="suricata.yaml" + +# You can define the options here: +# NB: avoid using -l, -c, --user, --group and setting logging.outputs.1.file.filename as the init script will try to set them for you. + +# SURICATA_OPTS_q0="-q 0" +# SURICATA_OPTS_q1="-q 1" + +# If you want to use ${SURICATA_DIR}/suricata.yaml and start the service with /etc/init.d/suricata +# then you can set: + +SURICATA_OPTS="--af-packet" + +# Log paths listed here will be created by the init script and will override the log path +# set in the yaml file, if present. +# SURICATA_LOG_FILE_q0="/var/log/suricata/q0/suricata.log" +# SURICATA_LOG_FILE_q1="/var/log/suricata/q1/suricata.log" +# SURICATA_LOG_FILE="/var/log/suricata/suricata.log" + +# Run as user/group. +# Do not define if you want to run as root or as the user defined in the yaml config file (run-as). +# The ebuild should have created the dedicated user/group suricata:suricata for you to specify here below. +# SURICATA_USER_q0="suricata" +# SURICATA_GROUP_q0="suricata" +# SURICATA_USER_q1="suricata" +# SURICATA_GROUP_q1="suricata" +# SURICATA_USER="suricata" +# SURICATA_GROUP="suricata" + +# Suricata processes can take a long time to shut down. +# If necessary, adjust timeout in seconds to be used when calling stop from the init script. +# Examples: +# SURICATA_MAX_WAIT_ON_STOP="300" +# SURICATA_MAX_WAIT_ON_STOP="SIGTERM/30" diff --git a/net-analyzer/suricata/files/suricata.initd b/net-analyzer/suricata/files/suricata.initd new file mode 100644 index 000000000000..154636ef828e --- /dev/null +++ b/net-analyzer/suricata/files/suricata.initd @@ -0,0 +1,147 @@ +#!/sbin/openrc-run +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +SURICATA_BIN=/usr/bin/suricata +SURICATA_DIR=${SURICATA_DIR:-/etc/suricata} +SURICATA=${SVCNAME#*.} +SURICATAID=$(shell_var "${SURICATA}") +if [ -n "${SURICATA}" ] && [ ${SVCNAME} != "suricata" ]; then + eval SURICATACONF=\$SURICATA_CONF_${SURICATAID} + [ ${#SURICATACONF} -eq 0 ] && SURICATACONF="${SURICATA_DIR}/suricata-${SURICATA}.yaml" || SURICATACONF="${SURICATA_DIR}/${SURICATACONF}" + SURICATAPID="/run/suricata/suricata.${SURICATA}.pid" + eval SURICATAOPTS=\$SURICATA_OPTS_${SURICATAID} + eval SURICATALOGPATH=\$SURICATA_LOG_FILE_${SURICATAID} + eval SURICATAUSER=\$SURICATA_USER_${SURICATAID} + eval SURICATAGROUP=\$SURICATA_GROUP_${SURICATAID} +else + SURICATACONF=${SURICATA_CONF} + [ ${#SURICATACONF} -eq 0 ] && SURICATACONF="${SURICATA_DIR}/suricata.yaml" || SURICATACONF="${SURICATA_DIR}/${SURICATACONF}" + SURICATAPID="/run/suricata/suricata.pid" + SURICATAOPTS=${SURICATA_OPTS} + SURICATALOGPATH=${SURICATA_LOG_FILE} + SURICATAUSER=${SURICATA_USER} + SURICATAGROUP=${SURICATA_GROUP} +fi +SURICATAUSER=${SURICATAUSER:-${SURICATA_USER}} +SURICATAGROUP=${SURICATAGROUP:-${SURICATA_GROUP}} +[ -e ${SURICATACONF} ] && SURICATAOPTS="-c ${SURICATACONF} ${SURICATAOPTS}" +[ -z "${SURICATA_MAX_WAIT_ON_STOP}" ] || SURICATA_RETRY="--retry ${SURICATA_MAX_WAIT_ON_STOP}" + +description="Suricata IDS/IPS" +extra_commands="checkconfig dump" +description_checkconfig="Check config for ${SVCNAME}" +description_dump="List all config values that can be used with --set" +extra_started_commands="reload relog" +description_reload="Live rule and config reload" +description_relog="Close and re-open all log files" + +depend() { + need net + after mysql + after postgresql +} + +checkconfig() { + if [ ! -d "/run/suricata" ] ; then + checkpath -d /run/suricata + fi + if [ ${#SURICATALOGPATH} -gt 0 ]; then + SURICATALOGFILE=$( basename ${SURICATALOGPATH} ) + SURICATALOGFILE=${SURICATALOGFILE:-suricata.log} + SURICATALOGPATH=$( dirname ${SURICATALOGPATH} ) + if [ ! -d "${SURICATALOGPATH}" ] ; then + checkpath -d "${SURICATALOGPATH}" + fi + if [ ${#SURICATAUSER} -gt 0 ] && [ ${#SURICATAGROUP} -gt 0 ] && [ -e "${SURICATALOGPATH}" ]; then + chown ${SURICATAUSER}:${SURICATAGROUP} "${SURICATALOGPATH}" || return 1 + chown ${SURICATAUSER}:${SURICATAGROUP} "${SURICATALOGPATH}"/* >/dev/null 2>&1 3>&1 + fi + SURICATAOPTS="${SURICATAOPTS} --set logging.outputs.1.file.filename=${SURICATALOGPATH}/${SURICATALOGFILE}" + SURICATALOGPATH="-l ${SURICATALOGPATH}" + fi + if [ ! -e ${SURICATACONF} ] ; then + einfo "The configuration file ${SURICATACONF} was not found." + einfo "If this is OK then make sure you set enough options for ${SVCNAME} in /etc/conf.d/suricata." + einfo "Take a look at the suricata arguments --set and --dump-config." + fi + if [ ${#SURICATAUSER} -gt 0 ] && [ ${#SURICATAGROUP} -gt 0 ]; then + einfo "${SVCNAME} will run as user ${SURICATAUSER}:${SURICATAGROUP}." + SURICATAOPTS="${SURICATAOPTS} --user=${SURICATAUSER} --group=${SURICATAGROUP}" + fi +} + +initpidinfo() { + [ -e ${SURICATAPID} ] && SUR_PID="$(cat ${SURICATAPID})" + if [ ${#SUR_PID} -gt 0 ]; then + SUR_PID_CHECK="$(ps -eo pid | grep -c ${SUR_PID})" + SUR_USER="$(ps -p ${SUR_PID} --no-headers -o user)" + fi +} + +checkpidinfo() { + initpidinfo + if [ ! -e ${SURICATAPID} ]; then + eerror "${SVCNAME} isn't running" + return 1 + elif [ ${#SUR_PID} -eq 0 ] || [ $((SUR_PID_CHECK)) -ne 1 ]; then + eerror "Could not determine PID of ${SVCNAME}! Did the service crash?" + return 1 + elif [ ${#SUR_USER} -eq 0 ]; then + eerror "Unable to determine user running ${SVCNAME}!" + return 1 + elif [ "x${SUR_USER}" != "xroot" ]; then + ewarn "${SVCNAME} may need to be running as root or as a priviledged user for the extra commands reload and relog to work." + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --quiet --exec ${SURICATA_BIN} \ + -- --pidfile ${SURICATAPID} -D ${SURICATAOPTS} ${SURICATALOGPATH} >/dev/null 2>&1 + local SUR_EXIT=$? + if [ $((SUR_EXIT)) -ne 0 ]; then + einfo "Could not start ${SURICATA_BIN} with:" + einfo "--pidfile ${SURICATAPID} -D ${SURICATAOPTS} ${SURICATALOGPATH}" + einfo "Exit code ${SUR_EXIT}" + fi + eend ${SUR_EXIT} +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop ${SURICATA_RETRY} --quiet --pidfile ${SURICATAPID} >/dev/null 2>&1 + eend $? +} + +reload() { + checkpidinfo || return 1 + checkconfig || return 1 + ebegin "Sending USR2 signal to ${SVCNAME} to perform a live rule and config reload." + if [ ${#SURICATAUSER} -gt 0 ] && [ ${#SURICATAGROUP} -gt 0 ]; then + start-stop-daemon --user ${SURICATAUSER} --group ${SURICATAGROUP} --signal USR2 --pidfile ${SURICATAPID} + else + start-stop-daemon --signal USR2 --pidfile ${SURICATAPID} + fi + eend $? +} + +relog() { + checkpidinfo || return 1 + checkconfig || return 1 + ebegin "Sending HUP signal to ${SVCNAME} to close and re-open all log files." + if [ ${#SURICATAUSER} -gt 0 ] && [ ${#SURICATAGROUP} -gt 0 ]; then + start-stop-daemon --user ${SURICATAUSER} --group ${SURICATAGROUP} --signal HUP --pidfile ${SURICATAPID} + else + start-stop-daemon --signal HUP --pidfile ${SURICATAPID} + fi + eend $? +} + +dump() { + checkconfig || return 1 + ebegin "Dumping ${SVCNAME} config values and quitting." + ${SURICATA_BIN} --dump-config --pidfile ${SURICATAPID} ${SURICATAOPTS} ${SURICATALOGPATH} + eend $? +} diff --git a/net-analyzer/suricata/suricata-6.0.6-r1.ebuild b/net-analyzer/suricata/suricata-6.0.6-r1.ebuild new file mode 100644 index 000000000000..aa3162a55d94 --- /dev/null +++ b/net-analyzer/suricata/suricata-6.0.6-r1.ebuild @@ -0,0 +1,217 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LUA_COMPAT=( lua5-1 luajit ) +PYTHON_COMPAT=( python3_{8..11} ) + +inherit autotools flag-o-matic linux-info lua-single python-single-r1 systemd tmpfiles verify-sig + +DESCRIPTION="High performance Network IDS, IPS and Network Security Monitoring engine" +HOMEPAGE="https://suricata.io/" +SRC_URI="https://www.openinfosecfoundation.org/download/${P}.tar.gz + verify-sig? ( https://www.openinfosecfoundation.org/download/${P}.tar.gz.sig )" + +LICENSE="GPL-2" +SLOT="0/6" +KEYWORDS="~amd64 ~riscv ~x86" +IUSE="+af-packet bpf control-socket cuda debug +detection geoip hardened hyperscan lua lz4 nflog +nfqueue redis systemd test" +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}/usr/share/openpgp-keys/openinfosecfoundation.org.asc" + +RESTRICT="!test? ( test )" + +REQUIRED_USE="${PYTHON_REQUIRED_USE} + bpf? ( af-packet ) + lua? ( ${LUA_REQUIRED_USE} )" + +RDEPEND="${PYTHON_DEPS} + acct-group/suricata + acct-user/suricata + dev-libs/jansson:= + dev-libs/libpcre + dev-libs/libyaml + net-libs/libnet:* + net-libs/libnfnetlink + dev-libs/nspr + dev-libs/nss + $(python_gen_cond_dep ' + dev-python/pyyaml[${PYTHON_USEDEP}] + ') + >=net-libs/libhtp-0.5.40 + net-libs/libpcap + sys-apps/file + sys-libs/libcap-ng + bpf? ( >=dev-libs/libbpf-0.1.0 ) + cuda? ( dev-util/nvidia-cuda-toolkit ) + geoip? ( dev-libs/libmaxminddb:= ) + hyperscan? ( dev-libs/hyperscan ) + lua? ( ${LUA_DEPS} ) + lz4? ( app-arch/lz4 ) + nflog? ( net-libs/libnetfilter_log ) + nfqueue? ( net-libs/libnetfilter_queue ) + redis? ( dev-libs/hiredis:= )" +DEPEND="${RDEPEND} + >=sys-devel/autoconf-2.69-r5 + virtual/rust" +BDEPEND="verify-sig? ( >=sec-keys/openpgp-keys-oisf-20200807 )" + +PATCHES=( + "${FILESDIR}/${PN}-5.0.1_configure-no-lz4-automagic.patch" + "${FILESDIR}/${PN}-5.0.6_configure-no-sphinx-pdflatex-automagic.patch" + "${FILESDIR}/${PN}-5.0.7_configure-no-hyperscan-automagic.patch" + "${FILESDIR}/${PN}-6.0.0_default-config.patch" +) + +pkg_pretend() { + if use bpf && use kernel_linux; then + if kernel_is -lt 4 15; then + ewarn "Kernel 4.15 or newer is necessary to use all XDP features like the CPU redirect map" + fi + + CONFIG_CHECK="~XDP_SOCKETS" + ERROR_XDP_SOCKETS="CONFIG_XDP_SOCKETS is not set, making it impossible for Suricata to load XDP programs. " + ERROR_XDP_SOCKETS+="Other eBPF features should work normally." + check_extra_config + fi +} + +src_prepare() { + default + sed -ie 's/docdir =.*/docdir = ${datarootdir}\/doc\/'${PF}'\//' "${S}/doc/Makefile.am" || die + eautoreconf +} + +src_configure() { + # Bug #861242 + filter-lto + + local myeconfargs=( + "--localstatedir=/var" \ + "--runstatedir=/run" \ + "--enable-non-bundled-htp" \ + "--enable-gccmarch-native=no" \ + "--enable-python" \ + $(use_enable af-packet) \ + $(use_enable bpf ebpf) \ + $(use_enable control-socket unix-socket) \ + $(use_enable cuda) \ + $(use_enable detection) \ + $(use_enable geoip) \ + $(use_enable hardened gccprotect) \ + $(use_enable hardened pie) \ + $(use_enable hyperscan) \ + $(use_enable lz4) \ + $(use_enable nflog) \ + $(use_enable nfqueue) \ + $(use_enable redis hiredis) \ + $(use_enable test unittests) \ + "--disable-coccinelle" + ) + if use lua; then + if use lua_single_target_luajit; then + myeconfargs+=( --enable-luajit ) + else + myeconfargs+=( --enable-lua ) + fi + fi + + if use debug; then + myeconfargs+=( $(use_enable debug) ) + # so we can get a backtrace according to "reporting bugs" on upstream web site + CFLAGS="-ggdb -O0" econf ${myeconfargs[@]} + else + econf ${myeconfargs[@]} + fi +} + +src_install() { + emake DESTDIR="${D}" install + python_optimize + + if use bpf; then + rm -f ebpf/Makefile.{am,in} || die + dodoc -r ebpf/ + keepdir /usr/libexec/suricata/ebpf + fi + + insinto "/etc/${PN}" + doins etc/{classification,reference}.config threshold.config suricata.yaml + + keepdir "/var/lib/${PN}/rules" "/var/lib/${PN}/update" + keepdir "/var/log/${PN}" + + fowners -R ${PN}: "/var/lib/${PN}" "/var/log/${PN}" "/etc/${PN}" + fperms 750 "/var/lib/${PN}" "/var/log/${PN}" "/etc/${PN}" + fperms 2750 "/var/lib/${PN}/rules" "/var/lib/${PN}/update" + + newinitd "${FILESDIR}/${PN}.initd" ${PN} + newconfd "${FILESDIR}/${PN}.confd" ${PN} + systemd_dounit "${FILESDIR}"/${PN}.service + newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}.conf + + insopts -m0644 + insinto /etc/logrotate.d + newins etc/${PN}.logrotate ${PN} +} + +pkg_postinst() { + tmpfiles_process ${PN}.conf + + elog + if use systemd; then + elog "Suricata requires either the mode of operation (e.g. --af-packet) or the interface to listen on (e.g. -i eth0)" + elog "to be specified on the command line. The provided systemd unit launches Suricata in af-packet mode and relies" + elog "on file configuration to specify interfaces, should you prefer to run it differently you will have to customise" + elog "said unit. The simplest way of doing it is to override the Environment=OPTIONS='...' line using a .conf file" + elog "placed in the directory ${EPREFIX}/etc/systemd/system/suricata.service.d/ ." + elog "For details, see the section on drop-in directories in systemd.unit(5)." + else + elog "The ${PN} init script expects to find the path to the configuration" + elog "file as well as extra options in /etc/conf.d." + elog + elog "To create more than one ${PN} service, simply create a new .yaml file for it" + elog "then create a symlink to the init script from a link called" + elog "${PN}.foo - like so" + elog " cd /etc/${PN}" + elog " ${EDITOR##*/} suricata-foo.yaml" + elog " cd /etc/init.d" + elog " ln -s ${PN} ${PN}.foo" + elog "Then edit /etc/conf.d/${PN} and make sure you specify sensible options for foo." + elog + elog "You can create as many ${PN}.foo* services as you wish." + fi + + if use bpf; then + elog + elog "eBPF/XDP files must be compiled (using sys-devel/clang[llvm_targets_BPF]) before use" + elog "because their configuration is hard-coded. You can find the default ones in" + elog " ${EPREFIX}/usr/share/doc/${PF}/ebpf" + elog "and the common location for eBPF bytecode is" + elog " ${EPREFIX}/usr/libexec/${PN}" + elog "For more information, see https://${PN}.readthedocs.io/en/${P}/capture-hardware/ebpf-xdp.html" + fi + + if use debug; then + elog + elog "You have enabled the debug USE flag. Please read this link to report bugs upstream:" + elog "https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Reporting_Bugs" + elog "You need to also ensure the FEATURES variable in make.conf contains the" + elog "'nostrip' option to produce useful core dumps or back traces." + fi + + elog + if [[ -n "${REPLACING_VERSIONS}" ]]; then + ewarn "Since version 6.0.0 Suricata no longer supports the unified2 output format commonly used" + ewarn "in legacy, Snort-compatible IDS solutions, e.g. ones based on net-analyzer/barnyard2." + ewarn "If you need unified2 support, please continue to use suricata-5." + else + elog "To download and install an initial set of rules, run:" + elog " emerge --config =${CATEGORY}/${PF}" + fi + elog +} + +pkg_config() { + suricata-update +} diff --git a/net-analyzer/suricata/suricata-6.0.6.ebuild b/net-analyzer/suricata/suricata-6.0.6.ebuild deleted file mode 100644 index 751a280a7b5d..000000000000 --- a/net-analyzer/suricata/suricata-6.0.6.ebuild +++ /dev/null @@ -1,214 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -LUA_COMPAT=( lua5-1 luajit ) -PYTHON_COMPAT=( python3_{8..10} ) - -inherit autotools flag-o-matic linux-info lua-single python-single-r1 systemd tmpfiles - -DESCRIPTION="High performance Network IDS, IPS and Network Security Monitoring engine" -HOMEPAGE="https://suricata.io/" -SRC_URI="https://www.openinfosecfoundation.org/download/${P}.tar.gz" - -LICENSE="GPL-2" -SLOT="0/6" -KEYWORDS="~amd64 ~riscv ~x86" -IUSE="+af-packet bpf control-socket cuda debug +detection geoip hardened hyperscan lua lz4 nflog +nfqueue redis systemd test" - -RESTRICT="!test? ( test )" - -REQUIRED_USE="${PYTHON_REQUIRED_USE} - bpf? ( af-packet ) - lua? ( ${LUA_REQUIRED_USE} )" - -RDEPEND="${PYTHON_DEPS} - acct-group/suricata - acct-user/suricata - dev-libs/jansson:= - dev-libs/libpcre - dev-libs/libyaml - net-libs/libnet:* - net-libs/libnfnetlink - dev-libs/nspr - dev-libs/nss - $(python_gen_cond_dep ' - dev-python/pyyaml[${PYTHON_USEDEP}] - ') - >=net-libs/libhtp-0.5.40 - net-libs/libpcap - sys-apps/file - sys-libs/libcap-ng - bpf? ( >=dev-libs/libbpf-0.1.0 ) - cuda? ( dev-util/nvidia-cuda-toolkit ) - geoip? ( dev-libs/libmaxminddb:= ) - hyperscan? ( dev-libs/hyperscan ) - lua? ( ${LUA_DEPS} ) - lz4? ( app-arch/lz4 ) - nflog? ( net-libs/libnetfilter_log ) - nfqueue? ( net-libs/libnetfilter_queue ) - redis? ( dev-libs/hiredis:= )" -DEPEND="${RDEPEND} - >=sys-devel/autoconf-2.69-r5 - virtual/rust" - -PATCHES=( - "${FILESDIR}/${PN}-5.0.1_configure-no-lz4-automagic.patch" - "${FILESDIR}/${PN}-5.0.6_configure-no-sphinx-pdflatex-automagic.patch" - "${FILESDIR}/${PN}-5.0.7_configure-no-hyperscan-automagic.patch" - "${FILESDIR}/${PN}-6.0.0_default-config.patch" -) - -pkg_pretend() { - if use bpf && use kernel_linux; then - if kernel_is -lt 4 15; then - ewarn "Kernel 4.15 or newer is necessary to use all XDP features like the CPU redirect map" - fi - - CONFIG_CHECK="~XDP_SOCKETS" - ERROR_XDP_SOCKETS="CONFIG_XDP_SOCKETS is not set, making it impossible for Suricata to load XDP programs. " - ERROR_XDP_SOCKETS+="Other eBPF features should work normally." - check_extra_config - fi -} - -src_prepare() { - default - sed -ie 's/docdir =.*/docdir = ${datarootdir}\/doc\/'${PF}'\//' "${S}/doc/Makefile.am" || die - eautoreconf -} - -src_configure() { - # Bug #861242 - filter-lto - - local myeconfargs=( - "--localstatedir=/var" \ - "--runstatedir=/run" \ - "--enable-non-bundled-htp" \ - "--enable-gccmarch-native=no" \ - "--enable-python" \ - $(use_enable af-packet) \ - $(use_enable bpf ebpf) \ - $(use_enable control-socket unix-socket) \ - $(use_enable cuda) \ - $(use_enable detection) \ - $(use_enable geoip) \ - $(use_enable hardened gccprotect) \ - $(use_enable hardened pie) \ - $(use_enable hyperscan) \ - $(use_enable lz4) \ - $(use_enable nflog) \ - $(use_enable nfqueue) \ - $(use_enable redis hiredis) \ - $(use_enable test unittests) \ - "--disable-coccinelle" - ) - if use lua; then - if use lua_single_target_luajit; then - myeconfargs+=( --enable-luajit ) - else - myeconfargs+=( --enable-lua ) - fi - fi - - if use debug; then - myeconfargs+=( $(use_enable debug) ) - # so we can get a backtrace according to "reporting bugs" on upstream web site - CFLAGS="-ggdb -O0" econf ${myeconfargs[@]} - else - econf ${myeconfargs[@]} - fi -} - -src_install() { - emake DESTDIR="${D}" install - python_optimize - - if use bpf; then - rm -f ebpf/Makefile.{am,in} || die - dodoc -r ebpf/ - keepdir /usr/libexec/suricata/ebpf - fi - - insinto "/etc/${PN}" - doins etc/{classification,reference}.config threshold.config suricata.yaml - - keepdir "/var/lib/${PN}/rules" "/var/lib/${PN}/update" - keepdir "/var/log/${PN}" - - fowners -R ${PN}: "/var/lib/${PN}" "/var/log/${PN}" "/etc/${PN}" - fperms 750 "/var/lib/${PN}" "/var/log/${PN}" "/etc/${PN}" - fperms 2750 "/var/lib/${PN}/rules" "/var/lib/${PN}/update" - - newinitd "${FILESDIR}/${PN}-5.0.1-init" ${PN} - newconfd "${FILESDIR}/${PN}-5.0.1-conf" ${PN} - systemd_dounit "${FILESDIR}"/${PN}.service - newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}.conf - - insopts -m0644 - insinto /etc/logrotate.d - newins etc/${PN}.logrotate ${PN} -} - -pkg_postinst() { - tmpfiles_process ${PN}.conf - - elog - if use systemd; then - elog "Suricata requires either the mode of operation (e.g. --af-packet) or the interface to listen on (e.g. -i eth0)" - elog "to be specified on the command line. The provided systemd unit launches Suricata in af-packet mode and relies" - elog "on file configuration to specify interfaces, should you prefer to run it differently you will have to customise" - elog "said unit. The simplest way of doing it is to override the Environment=OPTIONS='...' line using a .conf file" - elog "placed in the directory ${EPREFIX}/etc/systemd/system/suricata.service.d/ ." - elog "For details, see the section on drop-in directories in systemd.unit(5)." - else - elog "The ${PN} init script expects to find the path to the configuration" - elog "file as well as extra options in /etc/conf.d." - elog - elog "To create more than one ${PN} service, simply create a new .yaml file for it" - elog "then create a symlink to the init script from a link called" - elog "${PN}.foo - like so" - elog " cd /etc/${PN}" - elog " ${EDITOR##*/} suricata-foo.yaml" - elog " cd /etc/init.d" - elog " ln -s ${PN} ${PN}.foo" - elog "Then edit /etc/conf.d/${PN} and make sure you specify sensible options for foo." - elog - elog "You can create as many ${PN}.foo* services as you wish." - fi - - if use bpf; then - elog - elog "eBPF/XDP files must be compiled (using sys-devel/clang[llvm_targets_BPF]) before use" - elog "because their configuration is hard-coded. You can find the default ones in" - elog " ${EPREFIX}/usr/share/doc/${PF}/ebpf" - elog "and the common location for eBPF bytecode is" - elog " ${EPREFIX}/usr/libexec/${PN}" - elog "For more information, see https://${PN}.readthedocs.io/en/${P}/capture-hardware/ebpf-xdp.html" - fi - - if use debug; then - elog - elog "You have enabled the debug USE flag. Please read this link to report bugs upstream:" - elog "https://redmine.openinfosecfoundation.org/projects/suricata/wiki/Reporting_Bugs" - elog "You need to also ensure the FEATURES variable in make.conf contains the" - elog "'nostrip' option to produce useful core dumps or back traces." - fi - - elog - if [[ -n "${REPLACING_VERSIONS}" ]]; then - ewarn "Since version 6.0.0 Suricata no longer supports the unified2 output format commonly used" - ewarn "in legacy, Snort-compatible IDS solutions, e.g. ones based on net-analyzer/barnyard2." - ewarn "If you need unified2 support, please continue to use suricata-5." - else - elog "To download and install an initial set of rules, run:" - elog " emerge --config =${CATEGORY}/${PF}" - fi - elog -} - -pkg_config() { - suricata-update -} -- cgit v1.2.3