mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
FileBeat Module - Add Filebeat with config
This commit is contained in:
1442
salt/filebeat/etc/filebeat.yml
Normal file
1442
salt/filebeat/etc/filebeat.yml
Normal file
File diff suppressed because it is too large
Load Diff
44
salt/filebeat/init.sls
Normal file
44
salt/filebeat/init.sls
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# Copyright 2014,2015,2016,2017,2018 Security Onion Solutions, LLC
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
{% set lsaccessip = salt['pillar.get']('master:lsaccessip', '') %}
|
||||||
|
|
||||||
|
# Redis Setup
|
||||||
|
filebeatconfdir:
|
||||||
|
file.directory:
|
||||||
|
- name: /opt/so/conf/filebeat
|
||||||
|
- user: 939
|
||||||
|
- group: 939
|
||||||
|
- makedirs: True
|
||||||
|
|
||||||
|
filebeatconfsync:
|
||||||
|
file.recurse:
|
||||||
|
- name: /opt/so/conf/filebeat/etc
|
||||||
|
- source: salt://filebeat/etc
|
||||||
|
- user: 939
|
||||||
|
- group: 939
|
||||||
|
- template: jinja
|
||||||
|
|
||||||
|
docker.elastic.co/beats/filebeat:6.2.4:
|
||||||
|
docker_image.present
|
||||||
|
|
||||||
|
so-filebeat:
|
||||||
|
docker_container.running:
|
||||||
|
- image: docker.elastic.co/beats/filebeat:6.2.4
|
||||||
|
- hostname: so-filebeat
|
||||||
|
- binds:
|
||||||
|
- /opt/so/log/filebeat:/var/log/filebeat:rw
|
||||||
|
- /opt/so/conf/redis/etc/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
|
||||||
|
- /nsm/bro/spool:/nsm/bro/spool:ro
|
||||||
|
- network_mode: so-elastic-net
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
DIR=/etc/filebeat
|
|
||||||
YML=$DIR/filebeat.yml
|
|
||||||
|
|
||||||
mkdir -p $DIR
|
|
||||||
|
|
||||||
cat << EOF > $YML
|
|
||||||
filebeat.prospectors:
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# For each Bro log type, watch current and import
|
|
||||||
grep "source(s_bro_" /etc/syslog-ng/syslog-ng.conf |cut -d\( -f2 | cut -d\) -f1 | sed 's|s_bro_||g' |sort -u | while read LOG; do
|
|
||||||
cat << EOF
|
|
||||||
- type: log
|
|
||||||
paths:
|
|
||||||
- /nsm/bro/logs/current/$LOG*.log
|
|
||||||
fields:
|
|
||||||
type: bro_$LOG
|
|
||||||
fields_under_root: true
|
|
||||||
tags: ["bro"]
|
|
||||||
clean_removed: false
|
|
||||||
close_removed: false
|
|
||||||
|
|
||||||
- type: log
|
|
||||||
paths:
|
|
||||||
- /nsm/import/bro/$LOG*.log
|
|
||||||
fields:
|
|
||||||
type: bro_$LOG
|
|
||||||
fields_under_root: true
|
|
||||||
tags: ["bro", "import"]
|
|
||||||
clean_removed: false
|
|
||||||
close_removed: false
|
|
||||||
|
|
||||||
EOF
|
|
||||||
done >> $YML
|
|
||||||
|
|
||||||
# Change tunnels.log to tunnel.log
|
|
||||||
sed -i 's|tunnels\*.log|tunnel*.log|g' $YML
|
|
||||||
|
|
||||||
# Output to logstash
|
|
||||||
cat << EOF >> $YML
|
|
||||||
output.logstash:
|
|
||||||
enabled: true
|
|
||||||
hosts: ["logstash:5044"]
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# syslog-ng doesn't need to monitor Bro logs anymore
|
|
||||||
grep -v "source(s_bro_" /etc/syslog-ng/syslog-ng.conf > /etc/syslog-ng/syslog-ng.conf.without.bro
|
|
||||||
mv /etc/syslog-ng/syslog-ng.conf /etc/syslog-ng/syslog-ng.conf.with.bro
|
|
||||||
mv /etc/syslog-ng/syslog-ng.conf.without.bro /etc/syslog-ng/syslog-ng.conf
|
|
||||||
service syslog-ng restart
|
|
||||||
|
|
||||||
# start filebeat and allow it to connect to logstash
|
|
||||||
docker run --detach --name so-filebeat -v /etc/filebeat/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro -v /nsm/bro:/nsm/bro:ro docker.elastic.co/beats/filebeat:6.2.1
|
|
||||||
docker network connect --alias filebeat so-elastic-net so-filebeat
|
|
||||||
@@ -4,6 +4,7 @@ base:
|
|||||||
- pcap
|
- pcap
|
||||||
- suricata
|
- suricata
|
||||||
- bro
|
- bro
|
||||||
|
- filebeat
|
||||||
|
|
||||||
'G@role:eval':
|
'G@role:eval':
|
||||||
- common
|
- common
|
||||||
|
|||||||
@@ -424,6 +424,7 @@ sensor_pillar() {
|
|||||||
echo " brobpf:" >> $TMP/$HOSTNAME.sls
|
echo " brobpf:" >> $TMP/$HOSTNAME.sls
|
||||||
echo " pcapbpf:" >> $TMP/$HOSTNAME.sls
|
echo " pcapbpf:" >> $TMP/$HOSTNAME.sls
|
||||||
echo " nidsbpf:" >> $TMP/$HOSTNAME.sls
|
echo " nidsbpf:" >> $TMP/$HOSTNAME.sls
|
||||||
|
echo " master: $MSRV" >> $TMP/$HOSTNAME.sls
|
||||||
echo " homenet: $HNSENSOR" >> $TMP/$HOSTNAME.sls
|
echo " homenet: $HNSENSOR" >> $TMP/$HOSTNAME.sls
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user