From a18b38de4da36de0f470f7c79775dc38c094ab0d Mon Sep 17 00:00:00 2001 From: Wes Lambert Date: Sat, 19 Mar 2022 03:54:41 +0000 Subject: [PATCH] Update so-filebeat-module-setup to use new load style to avoid having to explicitly enabled filesets --- .../tools/sbin/so-filebeat-module-setup | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/salt/common/tools/sbin/so-filebeat-module-setup b/salt/common/tools/sbin/so-filebeat-module-setup index bb6ff86a6..c4133c217 100755 --- a/salt/common/tools/sbin/so-filebeat-module-setup +++ b/salt/common/tools/sbin/so-filebeat-module-setup @@ -49,19 +49,20 @@ if [ "$ELASTICSEARCH_CONNECTED" == "no" ]; then fi echo "Testing to see if the pipelines are already applied" ESVER=$({{ ELASTICCURL }} -sk https://"$ELASTICSEARCH_HOST":"$ELASTICSEARCH_PORT" |jq .version.number |tr -d \") -PIPELINES=$({{ ELASTICCURL }} -sk https://"$ELASTICSEARCH_HOST":"$ELASTICSEARCH_PORT"/_ingest/pipeline/filebeat-$ESVER-suricata-eve-pipeline | jq . | wc -c) +PIPELINES=$({{ ELASTICCURL }} -sk https://"$ELASTICSEARCH_HOST":"$ELASTICSEARCH_PORT"/_ingest/pipeline/filebeat-$ESVER-elasticsearch-server-pipeline | jq . | wc -c) -if [[ "$PIPELINES" -lt 5 ]]; then +if [[ "$PIPELINES" -lt 5 ]] || [ "$2" != "--force" ]; then echo "Setting up ingest pipeline(s)" - - for MODULE in activemq apache auditd aws azure barracuda bluecoat cef checkpoint cisco coredns crowdstrike cyberark cylance elasticsearch envoyproxy f5 fortinet gcp google_workspace googlecloud gsuite haproxy ibmmq icinga iis imperva infoblox iptables juniper kafka kibana logstash microsoft mongodb mssql mysql nats netscout nginx o365 okta osquery panw postgresql rabbitmq radware redis santa snort snyk sonicwall sophos squid suricata system threatintel tomcat traefik zeek zscaler - do - echo "Loading $MODULE" - docker exec -i so-filebeat filebeat setup modules -pipelines -modules $MODULE -c $FB_MODULE_YML - sleep 2 - done +{% from 'filebeat/modules.map.jinja' import MODULESMERGED with context %} +{% for module in MODULESMERGED.modules.keys() %} + {% for fileset in MODULESMERGED.modules[module] %} + {#% if MODULESMERGED.modules[module][fileset].get('enabled', False) %#} + echo "{{ module }}.{{ fileset}}" + docker exec -i so-filebeat filebeat setup --pipelines --modules {{ module }} -M "{{ module }}.{{ fileset }}.enabled=true" -c $FB_MODULE_YML + sleep 0.5 + {#% endif %#} + {% endfor %} +{% endfor %} else exit 0 fi - -