Merge branch 'dev' into feature/script-fixes

This commit is contained in:
William Wernert
2020-01-27 15:03:20 -05:00
5 changed files with 85 additions and 14 deletions

View File

@@ -2,40 +2,40 @@ base:
'*': '*':
- patch.needs_restarting - patch.needs_restarting
'G@role:so-sensor':
- minions.{{ grains.id }}
- static
- firewall.*
- brologs
'G@role:so-mastersearch': 'G@role:so-mastersearch':
- logstash.mastersearch - logstash.mastersearch
'G@role:so-sensor':
- static
- firewall.*
- brologs
- minions.{{ grains.id }}
'G@role:so-master or G@role:so-mastersearch': 'G@role:so-master or G@role:so-mastersearch':
- match: compound - match: compound
- minions.{{ grains.id }}
- static - static
- firewall.* - firewall.*
- data.* - data.*
- auth - auth
- minions.{{ grains.id }}
'G@role:so-eval': 'G@role:so-eval':
- minions.{{ grains.id }}
- static - static
- firewall.* - firewall.*
- data.* - data.*
- brologs - brologs
- auth - auth
- minions.{{ grains.id }}
'G@role:so-node': 'G@role:so-node':
- minions.{{ grains.id }}
- static - static
- firewall.* - firewall.*
- minions.{{ grains.id }}
'G@role:so-helix': 'G@role:so-helix':
- minions.{{ grains.id }}
- static - static
- firewall.* - firewall.*
- fireeye - fireeye
- static - static
- brologs - brologs
- minions.{{ grains.id }}

View File

@@ -0,0 +1,37 @@
#!/bin/bash
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if [ "$#" -lt 2 ]; then
cat 1>&2 <<EOF
$0 compiles a BPF expression to be passed to stenotype to apply a socket filter.
Its first argument is the interface (link type is required) and all other arguments
are passed to TCPDump.
Examples:
$0 eth0 dst port 80
$0 eth0 udp port 53
EOF
exit 1
fi
interface="$1"
shift
sudo tcpdump -i $interface -ddd $@ | tail -n+2 |
while read line; do
cols=( $line )
printf "%04x%02x%02x%08x" ${cols[0]} ${cols[1]} ${cols[2]} ${cols[3]}
done
echo ""

View File

@@ -11,6 +11,6 @@
, "Interface": "{{ interface }}" , "Interface": "{{ interface }}"
, "Port": 1234 , "Port": 1234
, "Host": "127.0.0.1" , "Host": "127.0.0.1"
, "Flags": ["-v", "--uid=stenographer", "--gid=stenographer"] , "Flags": ["-v", "--uid=stenographer", "--gid=stenographer"{{ bpf_compiled }}]
, "CertPath": "/etc/stenographer/certs" , "CertPath": "/etc/stenographer/certs"
} }

View File

@@ -36,6 +36,33 @@ stenoconfdir:
- group: 939 - group: 939
- makedirs: True - makedirs: True
{% set interface = salt['pillar.get']('sensor:interface', 'bond0') %}
{% set bpf_global = salt['pillar.get']('static:steno:bpf', None) %}
{% set bpf_steno = salt['pillar.get']('steno:bpf', None) %}
{% if bpf_steno != None or bpf_global != None %}
{% if bpf_steno != None %}
{% set bpf_calc = salt['cmd.script']('salt://pcap/files/compile_bpf.sh', interface + ' ' + bpf_steno) %}
{% else %}
{% set bpf_calc = salt['cmd.script']('salt://pcap/files/compile_bpf.sh', interface + ' ' + bpf_global) %}
{% endif %}
{% if bpf_calc['stderr'] == "" %}
{% set bpf_compiled = bpf_calc['stdout'] %}
{% else %}
{% set bpf_compiled = None %}
bpfcompilationfailure:
test.configurable_test_state:
- name: bpfcompfailure
- changes: False
- result: False
- comment: "BPF Compilation Failed - Discarding specified BPF"
{% endif %}
{% else %}
{% set bpf_compiled = None %}
{% endif %}
stenoconf: stenoconf:
file.managed: file.managed:
- name: /opt/so/conf/steno/config - name: /opt/so/conf/steno/config
@@ -44,6 +71,12 @@ stenoconf:
- group: root - group: root
- mode: 644 - mode: 644
- template: jinja - template: jinja
- defaults:
bpf_compiled: ""
{% if bpf_compiled != None %}
- context:
bpf_compiled: ',"--filter={{ bpf_compiled }}"'
{% endif %}
sensoroniagentconf: sensoroniagentconf:
file.managed: file.managed:
@@ -113,4 +146,5 @@ so-steno:
- /opt/so/conf/steno/sensoroni.json:/opt/sensoroni/sensoroni.json:ro - /opt/so/conf/steno/sensoroni.json:/opt/sensoroni/sensoroni.json:ro
- /opt/so/log/stenographer:/opt/sensoroni/logs:rw - /opt/so/log/stenographer:/opt/sensoroni/logs:rw
- watch: - watch:
- /opt/so/conf/steno/sensoroni.json - file: /opt/so/conf/steno/config
- file: /opt/so/conf/steno/sensoroni.json

View File

@@ -7,6 +7,6 @@ TARBALL=/nsm/docker-registry/docker/so-dockers-$VERSION.tar
if [ -f "$TARBALL" ]; then if [ -f "$TARBALL" ]; then
cd /nsm/docker-registry/docker cd /nsm/docker-registry/docker
tar xvf so-dockers-$VERSION.tar tar xvf so-dockers-$VERSION.tar
else
exit
fi fi
exit 0