diff --git a/pillar/logstash/eval.sls b/pillar/logstash/eval.sls new file mode 100644 index 000000000..654afd2b3 --- /dev/null +++ b/pillar/logstash/eval.sls @@ -0,0 +1,4 @@ +logstash: + pipelines: + eval: + config: "/usr/share/logstash/pipelines/eval/*.conf" diff --git a/pillar/logstash/mastersearch.sls b/pillar/logstash/master.sls similarity index 56% rename from pillar/logstash/mastersearch.sls rename to pillar/logstash/master.sls index 2fbc5be5f..3be98f6b9 100644 --- a/pillar/logstash/mastersearch.sls +++ b/pillar/logstash/master.sls @@ -2,5 +2,3 @@ logstash: pipelines: master: config: "/usr/share/logstash/pipelines/master/*.conf" - search: - config: "/usr/share/logstash/pipelines/search/*.conf" diff --git a/pillar/logstash/search.sls b/pillar/logstash/search.sls new file mode 100644 index 000000000..0eca8571f --- /dev/null +++ b/pillar/logstash/search.sls @@ -0,0 +1,4 @@ +logstash: + pipelines: + search: + config: "/usr/share/logstash/pipelines/search/*.conf" diff --git a/pillar/top.sls b/pillar/top.sls index 99fe26556..8b604283e 100644 --- a/pillar/top.sls +++ b/pillar/top.sls @@ -2,8 +2,10 @@ base: '*': - patch.needs_restarting - 'G@role:so-mastersearch': - - logstash.mastersearch + 'G@role:so-mastersearch or G@role:so-heavynode': + - match: compound + - logstash.master + - logstash.search 'G@role:so-sensor': - static @@ -19,12 +21,16 @@ base: - auth - minions.{{ grains.id }} + 'G@role:so-master': + - logstash.master + 'G@role:so-eval': - static - firewall.* - data.* - brologs - auth + - logstash.eval - minions.{{ grains.id }} 'G@role:so-node': @@ -32,6 +38,12 @@ base: - firewall.* - minions.{{ grains.id }} + 'G@role:so-heavynode': + - static + - firewall.* + - brologs + - minions.{{ grains.id }} + 'G@role:so-helix': - static - firewall.* diff --git a/salt/auth/init.sls b/salt/auth/init.sls index c59a70ba0..18850d534 100644 --- a/salt/auth/init.sls +++ b/salt/auth/init.sls @@ -1,4 +1,4 @@ -{% set VERSION = salt['pillar.get']('static:soversion', '1.1.4') %} +{% set VERSION = salt['pillar.get']('static:soversion', 'HH1.1.4') %} {% set MASTER = salt['grains.get']('master') %} so-auth-api-dir: @@ -10,7 +10,7 @@ so-auth-api-dir: so-auth-api: docker_container.running: - - image: {{ MASTER }}:5000/soshybridhunter/so-auth-api:HH{{ VERSION }} + - image: {{ MASTER }}:5000/soshybridhunter/so-auth-api:{{ VERSION }} - hostname: so-auth-api - name: so-auth-api - environment: @@ -22,7 +22,7 @@ so-auth-api: so-auth-ui: docker_container.running: - - image: {{ MASTER }}:5000/soshybridhunter/so-auth-ui:HH{{ VERSION }} + - image: {{ MASTER }}:5000/soshybridhunter/so-auth-ui:{{ VERSION }} - hostname: so-auth-ui - name: so-auth-ui - port_bindings: diff --git a/salt/common/grafana/grafana_dashboards/eval/eval.json b/salt/common/grafana/grafana_dashboards/eval/eval.json index 8dd5532d1..069226d3c 100644 --- a/salt/common/grafana/grafana_dashboards/eval/eval.json +++ b/salt/common/grafana/grafana_dashboards/eval/eval.json @@ -1395,7 +1395,7 @@ "condition": "AND", "key": "container_name", "operator": "=", - "value": "so-bro" + "value": "so-zeek" } ] } @@ -1913,7 +1913,7 @@ "condition": "AND", "key": "container_name", "operator": "=", - "value": "so-bro" + "value": "so-zeek" } ] } diff --git a/salt/common/grafana/grafana_dashboards/forward_nodes/sensor.json b/salt/common/grafana/grafana_dashboards/forward_nodes/sensor.json index 83a1fc9e6..8e35246eb 100644 --- a/salt/common/grafana/grafana_dashboards/forward_nodes/sensor.json +++ b/salt/common/grafana/grafana_dashboards/forward_nodes/sensor.json @@ -1396,7 +1396,7 @@ "condition": "AND", "key": "container_name", "operator": "=", - "value": "so-bro" + "value": "so-zeek" } ] } @@ -1901,7 +1901,7 @@ "condition": "AND", "key": "container_name", "operator": "=", - "value": "so-bro" + "value": "so-zeek" } ] } diff --git a/salt/common/init.sls b/salt/common/init.sls index 7ed59efa1..4ae78f57b 100644 --- a/salt/common/init.sls +++ b/salt/common/init.sls @@ -1,6 +1,6 @@ {% set VERSION = salt['pillar.get']('static:soversion', 'HH1.1.4') %} {% set MASTER = salt['grains.get']('master') %} -{%- set GRAFANA = salt['pillar.get']('master:grafana', '0') %} +{% set GRAFANA = salt['pillar.get']('master:grafana', '0') %} # Add socore Group socoregroup: group.present: @@ -343,7 +343,7 @@ dashboard-{{ SN }}: {% if salt['pillar.get']('nodestab', False) %} {%- for SN, SNDATA in salt['pillar.get']('nodestab', {}).items() %} -dashboard-{{ SN }}: +dashboardsearch-{{ SN }}: file.managed: - name: /opt/so/conf/grafana/grafana_dashboards/search_nodes/{{ SN }}-Node.json - user: 939 diff --git a/salt/common/nginx/nginx.conf.so-heavynode b/salt/common/nginx/nginx.conf.so-heavynode new file mode 100644 index 000000000..39688f3df --- /dev/null +++ b/salt/common/nginx/nginx.conf.so-heavynode @@ -0,0 +1,89 @@ +# For more information on configuration, see: +# * Official English Documentation: http://nginx.org/en/docs/ +# * Official Russian Documentation: http://nginx.org/ru/docs/ + +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +# Load dynamic modules. See /usr/share/nginx/README.dynamic. +include /usr/share/nginx/modules/*.conf; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # Load modular configuration files from the /etc/nginx/conf.d directory. + # See http://nginx.org/en/docs/ngx_core_module.html#include + # for more information. + include /etc/nginx/conf.d/*.conf; + + server { + listen 80 default_server; + listen [::]:80 default_server; + server_name _; + root /usr/share/nginx/html; + + # Load configuration files for the default server block. + include /etc/nginx/default.d/*.conf; + + location / { + } + + error_page 404 /404.html; + location = /40x.html { + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + } + } + +# Settings for a TLS enabled server. +# +# server { +# listen 443 ssl http2 default_server; +# listen [::]:443 ssl http2 default_server; +# server_name _; +# root /usr/share/nginx/html; +# +# ssl_certificate "/etc/pki/nginx/server.crt"; +# ssl_certificate_key "/etc/pki/nginx/private/server.key"; +# ssl_session_cache shared:SSL:1m; +# ssl_session_timeout 10m; +# ssl_ciphers HIGH:!aNULL:!MD5; +# ssl_prefer_server_ciphers on; +# +# # Load configuration files for the default server block. +# include /etc/nginx/default.d/*.conf; +# +# location / { +# } +# +# error_page 404 /404.html; +# location = /40x.html { +# } +# +# error_page 500 502 503 504 /50x.html; +# location = /50x.html { +# } +# } + +} diff --git a/salt/common/telegraf/scripts/broloss.sh b/salt/common/telegraf/scripts/broloss.sh index a7bec4dc1..9fcf2d527 100644 --- a/salt/common/telegraf/scripts/broloss.sh +++ b/salt/common/telegraf/scripts/broloss.sh @@ -1,7 +1,7 @@ #!/bin/bash -BROLOG=$(tac /host/nsm/bro/logs/packetloss.log | head -2) -declare RESULT=($BROLOG) +ZEEKLOG=$(tac /host/nsm/zeek/logs/packetloss.log | head -2) +declare RESULT=($ZEEKLOG) CURRENTDROP=${RESULT[3]} PASTDROP=${RESULT[9]} DROPPED=$(($CURRENTDROP - $PASTDROP)) diff --git a/salt/common/tools/sbin/so-bro-restart b/salt/common/tools/sbin/so-bro-restart deleted file mode 100644 index f71de5b91..000000000 --- a/salt/common/tools/sbin/so-bro-restart +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Copyright 2014,2015,2016,2017,2018,2019,2020 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 . - -. /usr/sbin/so-common - -docker stop so-bro && docker rm so-bro && salt-call state.apply bro diff --git a/salt/common/tools/sbin/so-bro-start b/salt/common/tools/sbin/so-bro-start deleted file mode 100644 index 3240b86e9..000000000 --- a/salt/common/tools/sbin/so-bro-start +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Copyright 2014,2015,2016,2017,2018,2019,2020 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 . - -. /usr/sbin/so-common - -docker rm so-bro && salt-call state.apply bro diff --git a/salt/common/tools/sbin/so-bro-stop b/salt/common/tools/sbin/so-bro-stop deleted file mode 100644 index 8cfdddc3c..000000000 --- a/salt/common/tools/sbin/so-bro-stop +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# Copyright 2014,2015,2016,2017,2018,2019,2020 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 . - -. /usr/sbin/so-common - -docker stop so-bro diff --git a/salt/common/tools/sbin/so-elastic-clear b/salt/common/tools/sbin/so-elastic-clear index 79c7e99ad..2db400839 100644 --- a/salt/common/tools/sbin/so-elastic-clear +++ b/salt/common/tools/sbin/so-elastic-clear @@ -14,6 +14,7 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . +{%- set MASTERIP = salt['pillar.get']('static:masterip', '') -%} . /usr/sbin/so-common SKIP=0 diff --git a/salt/common/tools/sbin/so-restart b/salt/common/tools/sbin/so-restart index 94137ddb4..bbcfe4c20 100644 --- a/salt/common/tools/sbin/so-restart +++ b/salt/common/tools/sbin/so-restart @@ -31,5 +31,6 @@ fi case $1 in "cortex") docker stop so-thehive-cortex so-thehive && docker rm so-thehive-cortex so-thehive && salt-call state.apply hive queue=True;; + "steno") docker stop so-steno && docker rm so-steno && salt-call state.apply pcap queue=True;; *) docker stop so-$1 ; docker rm so-$1 ; salt-call state.apply $1 queue=True;; esac diff --git a/salt/common/tools/sbin/so-salt-start b/salt/common/tools/sbin/so-salt-start new file mode 100644 index 000000000..c53a71535 --- /dev/null +++ b/salt/common/tools/sbin/so-salt-start @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright 2014,2015,2016,2017,2018,2019,2020 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 . + +. /usr/sbin/so-common + +echo $banner +printf "Starting local Salt Minion...\n" +echo $banner + +service salt-minion start +service salt-minion status diff --git a/salt/common/tools/sbin/so-salt-stop b/salt/common/tools/sbin/so-salt-stop new file mode 100644 index 000000000..fa3394cd6 --- /dev/null +++ b/salt/common/tools/sbin/so-salt-stop @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Copyright 2014,2015,2016,2017,2018,2019,2020 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 . + +. /usr/sbin/so-common + +echo $banner +printf "Stopping local Salt Minion...\n" +echo $banner + +service salt-minion stop +service salt-minion status diff --git a/salt/common/tools/sbin/so-start b/salt/common/tools/sbin/so-start index f5e861818..a198377a1 100644 --- a/salt/common/tools/sbin/so-start +++ b/salt/common/tools/sbin/so-start @@ -29,8 +29,8 @@ then salt-call saltutil.kill_all_jobs fi - case $1 in "all") salt-call state.highstate queue=True;; - *) if docker ps | grep -q so-$1; then printf "\n$1 is already running!\n\n"; else docker rm so-$1 >/dev/null 2>&1 ; salt-call state.apply $1 queue=True; fi + "steno") if docker ps | grep -q so-$1; then printf "\n$1 is already running!\n\n"; else docker rm so-$1 >/dev/null 2>&1 ; salt-call state.apply pcap queue=True; fi ;; + *) if docker ps | grep -q so-$1; then printf "\n$1 is already running\n\n"; else docker rm so-$1 >/dev/null 2>&1 ; salt-call state.apply $1 queue=True; fi ;; esac diff --git a/salt/common/tools/sbin/so-status b/salt/common/tools/sbin/so-status new file mode 100644 index 000000000..45b52ae35 --- /dev/null +++ b/salt/common/tools/sbin/so-status @@ -0,0 +1,141 @@ +#!/bin/bash + +# Copyright 2014,2015,2016,2017,2018,2019,2020 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 . + +# {% raw %} + +if ! [ $(id -u)=0 ]; then + echo "This command must be run as root" + exit 1 +fi + +# Constants +ERROR_STRING="ERROR" +SUCCESS_STRING="OK" +PENDING_STRING="PENDING" +declare -a BAD_STATUSES=("removing", "paused", "exited", "dead") +declare -a PENDING_STATUSES=("paused", "created", "restarting") +declare -a GOOD_STATUSES=("running") + + +declare -a container_name_list=() +declare -a container_state_list=() +populate_container_lists() { + systemctl is-active --quiet docker + + if [[ $? = 0 ]]; then + mapfile -t docker_raw_list < <(curl -s --unix-socket /var/run/docker.sock http:/containers/json?all=1 \ + | jq -c '.[] | { Name: .Names[0], State: .State }' \ + | tr -d '/{"}') + else + exit 1 + fi + + local container_name="" + local container_state="" + + for line in ${docker_raw_list[@]}; do + container_name="$( echo $line | sed -e 's/Name:\(.*\),State:\(.*\)/\1/' )" # Get value in the first search group (container names) + container_state="$( echo $line | sed -e 's/Name:\(.*\),State:\(.*\)/\2/' )" # Get value in the second search group (container states) + container_name_list+=( "${container_name}" ) + container_state_list+=( "${container_state}" ) + done +} + +parse_status() { + local container_state=${1} + local found=0 + + for state in "${GOOD_STATUSES[@]}"; do + [[ $container_state = $state ]] && printf $SUCCESS_STRING && return 0 + done + + if [[ $found = 0 ]]; then + for state in "${PENDING_STATUSES[@]}"; do + [[ $container_state = $state ]] && printf $PENDING_STRING && return 0 + done + fi + + # This is technically not needed since the default is error state + if [[ $found = 0 ]]; then + for state in "${BAD_STATUSES[@]}"; do + [[ $container_state = $state ]] && printf $ERROR_STRING && return 1 + done + fi + + printf $ERROR_STRING && return 1 +} + +columns=$(tput cols) + +print_line() { + local service_name=${1} + local service_state=$( parse_status ${2} ) + local PADDING_CONSTANT=14 + local state_color="\e[0m" + + if [[ $service_state = $ERROR_STRING ]]; then + state_color="\e[1;31m" + elif [[ $service_state = $SUCCESS_STRING ]]; then + state_color="\e[1;32m" + elif [[ $service_state = $PENDING_STRING ]]; then + state_color="\e[1;33m" + else + state_color="\e[0m" + fi + + printf " $service_name " + for i in $(seq 0 $(( $columns - $PADDING_CONSTANT - ${#service_name} - ${#service_state} ))); do + printf "-" + done + printf " [ " + printf "${state_color}%b\e[0m" "$service_state" + printf "%s \n" " ]" +} + +main() { + local focus_color="\e[1;34m" + printf "\n" + printf "${focus_color}%b\e[0m" "Checking Docker status\n\n" + + systemctl is-active --quiet docker + if [[ $? = 0 ]]; then + print_line "Docker" "running" + else + print_line "Docker" "exited" + fi + + populate_container_lists + + printf "\n" + + printf "${focus_color}%b\e[0m" "Checking container statuses\n\n" + + + local num_containers=${#docker_raw_list[@]} + local container_name="" + local container_state="" + + for i in $(seq 0 $(($num_containers - 1 ))); do + print_line ${container_name_list[$i]} ${container_state_list[$i]} + done + + printf "\n" +} + +main + +# {% endraw %} \ No newline at end of file diff --git a/salt/common/tools/sbin/so-suricata-restart b/salt/common/tools/sbin/so-suricata-restart index 0fabe198c..151e1a44c 100644 --- a/salt/common/tools/sbin/so-suricata-restart +++ b/salt/common/tools/sbin/so-suricata-restart @@ -1,17 +1,20 @@ #!/bin/bash - -# Copyright 2014,2015,2016,2017,2018, 2019 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. +# Copyright 2014,2015,2016,2017,2018,2019,2020 Security Onion Solutions, LLC # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -docker stop so-suricata && sudo docker rm so-suricata && salt-call state.apply suricata +# 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 . + +. /usr/sbin/so-common + +/usr/sbin/so-restart suricata $1 diff --git a/salt/common/tools/sbin/so-suricata-start b/salt/common/tools/sbin/so-suricata-start index dd9bd8df9..9e04eedfb 100644 --- a/salt/common/tools/sbin/so-suricata-start +++ b/salt/common/tools/sbin/so-suricata-start @@ -1,17 +1,20 @@ #!/bin/bash - -# Copyright 2014,2015,2016,2017,2018, 2019 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. +# Copyright 2014,2015,2016,2017,2018,2019,2020 Security Onion Solutions, LLC # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -docker rm so-suricata && salt-call state.apply suricata +# 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 . + +. /usr/sbin/so-common + +/usr/sbin/so-start suricata $1 diff --git a/salt/common/tools/sbin/so-suricata-stop b/salt/common/tools/sbin/so-suricata-stop index 8f0383164..7581f9c00 100644 --- a/salt/common/tools/sbin/so-suricata-stop +++ b/salt/common/tools/sbin/so-suricata-stop @@ -1,17 +1,20 @@ #!/bin/bash - -# Copyright 2014,2015,2016,2017,2018, 2019 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. +# Copyright 2014,2015,2016,2017,2018,2019,2020 Security Onion Solutions, LLC # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -docker stop so-suricata +# 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 . + +. /usr/sbin/so-common + +/usr/sbin/so-stop suricata $1 diff --git a/salt/common/tools/sbin/so-tcpreplay b/salt/common/tools/sbin/so-tcpreplay index 4b861890a..349bb6e84 100755 --- a/salt/common/tools/sbin/so-tcpreplay +++ b/salt/common/tools/sbin/so-tcpreplay @@ -15,14 +15,16 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Usage: so-tcpreplay "/opt/so/samples/*" + REPLAY_ENABLED=$(docker images | grep so-tcpreplay) REPLAY_RUNNING=$(docker ps | grep so-tcpreplay) if [ "$REPLAY_ENABLED" != "" ] && [ "$REPLAY_RUNNING" != "" ]; then docker cp so-tcpreplay:/opt/samples /opt/samples - docker exec -it so-tcpreplay /usr/bin/tcpreplay -i bond0 -M10 $1 + docker exec -it so-tcpreplay /usr/local/bin/tcpreplay -i bond0 -M10 $1 else echo "Replay functionality not enabled! To enable, run `so-tcpreplay-start`" echo - echo "Note that you will need internet access to download the appropiriate components" + echo "Note that you will need internet access to download the appropriate components" fi diff --git a/salt/common/tools/sbin/so-tcpreplay-restart b/salt/common/tools/sbin/so-tcpreplay-restart index 1a1ac971b..28230c600 100755 --- a/salt/common/tools/sbin/so-tcpreplay-restart +++ b/salt/common/tools/sbin/so-tcpreplay-restart @@ -17,5 +17,5 @@ . /usr/sbin/so-common -/usr/sbin/so-restart tcreplay $1 +/usr/sbin/so-restart tcpreplay $1 diff --git a/salt/common/tools/sbin/so-zeek-restart b/salt/common/tools/sbin/so-zeek-restart index fae36d8f9..51d90e924 100644 --- a/salt/common/tools/sbin/so-zeek-restart +++ b/salt/common/tools/sbin/so-zeek-restart @@ -17,4 +17,4 @@ . /usr/sbin/so-common -/usr/sbin/so-restart bro $1 +/usr/sbin/so-restart zeek $1 diff --git a/salt/common/tools/sbin/so-zeek-start b/salt/common/tools/sbin/so-zeek-start index 595fdb24b..b3190c319 100644 --- a/salt/common/tools/sbin/so-zeek-start +++ b/salt/common/tools/sbin/so-zeek-start @@ -17,4 +17,4 @@ . /usr/sbin/so-common -/usr/sbin/so-start bro $1 +/usr/sbin/so-start zeek $1 diff --git a/salt/common/tools/sbin/so-zeek-stop b/salt/common/tools/sbin/so-zeek-stop index 1b995e854..d57c91c2f 100644 --- a/salt/common/tools/sbin/so-zeek-stop +++ b/salt/common/tools/sbin/so-zeek-stop @@ -17,4 +17,4 @@ . /usr/sbin/so-common -/usr/sbin/so-stop bro $1 +/usr/sbin/so-stop zeek $1 diff --git a/salt/bro/cron/packetloss.sh b/salt/deprecated-bro/cron/packetloss.sh similarity index 100% rename from salt/bro/cron/packetloss.sh rename to salt/deprecated-bro/cron/packetloss.sh diff --git a/salt/bro/cron/zeek_clean b/salt/deprecated-bro/cron/zeek_clean similarity index 100% rename from salt/bro/cron/zeek_clean rename to salt/deprecated-bro/cron/zeek_clean diff --git a/salt/bro/files/local.bro b/salt/deprecated-bro/files/local.bro similarity index 98% rename from salt/bro/files/local.bro rename to salt/deprecated-bro/files/local.bro index 42112f7ee..afe4b94ca 100644 --- a/salt/bro/files/local.bro +++ b/salt/deprecated-bro/files/local.bro @@ -102,6 +102,9 @@ # is currently considered a preview and therefore not loaded by default. @load base/protocols/smb +# BPF Configuration +@load securityonion/bpfconf + # Add the interface to the log event #@load securityonion/add-interface-to-logs.bro diff --git a/salt/bro/files/local.bro.community b/salt/deprecated-bro/files/local.bro.community similarity index 100% rename from salt/bro/files/local.bro.community rename to salt/deprecated-bro/files/local.bro.community diff --git a/salt/bro/files/node.cfg b/salt/deprecated-bro/files/node.cfg similarity index 100% rename from salt/bro/files/node.cfg rename to salt/deprecated-bro/files/node.cfg diff --git a/salt/bro/init.sls b/salt/deprecated-bro/init.sls similarity index 82% rename from salt/bro/init.sls rename to salt/deprecated-bro/init.sls index 6a972cbe7..8f36be420 100644 --- a/salt/bro/init.sls +++ b/salt/deprecated-bro/init.sls @@ -1,3 +1,7 @@ +{% set interface = salt['pillar.get']('sensor:interface', 'bond0') %} +{% set BPF_ZEEK = salt['pillar.get']('zeek:bpf') %} +{% set BPF_STATUS = 0 %} + # Bro Salt State # Add Bro group brogroup: @@ -103,6 +107,32 @@ zeekcleanscript: - month: '*' - dayweek: '*' +# BPF compilation and configuration +{% if BPF_ZEEK %} + {% set BPF_CALC = salt['cmd.script']('/usr/sbin/so-bpf-compile', interface + ' ' + BPF_ZEEK|join(" ") ) %} + {% if BPF_CALC['stderr'] == "" %} + {% set BPF_STATUS = 1 %} + {% else %} +zeekbpfcompilationfailure: + test.configurable_test_state: + - changes: False + - result: False + - comment: "BPF Syntax Error - Discarding Specified BPF" + {% endif %} +{% endif %} + +zeekbpf: + file.managed: + - name: /opt/so/conf/bro/bpf + - user: 940 + - group: 940 + {% if BPF_STATUS %} + - contents_pillar: zeek:bpf + {% else %} + - contents: + - "ip or not ip" + {% endif %} + # Sync local.bro {% if salt['pillar.get']('static:broversion', '') == 'COMMUNITY' %} localbrosync: @@ -163,6 +193,7 @@ so-bro: - /nsm/bro/extracted:/nsm/bro/extracted:rw - /opt/so/conf/bro/local.bro:/opt/bro/share/bro/site/local.bro:ro - /opt/so/conf/bro/node.cfg:/opt/bro/etc/node.cfg:ro + - /opt/so/conf/bro/bpf:/opt/bro/share/bro/site/bpf:ro - /opt/so/conf/bro/policy/securityonion:/opt/bro/share/bro/policy/securityonion:ro - /opt/so/conf/bro/policy/custom:/opt/bro/share/bro/policy/custom:ro - /opt/so/conf/bro/policy/intel:/opt/bro/share/bro/policy/intel:rw @@ -171,6 +202,5 @@ so-bro: - file: /opt/so/conf/bro/local.bro - file: /opt/so/conf/bro/node.cfg - file: /opt/so/conf/bro/policy - - + - file: /opt/so/conf/bro/bpf {% endif %} diff --git a/salt/bro/policy/intel/__load__.bro b/salt/deprecated-bro/policy/intel/__load__.bro similarity index 100% rename from salt/bro/policy/intel/__load__.bro rename to salt/deprecated-bro/policy/intel/__load__.bro diff --git a/salt/bro/policy/securityonion/add-interface-to-logs.bro b/salt/deprecated-bro/policy/securityonion/add-interface-to-logs.bro similarity index 100% rename from salt/bro/policy/securityonion/add-interface-to-logs.bro rename to salt/deprecated-bro/policy/securityonion/add-interface-to-logs.bro diff --git a/salt/bro/policy/securityonion/apt1/__load__.bro b/salt/deprecated-bro/policy/securityonion/apt1/__load__.bro similarity index 100% rename from salt/bro/policy/securityonion/apt1/__load__.bro rename to salt/deprecated-bro/policy/securityonion/apt1/__load__.bro diff --git a/salt/bro/policy/securityonion/apt1/apt1-certs.dat b/salt/deprecated-bro/policy/securityonion/apt1/apt1-certs.dat similarity index 100% rename from salt/bro/policy/securityonion/apt1/apt1-certs.dat rename to salt/deprecated-bro/policy/securityonion/apt1/apt1-certs.dat diff --git a/salt/bro/policy/securityonion/apt1/apt1-fqdn.dat b/salt/deprecated-bro/policy/securityonion/apt1/apt1-fqdn.dat similarity index 100% rename from salt/bro/policy/securityonion/apt1/apt1-fqdn.dat rename to salt/deprecated-bro/policy/securityonion/apt1/apt1-fqdn.dat diff --git a/salt/bro/policy/securityonion/apt1/apt1-md5.dat b/salt/deprecated-bro/policy/securityonion/apt1/apt1-md5.dat similarity index 100% rename from salt/bro/policy/securityonion/apt1/apt1-md5.dat rename to salt/deprecated-bro/policy/securityonion/apt1/apt1-md5.dat diff --git a/salt/deprecated-bro/policy/securityonion/bpfconf.bro b/salt/deprecated-bro/policy/securityonion/bpfconf.bro new file mode 100644 index 000000000..595aef8f2 --- /dev/null +++ b/salt/deprecated-bro/policy/securityonion/bpfconf.bro @@ -0,0 +1,106 @@ +##! This script is to support the bpf.conf file like other network monitoring tools use. +##! Please don't try to learn from this script right now, there are a large number of +##! hacks in it to work around bugs discovered in Bro. + +@load base/frameworks/notice + +module BPFConf; + +export { + ## The file that is watched on disk for BPF filter changes. + ## Two templated variables are available; "sensorname" and "interface". + ## They can be used by surrounding the term by doubled curly braces. + const filename = "/opt/bro/share/bro/site/bpf" &redef; + + redef enum Notice::Type += { + ## Invalid filter notice. + InvalidFilter + }; +} + +global filter_parts: vector of string = vector(); +global current_filter_filename = ""; + +type FilterLine: record { + s: string; +}; + +redef enum PcapFilterID += { + BPFConfPcapFilter, +}; + +event BPFConf::line(description: Input::EventDescription, tpe: Input::Event, s: string) + { + local part = sub(s, /[[:blank:]]*#.*$/, ""); + + # We don't want any blank parts. + if ( part != "" ) + filter_parts[|filter_parts|] = part; + } + +event Input::end_of_data(name: string, source:string) + { + if ( name == "bpfconf" ) + { + local filter = join_string_vec(filter_parts, " "); + capture_filters["bpf.conf"] = filter; + if ( Pcap::precompile_pcap_filter(BPFConfPcapFilter, filter) ) + { + PacketFilter::install(); + } + else + { + NOTICE([$note=InvalidFilter, + $msg=fmt("Compiling packet filter from %s failed", filename), + $sub=filter]); + } + + filter_parts=vector(); + } + } + + +function add_filter_file() + { + local real_filter_filename = BPFConf::filename; + + # Support the interface template value. + #if ( SecurityOnion::sensorname != "" ) + # real_filter_filename = gsub(real_filter_filename, /\{\{sensorname\}\}/, SecurityOnion::sensorname); + + # Support the interface template value. + #if ( SecurityOnion::interface != "" ) + # real_filter_filename = gsub(real_filter_filename, /\{\{interface\}\}/, SecurityOnion::interface); + + #if ( /\{\{/ in real_filter_filename ) + # { + # return; + # } + #else + # Reporter::info(fmt("BPFConf filename set: %s (%s)", real_filter_filename, Cluster::node)); + + if ( real_filter_filename != current_filter_filename ) + { + current_filter_filename = real_filter_filename; + Input::add_event([$source=real_filter_filename, + $name="bpfconf", + $reader=Input::READER_RAW, + $mode=Input::REREAD, + $want_record=F, + $fields=FilterLine, + $ev=BPFConf::line]); + } + } + +#event SecurityOnion::found_sensorname(name: string) +# { +# add_filter_file(); +# } + +event bro_init() &priority=5 + { + if ( BPFConf::filename != "" ) + add_filter_file(); + } + + diff --git a/salt/bro/policy/securityonion/conn-add-sensorname.bro b/salt/deprecated-bro/policy/securityonion/conn-add-sensorname.bro similarity index 100% rename from salt/bro/policy/securityonion/conn-add-sensorname.bro rename to salt/deprecated-bro/policy/securityonion/conn-add-sensorname.bro diff --git a/salt/bro/policy/securityonion/file-extraction/__load__.bro b/salt/deprecated-bro/policy/securityonion/file-extraction/__load__.bro similarity index 100% rename from salt/bro/policy/securityonion/file-extraction/__load__.bro rename to salt/deprecated-bro/policy/securityonion/file-extraction/__load__.bro diff --git a/salt/bro/policy/securityonion/file-extraction/extract.bro b/salt/deprecated-bro/policy/securityonion/file-extraction/extract.bro similarity index 100% rename from salt/bro/policy/securityonion/file-extraction/extract.bro rename to salt/deprecated-bro/policy/securityonion/file-extraction/extract.bro diff --git a/salt/bro/policy/securityonion/json-logs/__load__.bro b/salt/deprecated-bro/policy/securityonion/json-logs/__load__.bro similarity index 100% rename from salt/bro/policy/securityonion/json-logs/__load__.bro rename to salt/deprecated-bro/policy/securityonion/json-logs/__load__.bro diff --git a/salt/elastalert/files/elastalert_config.yaml b/salt/elastalert/files/elastalert_config.yaml index 735ccb190..e71f41bf8 100644 --- a/salt/elastalert/files/elastalert_config.yaml +++ b/salt/elastalert/files/elastalert_config.yaml @@ -82,3 +82,7 @@ writeback_index: elastalert_status # sending the alert until this time period has elapsed alert_time_limit: days: 2 + +index_settings: + shards: 1 + replicas: 0 diff --git a/salt/elasticsearch/init.sls b/salt/elasticsearch/init.sls index a2493091a..a97a2ae0f 100644 --- a/salt/elasticsearch/init.sls +++ b/salt/elasticsearch/init.sls @@ -31,7 +31,7 @@ {% set esclustername = salt['pillar.get']('master:esclustername', '') %} {% set esheap = salt['pillar.get']('master:esheap', '') %} -{% elif grains['role'] == 'so-node' %} +{% elif grains['role'] == 'so-node' or grains['role'] == 'so-heavynode' %} {% set esclustername = salt['pillar.get']('node:esclustername', '') %} {% set esheap = salt['pillar.get']('node:esheap', '') %} diff --git a/salt/filebeat/etc/filebeat.yml b/salt/filebeat/etc/filebeat.yml index 4706e4c5a..2eb2092f4 100644 --- a/salt/filebeat/etc/filebeat.yml +++ b/salt/filebeat/etc/filebeat.yml @@ -1,4 +1,10 @@ +{%- if grains.role == 'so-heavynode' %} +{%- set MASTER = salt['pillar.get']('sensor:mainip' '') %} +{%- else %} {%- set MASTER = grains['master'] %} +{%- endif %} + + {%- set HOSTNAME = salt['grains.get']('host', '') %} {%- set BROVER = salt['pillar.get']('static:broversion', 'COMMUNITY') %} {%- set WAZUHENABLED = salt['pillar.get']('static:wazuh_enabled', '1') %} @@ -67,12 +73,12 @@ filebeat.modules: # List of prospectors to fetch data. filebeat.prospectors: #------------------------------ Log prospector -------------------------------- -{%- if grains['role'] == 'so-sensor' or grains['role'] == "so-eval" or grains['role'] == "so-helix" %} +{%- if grains['role'] == 'so-sensor' or grains['role'] == "so-eval" or grains['role'] == "so-helix" or grains['role'] == "so-heavynode" %} {%- if BROVER != 'SURICATA' %} {%- for LOGNAME in salt['pillar.get']('brologs:enabled', '') %} - type: log paths: - - /nsm/bro/logs/current/{{ LOGNAME }}.log + - /nsm/zeek/logs/current/{{ LOGNAME }}.log fields: type: bro_{{ LOGNAME }} fields_under_root: true diff --git a/salt/filebeat/init.sls b/salt/filebeat/init.sls index 44cc7c65c..b058f1408 100644 --- a/salt/filebeat/init.sls +++ b/salt/filebeat/init.sls @@ -1,5 +1,4 @@ - # Copyright 2014,2015,2016,2017,2018 Security Onion Solutions, LLC - +# 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 @@ -14,36 +13,31 @@ # along with this program. If not, see . {% set VERSION = salt['pillar.get']('static:soversion', 'HH1.1.4') %} {% set MASTER = salt['grains.get']('master') %} -{%- set MASTERIP = salt['pillar.get']('static:masterip', '') %} +{% set MASTERIP = salt['pillar.get']('static:masterip', '') %} {% set FEATURES = salt['pillar.get']('elastic:features', False) %} {% if FEATURES %} {% set FEATURES = "-features" %} {% else %} {% set FEATURES = '' %} {% endif %} - -# Filebeat Setup filebeatetcdir: file.directory: - name: /opt/so/conf/filebeat/etc - user: 939 - group: 939 - makedirs: True - filebeatlogdir: file.directory: - name: /opt/so/log/filebeat - user: 939 - group: 939 - makedirs: True - filebeatpkidir: file.directory: - name: /opt/so/conf/filebeat/etc/pki - user: 939 - group: 939 - makedirs: True - # This needs to be owned by root filebeatconfsync: file.managed: @@ -52,7 +46,6 @@ filebeatconfsync: - user: 0 - group: 0 - template: jinja - so-filebeat: docker_container.running: - image: {{ MASTER }}:5000/soshybridhunter/so-filebeat:{{ VERSION }}{{ FEATURES }} @@ -67,13 +60,8 @@ so-filebeat: - /opt/so/wazuh/logs/alerts/:/wazuh/alerts:ro - /opt/so/wazuh/logs/archives/:/wazuh/archives:ro - /opt/so/log/fleet/:/osquery/logs:ro -{%- if grains['role'] == 'so-master' %} - - /etc/pki/filebeat.crt:/usr/share/filebeat/filebeat.crt:ro - - /etc/pki/filebeat.key:/usr/share/filebeat/filebeat.key:ro -{%- else %} - /opt/so/conf/filebeat/etc/pki/filebeat.crt:/usr/share/filebeat/filebeat.crt:ro - /opt/so/conf/filebeat/etc/pki/filebeat.key:/usr/share/filebeat/filebeat.key:ro -{%- endif %} - /etc/ssl/certs/intca.crt:/usr/share/filebeat/intraca.crt:ro - watch: - file: /opt/so/conf/filebeat/etc/filebeat.yml diff --git a/salt/firewall/init.sls b/salt/firewall/init.sls index a016a9767..a26993cc0 100644 --- a/salt/firewall/init.sls +++ b/salt/firewall/init.sls @@ -1,7 +1,7 @@ # Firewall Magic for the grid {%- if grains['role'] in ['so-eval','so-master','so-helix','so-mastersearch'] %} {%- set ip = salt['pillar.get']('static:masterip', '') %} -{%- elif grains['role'] == 'so-node' %} +{%- elif grains['role'] == 'so-node' or grains['role'] == 'so-heavynode' %} {%- set ip = salt['pillar.get']('node:mainip', '') %} {%- elif grains['role'] == 'so-sensor' %} {%- set ip = salt['pillar.get']('sensor:mainip', '') %} @@ -584,7 +584,7 @@ enable_standard_analyst_443_{{ip}}: {% endif %} # Rules if you are a Node -{% if grains['role'] == 'so-node' %} +{% if 'node' in grains['role'] %} #This should be more granular iptables_allow_docker: @@ -655,3 +655,39 @@ iptables_drop_all_the_things: - chain: LOGGING - jump: DROP - save: True + +{% if grains['role'] == 'so-heavynode' %} +# Allow Redis +enable_heavynode_redis_6379_{{ip}}: + iptables.insert: + - table: filter + - chain: DOCKER-USER + - jump: ACCEPT + - proto: tcp + - source: {{ ip }} + - dport: 6379 + - position: 1 + - save: True + +enable_forwardnode_beats_5044_{{ip}}: + iptables.insert: + - table: filter + - chain: DOCKER-USER + - jump: ACCEPT + - proto: tcp + - source: {{ ip }} + - dport: 5044 + - position: 1 + - save: True + +enable_forwardnode_beats_5644_{{ip}}: + iptables.insert: + - table: filter + - chain: DOCKER-USER + - jump: ACCEPT + - proto: tcp + - source: {{ ip }} + - dport: 5644 + - position: 1 + - save: True +{% endif %} diff --git a/salt/logstash/conf/pipelines/eval/0800_input_eval.conf b/salt/logstash/conf/pipelines/eval/0800_input_eval.conf new file mode 100644 index 000000000..d3fd00029 --- /dev/null +++ b/salt/logstash/conf/pipelines/eval/0800_input_eval.conf @@ -0,0 +1,204 @@ +# Updated by: Mike Reeves +# Last Update: 11/1/2018 + +input { + file { + path => "/suricata/eve.json" + type => "ids" + add_field => { "engine" => "suricata" } + } + file { + path => "/nsm/zeek/logs/current/conn*.log" + type => "bro_conn" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/dce_rpc*.log" + type => "bro_dce_rpc" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/dhcp*.log" + type => "bro_dhcp" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/dnp3*.log" + type => "bro_dnp3" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/dns*.log" + type => "bro_dns" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/dpd*.log" + type => "bro_dpd" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/files*.log" + type => "bro_files" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/ftp*.log" + type => "bro_ftp" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/http*.log" + type => "bro_http" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/intel*.log" + type => "bro_intel" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/irc*.log" + type => "bro_irc" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/kerberos*.log" + type => "bro_kerberos" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/modbus*.log" + type => "bro_modbus" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/mysql*.log" + type => "bro_mysql" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/notice*.log" + type => "bro_notice" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/ntlm*.log" + type => "bro_ntlm" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/pe*.log" + type => "bro_pe" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/radius*.log" + type => "bro_radius" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/rdp*.log" + type => "bro_rdp" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/rfb*.log" + type => "bro_rfb" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/signatures*.log" + type => "bro_signatures" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/sip*.log" + type => "bro_sip" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/smb_files*.log" + type => "bro_smb_files" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/smb_mapping*.log" + type => "bro_smb_mapping" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/smtp*.log" + type => "bro_smtp" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/snmp*.log" + type => "bro_snmp" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/socks*.log" + type => "bro_socks" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/software*.log" + type => "bro_software" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/ssh*.log" + type => "bro_ssh" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/ssl*.log" + type => "bro_ssl" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/syslog*.log" + type => "bro_syslog" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/tunnel*.log" + type => "bro_tunnels" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/weird*.log" + type => "bro_weird" + tags => ["bro"] + } + file { + path => "/nsm/zeek/logs/current/x509*.log" + type => "bro_x509" + tags => ["bro"] + } + file { + path => "/wazuh/alerts/alerts.json" + type => "ossec" + } + file { + path => "/wazuh/archives/archive.json" + type => "ossec_archive" + } + file { + path => "/osquery/logs/result.log" + type => "osquery" + tags => ["osquery"] + } + file { + path => "/strelka/strelka.log" + type => "strelka" + } +} +filter { + if "import" in [tags] { + mutate { + #add_tag => [ "conf_file_0007"] + } + } +} diff --git a/salt/logstash/conf/pipelines/eval/1000_preprocess_log_elapsed.conf b/salt/logstash/conf/pipelines/eval/1000_preprocess_log_elapsed.conf new file mode 100644 index 000000000..d098eb11a --- /dev/null +++ b/salt/logstash/conf/pipelines/eval/1000_preprocess_log_elapsed.conf @@ -0,0 +1,13 @@ +# Author: Justin Henderson +# SANS Instructor and author of SANS SEC555: SIEM and Tactical Analytics +# Email: justin@hasecuritysolution.com +# Last Update: 12/9/2016 + +filter { + ruby { + code => "event.set('task_start', Time.now.to_f)" + } + mutate { + #add_tag => [ "conf_file_1000"] + } +} diff --git a/salt/logstash/conf/pipelines/eval/1001_preprocess_syslogng.conf b/salt/logstash/conf/pipelines/eval/1001_preprocess_syslogng.conf new file mode 100644 index 000000000..84bce8802 --- /dev/null +++ b/salt/logstash/conf/pipelines/eval/1001_preprocess_syslogng.conf @@ -0,0 +1,33 @@ +# Updated by: Doug Burks and Wes Lambert +# Last Update: 10/30/2018 + +filter { + if "syslogng" in [tags] { + mutate { + rename => { "MESSAGE" => "message" } + rename => { "PROGRAM" => "type" } + rename => { "FACILITY" => "syslog-facility" } + rename => { "FILE_NAME" => "syslog-file_name" } + rename => { "HOST" => "syslog-host" } + rename => { "HOST_FROM" => "syslog-host_from" } + rename => { "LEGACY_MSGHDR" => "syslog-legacy_msghdr" } + rename => { "PID" => "syslog-pid" } + rename => { "PRIORITY" => "syslog-priority" } + rename => { "SOURCEIP" => "syslog-sourceip" } + rename => { "TAGS" => "syslog-tags" } + lowercase => [ "syslog-host_from" ] + remove_field => [ "ISODATE" ] + remove_field => [ "SEQNUM" ] + #add_tag => [ "conf_file_1001"] + } + if "bro_" in [type] { + mutate { + add_tag => [ "bro" ] + } + } else if [type] !~ /ossec.*|snort/ and "firewall" not in [tags] { + mutate { + add_tag => [ "syslog" ] + } + } + } +} diff --git a/salt/logstash/conf/pipelines/eval/1002_preprocess_json.conf b/salt/logstash/conf/pipelines/eval/1002_preprocess_json.conf new file mode 100644 index 000000000..ea7c677da --- /dev/null +++ b/salt/logstash/conf/pipelines/eval/1002_preprocess_json.conf @@ -0,0 +1,18 @@ +# Author: Justin Henderson +# SANS Instructor and author of SANS SEC555: SIEM and Tactical Analytics +# Email: justin@hasecuritysolution.com +# Last Update: 12/9/2016 + +filter { + if "json" in [tags]{ + json { + source => "message" + } + mutate { + remove_tag => [ "json" ] + } + mutate { + #add_tag => [ "conf_file_1002"] + } + } +} diff --git a/salt/logstash/conf/pipelines/eval/1004_preprocess_syslog_types.conf b/salt/logstash/conf/pipelines/eval/1004_preprocess_syslog_types.conf new file mode 100644 index 000000000..243abcc15 --- /dev/null +++ b/salt/logstash/conf/pipelines/eval/1004_preprocess_syslog_types.conf @@ -0,0 +1,19 @@ +filter { + if "syslog" in [tags] { + if [host] == "172.16.1.1" { + mutate { + add_field => { "type" => "fortinet" } + add_tag => [ "firewall" ] + } + } + if [host] == "10.0.0.101" { + mutate { + add_field => { "type" => "brocade" } + add_tag => [ "switch" ] + } + } + mutate { + #add_tag => [ "conf_file_1004"] + } + } +} diff --git a/salt/logstash/conf/pipelines/eval/1026_preprocess_dhcp.conf b/salt/logstash/conf/pipelines/eval/1026_preprocess_dhcp.conf new file mode 100644 index 000000000..2f893cf7a --- /dev/null +++ b/salt/logstash/conf/pipelines/eval/1026_preprocess_dhcp.conf @@ -0,0 +1,140 @@ +# Author: Justin Henderson +# SANS Instructor and author of SANS SEC555: SIEM and Tactical Analytics +# Email: justin@hasecuritysolutions.com +# Last Update: 12/9/2016 +# This conf file is based on accepting logs for DHCP. It is currently based on Windows DHCP only. +filter { + if [type] == "dhcp" { + mutate { + add_field => { "Hostname" => "%{host}" } + } + mutate { + strip => "message" + } + # This is the initial parsing of the log + grok { + # Server 2008+ + match => { "message" => "%{DATA:id},%{DATE_US:date},(?