From 948d557b4a61dc14722668b6b11a4cf3cee07b01 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 13 Sep 2019 17:56:30 +0100 Subject: gentoo resync : 13.09.2019 --- net-analyzer/suricata/Manifest | 7 +- net-analyzer/suricata/files/suricata-4.0.3-conf | 62 --------- net-analyzer/suricata/files/suricata-4.0.3-init | 147 --------------------- net-analyzer/suricata/files/suricata-4.0.4-conf | 62 +++++++++ net-analyzer/suricata/files/suricata-4.0.4-init | 147 +++++++++++++++++++++ .../suricata/files/suricata-4.0.4_sockios.patch | 13 ++ net-analyzer/suricata/suricata-4.0.4.ebuild | 14 +- 7 files changed, 234 insertions(+), 218 deletions(-) delete mode 100644 net-analyzer/suricata/files/suricata-4.0.3-conf delete mode 100644 net-analyzer/suricata/files/suricata-4.0.3-init create mode 100644 net-analyzer/suricata/files/suricata-4.0.4-conf create mode 100644 net-analyzer/suricata/files/suricata-4.0.4-init create mode 100644 net-analyzer/suricata/files/suricata-4.0.4_sockios.patch (limited to 'net-analyzer/suricata') diff --git a/net-analyzer/suricata/Manifest b/net-analyzer/suricata/Manifest index ac025ccfe588..3f0225e9e3dc 100644 --- a/net-analyzer/suricata/Manifest +++ b/net-analyzer/suricata/Manifest @@ -1,7 +1,8 @@ -AUX suricata-4.0.3-conf 2767 BLAKE2B fe356820f57a8a7b068b66fd8c012c94a9bffdc8a62e2bd4a2210a9625778fa358a303bc770aeb4b1600ed8da5443533c50356ac4dfdabce6d0438ba246e1cd4 SHA512 fd3aec48b4e7e52f192af117f3cda063c5614f33082986dca4e3bdf7a46d62655cd03a1d723db9d36a1b1f84964dc2273e3bf00fb23648902639b18a64025d6b -AUX suricata-4.0.3-init 5499 BLAKE2B c2aece3a386d0ecf821e9d0e6bcb74efd97b90a71bad59a3e86f0f6a30702c711e7a287d1065745e73521c6f6cfaf5444b50b064fc06052dc33d8a6bc690f2da SHA512 ac407c70751a3610d9082b0736e76dfe04bd82014a5ac850b581c2e3c5806bb9d8fd59788cfaeabf51a856861a4568e31f9f1e33687623cc380ce226c0e06b92 +AUX suricata-4.0.4-conf 2767 BLAKE2B fe356820f57a8a7b068b66fd8c012c94a9bffdc8a62e2bd4a2210a9625778fa358a303bc770aeb4b1600ed8da5443533c50356ac4dfdabce6d0438ba246e1cd4 SHA512 fd3aec48b4e7e52f192af117f3cda063c5614f33082986dca4e3bdf7a46d62655cd03a1d723db9d36a1b1f84964dc2273e3bf00fb23648902639b18a64025d6b +AUX suricata-4.0.4-init 5496 BLAKE2B ea7922c300f3f42450e9c84b696a1389887ec062588a29cab201a70a2a2c1d52ce63d89642d85c584737594606ddc212d84632308de401504db80c60226872de SHA512 3b0294a0db38524f2a5126fb66000700cee2f1d10a10f35b5cb2a3598c4e41de72015719bbcf70da46f15505f2ac4b3afb2a4fa040fae68f0b1088ae40d5457b AUX suricata-4.0.4_configure-lua-flags.patch 502 BLAKE2B 14693f51888ba8d41a736a91065d1376e542d7c41d53dcc3ed9edd95d10f1db30a51d8b244154406a98338f844e67e2f836bcfc44bfa6dd6d0ffc19332c6a2c0 SHA512 a1be159aa592f2121b5e3fde70485e6a502cdfbd15fc76056e6ca1401a94ab7eddf1639728fa402f754ca546229aa5fd6fc05c243be761475c9249a7206b2830 +AUX suricata-4.0.4_sockios.patch 298 BLAKE2B 2a3fd2b8ace6363f90ad52f2f9802cd9565d3aabcc1d5fec4b2b0b9690110d7b28fa8d6be39d357b9dded7f2f09ba9b21e3837d92cac42483e0015ef76669ec8 SHA512 416cc3ff7636f7938e35a449bea41d2f4a02dacb80dce0821091db690279f966ef048a036a4b47b9f9208039b9103366500afcd0d6b3e85d8fe96372a0b3921a AUX suricata-logrotate 161 BLAKE2B d55edb7e36cc27819b6fba26778eff3cc66bfc5c04877e36e27ef9adcf3f003c10cff787b317e00a32a4c764c2180f90c9abd3f81e877d73bd2c892d5ca2d161 SHA512 c22a85667460df9b7b1fd15af1e4472dd5b7d1726a43f3b621547a884dcd64ff49b0728767d6a4dc70c413dd8997905e3753fa94c82cda34e4aaf903ebdb1cec DIST suricata-4.0.4.tar.gz 12511121 BLAKE2B d9dfb00a45c2e9810409a8ce91a83e23ebce20eb28492bf24f9688d292b5805dca932c39cc673cf1148325fe5ef7936dda7f6c7819605753cb2e2ddc1cf5dba0 SHA512 6e158aa6d3edb9d11e0df3f986392ee2ae49ab4dfb978288ced4484dbe5c08ae061db2a566be6d22cf14bd0b88f87f9cb9c0a657d7fc44e099b8783d933c771e -EBUILD suricata-4.0.4.ebuild 4628 BLAKE2B 734f3ca0c4aeb9ec7bfd820c8192c422966c43c2390eac49c50a507587fbb570e1e5f8d7ae62347539f464d73b3e4827ef5747dae8522373ab20cca28dfb8932 SHA512 4e361bdfb9fd716f1c10444247f3c788536d73d601cbc3b3b7c59f5923634cf20d3aed9d06fac9759233cd5dc2816015aaf9a21e53eecc03e6b12a1294e6e866 +EBUILD suricata-4.0.4.ebuild 4744 BLAKE2B 03ad9be14e12649c8e50752e31d151ad9b97b968b8caf2305d958c9d68407d59b723e5b318ad7850c71b17d5aaebb07d865f6b81748148f2297311d531423c61 SHA512 0988822e3a3689d7ff0e7cb239f9c2504f5c693789b859777bb2eb5e0ce3c906ca1effb794905d7106093fdc80b3027d351434dda0528a2fc8e1e61e8a3dd720 MISC metadata.xml 775 BLAKE2B faf442e43b5388b3a24b57ee3aa73ea22eb0f230bd7bfbdee98bc4ec0be260f52f47cf7caa67d44d3498cdba58e18c487741a295149c64cf2b4631a141537e8a SHA512 e9407a4c043553a31b1a66c6b45d352444368567eef3bfa4af26e64bb84a70a81bcc7a21e48dba7e532a3115c7086932e22b75a05b00ba1f84b59d4d7ec187c6 diff --git a/net-analyzer/suricata/files/suricata-4.0.3-conf b/net-analyzer/suricata/files/suricata-4.0.3-conf deleted file mode 100644 index 655b947fdd9b..000000000000 --- a/net-analyzer/suricata/files/suricata-4.0.3-conf +++ /dev/null @@ -1,62 +0,0 @@ -# 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="-i eth0" - -# 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-4.0.3-init b/net-analyzer/suricata/files/suricata-4.0.3-init deleted file mode 100644 index f54ba3a5e23b..000000000000 --- a/net-analyzer/suricata/files/suricata-4.0.3-init +++ /dev/null @@ -1,147 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2018 Gentoo Foundation -# 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="/var/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="/var/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 "/var/run/suricata" ] ; then - checkpath -d /var/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/files/suricata-4.0.4-conf b/net-analyzer/suricata/files/suricata-4.0.4-conf new file mode 100644 index 000000000000..655b947fdd9b --- /dev/null +++ b/net-analyzer/suricata/files/suricata-4.0.4-conf @@ -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="-i eth0" + +# 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-4.0.4-init b/net-analyzer/suricata/files/suricata-4.0.4-init new file mode 100644 index 000000000000..1db8137f31a4 --- /dev/null +++ b/net-analyzer/suricata/files/suricata-4.0.4-init @@ -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="/var/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="/var/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 "/var/run/suricata" ] ; then + checkpath -d /var/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/files/suricata-4.0.4_sockios.patch b/net-analyzer/suricata/files/suricata-4.0.4_sockios.patch new file mode 100644 index 000000000000..a341d9c159f1 --- /dev/null +++ b/net-analyzer/suricata/files/suricata-4.0.4_sockios.patch @@ -0,0 +1,13 @@ +--- src/source-af-packet.c.orig 2019-09-08 20:50:06.416466432 +0200 ++++ src/source-af-packet.c 2019-09-08 20:53:26.144471385 +0200 +@@ -70,6 +70,10 @@ + + #ifdef HAVE_AF_PACKET + ++#ifdef HAVE_LINUX_SOCKIOS_H ++#include ++#endif ++ + #if HAVE_SYS_IOCTL_H + #include + #endif diff --git a/net-analyzer/suricata/suricata-4.0.4.ebuild b/net-analyzer/suricata/suricata-4.0.4.ebuild index 2622dccdb3b7..98ed94d5b7d5 100644 --- a/net-analyzer/suricata/suricata-4.0.4.ebuild +++ b/net-analyzer/suricata/suricata-4.0.4.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2018 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=5 @@ -46,7 +46,9 @@ pkg_setup() { } src_prepare() { - epatch "${FILESDIR}"/${P}_configure-lua-flags.patch + epatch "${FILESDIR}/${P}_configure-lua-flags.patch" + epatch "${FILESDIR}/${P}_sockios.patch" + sed -ie 's/docdir =.*/docdir = ${datarootdir}\/doc\/'${PF}'\//' "${S}/doc/Makefile.am" eautoreconf } @@ -124,14 +126,14 @@ src_install() { doins rules/*.rules fi - dodir "/var/lib/${PN}" - dodir "/var/log/${PN}" + keepdir "/var/lib/${PN}" + 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}" - newinitd "${FILESDIR}/${PN}-4.0.3-init" ${PN} - newconfd "${FILESDIR}/${PN}-4.0.3-conf" ${PN} + newinitd "${FILESDIR}/${P}-init" ${PN} + newconfd "${FILESDIR}/${P}-conf" ${PN} if use logrotate; then insopts -m0644 -- cgit v1.2.3