Merge pull request #11255 from Security-Onion-Solutions/issue/10975

Issue/10975
This commit is contained in:
Josh Patterson
2023-09-05 11:57:58 -04:00
committed by GitHub
8 changed files with 75 additions and 47 deletions

View File

@@ -2,6 +2,9 @@ base:
'*': '*':
- global.soc_global - global.soc_global
- global.adv_global - global.adv_global
- docker.soc_docker
- docker.adv_docker
- influxdb.token
- logrotate.soc_logrotate - logrotate.soc_logrotate
- logrotate.adv_logrotate - logrotate.adv_logrotate
- ntp.soc_ntp - ntp.soc_ntp
@@ -9,21 +12,18 @@ base:
- patch.needs_restarting - patch.needs_restarting
- patch.soc_patch - patch.soc_patch
- patch.adv_patch - patch.adv_patch
'* and not *_desktop':
- docker.soc_docker
- docker.adv_docker
- firewall.soc_firewall
- firewall.adv_firewall
- influxdb.token
- nginx.soc_nginx
- nginx.adv_nginx
- node_data.ips
- sensoroni.soc_sensoroni - sensoroni.soc_sensoroni
- sensoroni.adv_sensoroni - sensoroni.adv_sensoroni
- telegraf.soc_telegraf - telegraf.soc_telegraf
- telegraf.adv_telegraf - telegraf.adv_telegraf
'* and not *_desktop':
- firewall.soc_firewall
- firewall.adv_firewall
- nginx.soc_nginx
- nginx.adv_nginx
- node_data.ips
'*_manager or *_managersearch': '*_manager or *_managersearch':
- match: compound - match: compound
{% if salt['file.file_exists']('/opt/so/saltstack/local/pillar/elasticsearch/auth.sls') %} {% if salt['file.file_exists']('/opt/so/saltstack/local/pillar/elasticsearch/auth.sls') %}

View File

@@ -188,6 +188,9 @@
'docker_clean' 'docker_clean'
], ],
'so-desktop': [ 'so-desktop': [
'ssl',
'docker_clean',
'telegraf'
], ],
}, grain='role') %} }, grain='role') %}

View File

@@ -9,6 +9,7 @@
prune_images: prune_images:
cmd.run: cmd.run:
- name: so-docker-prune - name: so-docker-prune
- order: last
{% else %} {% else %}

View File

@@ -289,6 +289,11 @@ firewall:
- elastic_agent_control - elastic_agent_control
- elastic_agent_data - elastic_agent_data
- elastic_agent_update - elastic_agent_update
desktop:
portgroups:
- elastic_agent_control
- elastic_agent_data
- elastic_agent_update
customhostgroup0: customhostgroup0:
portgroups: [] portgroups: []
customhostgroup1: customhostgroup1:
@@ -463,7 +468,13 @@ firewall:
- endgame - endgame
desktop: desktop:
portgroups: portgroups:
- docker_registry
- influxdb
- sensoroni
- yum - yum
- elastic_agent_control
- elastic_agent_data
- elastic_agent_update
customhostgroup0: customhostgroup0:
portgroups: [] portgroups: []
customhostgroup1: customhostgroup1:
@@ -651,7 +662,13 @@ firewall:
- endgame - endgame
desktop: desktop:
portgroups: portgroups:
- docker_registry
- influxdb
- sensoroni
- yum - yum
- elastic_agent_control
- elastic_agent_data
- elastic_agent_update
customhostgroup0: customhostgroup0:
portgroups: [] portgroups: []
customhostgroup1: customhostgroup1:
@@ -847,7 +864,13 @@ firewall:
- strelka_frontend - strelka_frontend
desktop: desktop:
portgroups: portgroups:
- docker_registry
- influxdb
- sensoroni
- yum - yum
- elastic_agent_control
- elastic_agent_data
- elastic_agent_update
customhostgroup0: customhostgroup0:
portgroups: [] portgroups: []
customhostgroup1: customhostgroup1:
@@ -1205,9 +1228,6 @@ firewall:
analyst: analyst:
portgroups: portgroups:
- nginx - nginx
desktop:
portgroups:
- yum
customhostgroup0: customhostgroup0:
portgroups: [] portgroups: []
customhostgroup1: customhostgroup1:

View File

@@ -552,6 +552,7 @@ function createRECEIVER() {
function createDESKTOP() { function createDESKTOP() {
add_desktop_to_minion add_desktop_to_minion
add_telegraf_to_minion
} }
function testConnection() { function testConnection() {

View File

@@ -87,4 +87,5 @@ telegraf:
- sostatus.sh - sostatus.sh
fleet: fleet:
- sostatus.sh - sostatus.sh
desktop: [] desktop:
- sostatus.sh

View File

@@ -28,11 +28,9 @@ base:
- motd - motd
- salt.minion-check - salt.minion-check
- salt.lasthighstate - salt.lasthighstate
'not *_desktop and G@saltversion:{{saltversion}}':
- match: compound
- common - common
- docker - docker
- docker_clean
'*_sensor and G@saltversion:{{saltversion}}': '*_sensor and G@saltversion:{{saltversion}}':
- match: compound - match: compound
@@ -47,7 +45,6 @@ base:
- healthcheck - healthcheck
- zeek - zeek
- strelka - strelka
- docker_clean
- elasticfleet.install_agent_grid - elasticfleet.install_agent_grid
'*_eval and G@saltversion:{{saltversion}}': '*_eval and G@saltversion:{{saltversion}}':
@@ -57,14 +54,14 @@ base:
- ca - ca
- ssl - ssl
- registry - registry
- sensoroni
- manager - manager
- backup.config_backup - backup.config_backup
- nginx - nginx
- telegraf
- influxdb - influxdb
- soc - soc
- kratos - kratos
- sensoroni
- telegraf
- firewall - firewall
- idstools - idstools
- suricata.manager - suricata.manager
@@ -84,7 +81,6 @@ base:
- playbook - playbook
- redis - redis
- elasticfleet - elasticfleet
- docker_clean
'*_manager and G@saltversion:{{saltversion}}': '*_manager and G@saltversion:{{saltversion}}':
- match: compound - match: compound
@@ -92,14 +88,14 @@ base:
- ca - ca
- ssl - ssl
- registry - registry
- sensoroni
- nginx - nginx
- telegraf
- influxdb - influxdb
- soc - soc
- kratos - kratos
- firewall - firewall
- manager - manager
- sensoroni
- telegraf
- backup.config_backup - backup.config_backup
- idstools - idstools
- suricata.manager - suricata.manager
@@ -115,7 +111,6 @@ base:
- soctopus - soctopus
- playbook - playbook
- elasticfleet - elasticfleet
- docker_clean
'*_standalone and G@saltversion:{{saltversion}}': '*_standalone and G@saltversion:{{saltversion}}':
- match: compound - match: compound
@@ -124,15 +119,15 @@ base:
- ca - ca
- ssl - ssl
- registry - registry
- sensoroni
- manager - manager
- backup.config_backup - backup.config_backup
- nginx - nginx
- telegraf
- influxdb - influxdb
- soc - soc
- kratos - kratos
- firewall - firewall
- sensoroni
- telegraf
- idstools - idstools
- suricata.manager - suricata.manager
- healthcheck - healthcheck
@@ -152,19 +147,17 @@ base:
- soctopus - soctopus
- playbook - playbook
- elasticfleet - elasticfleet
- docker_clean
'*_searchnode and G@saltversion:{{saltversion}}': '*_searchnode and G@saltversion:{{saltversion}}':
- match: compound - match: compound
- ssl - ssl
- sensoroni - sensoroni
- nginx
- telegraf - telegraf
- nginx
- firewall - firewall
- elasticsearch - elasticsearch
- logstash - logstash
- elasticfleet.install_agent_grid - elasticfleet.install_agent_grid
- docker_clean
'*_managersearch and G@saltversion:{{saltversion}}': '*_managersearch and G@saltversion:{{saltversion}}':
- match: compound - match: compound
@@ -172,14 +165,14 @@ base:
- ca - ca
- ssl - ssl
- registry - registry
- sensoroni
- nginx - nginx
- telegraf
- influxdb - influxdb
- soc - soc
- kratos - kratos
- firewall - firewall
- manager - manager
- sensoroni
- telegraf
- backup.config_backup - backup.config_backup
- idstools - idstools
- suricata.manager - suricata.manager
@@ -195,15 +188,14 @@ base:
- soctopus - soctopus
- playbook - playbook
- elasticfleet - elasticfleet
- docker_clean
'*_heavynode and G@saltversion:{{saltversion}}': '*_heavynode and G@saltversion:{{saltversion}}':
- match: compound - match: compound
- sensor - sensor
- ssl - ssl
- sensoroni - sensoroni
- nginx
- telegraf - telegraf
- nginx
- firewall - firewall
- elasticsearch - elasticsearch
- logstash - logstash
@@ -215,7 +207,6 @@ base:
- zeek - zeek
- elasticfleet.install_agent_grid - elasticfleet.install_agent_grid
- elasticagent - elasticagent
- docker_clean
'*_import and G@saltversion:{{saltversion}}': '*_import and G@saltversion:{{saltversion}}':
- match: compound - match: compound
@@ -224,13 +215,13 @@ base:
- ca - ca
- ssl - ssl
- registry - registry
- sensoroni
- manager - manager
- nginx - nginx
- telegraf
- influxdb - influxdb
- soc - soc
- kratos - kratos
- sensoroni
- telegraf
- firewall - firewall
- idstools - idstools
- suricata.manager - suricata.manager
@@ -242,7 +233,6 @@ base:
- suricata - suricata
- zeek - zeek
- elasticfleet - elasticfleet
- docker_clean
'*_receiver and G@saltversion:{{saltversion}}': '*_receiver and G@saltversion:{{saltversion}}':
- match: compound - match: compound
@@ -253,7 +243,6 @@ base:
- logstash - logstash
- redis - redis
- elasticfleet.install_agent_grid - elasticfleet.install_agent_grid
- docker_clean
'*_idh and G@saltversion:{{saltversion}}': '*_idh and G@saltversion:{{saltversion}}':
- match: compound - match: compound
@@ -262,7 +251,6 @@ base:
- telegraf - telegraf
- firewall - firewall
- elasticfleet.install_agent_grid - elasticfleet.install_agent_grid
- docker_clean
- idh - idh
'*_fleet and G@saltversion:{{saltversion}}': '*_fleet and G@saltversion:{{saltversion}}':
@@ -275,7 +263,12 @@ base:
- elasticfleet - elasticfleet
- elasticfleet.install_agent_grid - elasticfleet.install_agent_grid
- schedule - schedule
- docker_clean
'*_desktop and G@saltversion:{{saltversion}}':
- ssl
- sensoroni
- telegraf
- elasticfleet.install_agent_grid
'J@desktop:gui:enabled:^[Tt][Rr][Uu][Ee]$ and ( G@saltversion:{{saltversion}} and G@os:OEL )': 'J@desktop:gui:enabled:^[Tt][Rr][Uu][Ee]$ and ( G@saltversion:{{saltversion}} and G@os:OEL )':
- match: compound - match: compound

View File

@@ -94,6 +94,9 @@ desktop_salt_local() {
logCmd "yum -y install salt-minion-$SALTVERSION httpd-tools python3 python3-dateutil yum-utils device-mapper-persistent-data lvm2 openssl jq" logCmd "yum -y install salt-minion-$SALTVERSION httpd-tools python3 python3-dateutil yum-utils device-mapper-persistent-data lvm2 openssl jq"
logCmd "yum -y update --exclude=salt*" logCmd "yum -y update --exclude=salt*"
salt_install_module_deps
salt_patch_x509_v2
logCmd "salt-call state.apply desktop --local --file-root=../salt/ -l info" logCmd "salt-call state.apply desktop --local --file-root=../salt/ -l info"
read -r -d '' message <<- EOM read -r -d '' message <<- EOM
Finished Security Onion Desktop installation. Finished Security Onion Desktop installation.
@@ -2075,21 +2078,27 @@ saltify() {
fi fi
logCmd "mkdir -p /etc/salt/minion.d" logCmd "mkdir -p /etc/salt/minion.d"
salt_install_module_deps
salt_patch_x509_v2
}
# Run a salt command to generate the minion key
salt_firstcheckin() {
salt-call state.show_top >> /dev/null 2>&1 # send output to /dev/null because we don't actually care about the ouput
}
salt_install_module_deps() {
logCmd "salt-pip install docker --no-index --only-binary=:all: --find-links files/salt_module_deps/docker/" logCmd "salt-pip install docker --no-index --only-binary=:all: --find-links files/salt_module_deps/docker/"
logCmd "salt-pip install pymysql --no-index --only-binary=:all: --find-links files/salt_module_deps/pymysql/" logCmd "salt-pip install pymysql --no-index --only-binary=:all: --find-links files/salt_module_deps/pymysql/"
}
salt_patch_x509_v2() {
# this can be removed when https://github.com/saltstack/salt/issues/64195 is resolved # this can be removed when https://github.com/saltstack/salt/issues/64195 is resolved
if [ $SALTVERSION == "3006.1" ]; then if [ $SALTVERSION == "3006.1" ]; then
info "Salt version 3006.1 found. Patching /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/x509_v2.py" info "Salt version 3006.1 found. Patching /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/x509_v2.py"
\cp -v ./files/patch/states/x509_v2.py /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/x509_v2.py \cp -v ./files/patch/states/x509_v2.py /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/x509_v2.py
fi fi
}
# Run a salt command to generate the minion key
salt_firstcheckin() {
salt-call state.show_top >> /dev/null 2>&1 # send output to /dev/null because we don't actually care about the ouput
} }
# Create an secrets pillar so that passwords survive re-install # Create an secrets pillar so that passwords survive re-install