mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-07-14 04:43:09 +02:00
docker_container.running fails with an address-already-in-use error when a container holds a stale sobridge endpoint - either after its IP changes in pillar or after an unclean shutdown leaves the endpoint behind. Add the clear_stale_endpoint macro and call it from every enabled.sls whose container attaches to sobridge with a static IP. The macro force-disconnects the container from the network only when its current endpoint IP does not match the one salt is about to assign, so it is a no-op on a normal highstate. The strelka states use state IDs that differ from their container names, so those calls pass state_id explicitly. nginx resolves its IP through container_config, which varies by role.
128 lines
5.2 KiB
YAML+Jinja
128 lines
5.2 KiB
YAML+Jinja
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
|
|
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
|
|
# https://securityonion.net/license; you may not use this file except in compliance with the
|
|
# Elastic License 2.0.
|
|
|
|
{% from 'allowed_states.map.jinja' import allowed_states %}
|
|
{% if sls.split('.')[0] in allowed_states %}
|
|
{% from 'vars/globals.map.jinja' import GLOBALS %}
|
|
{% from 'docker/docker.map.jinja' import DOCKERMERGED %}
|
|
{% from 'soc/merged.map.jinja' import DOCKER_EXTRA_HOSTS %}
|
|
{% from 'soc/merged.map.jinja' import SOCMERGED %}
|
|
|
|
{% from 'docker/macros/docker_endpoint.jinja' import clear_stale_endpoint %}
|
|
{{ clear_stale_endpoint('so-soc', 'sobridge', DOCKERMERGED.containers['so-soc'].ip) }}
|
|
|
|
include:
|
|
- ca
|
|
- soc.config
|
|
- soc.sostatus
|
|
|
|
so-soc:
|
|
docker_container.running:
|
|
- image: {{ GLOBALS.registry_host }}:5000/{{ GLOBALS.image_repo }}/so-soc:{{ GLOBALS.so_version }}
|
|
- hostname: soc
|
|
- name: so-soc
|
|
- networks:
|
|
- sobridge:
|
|
- ipv4_address: {{ DOCKERMERGED.containers['so-soc'].ip }}
|
|
- binds:
|
|
- /nsm/rules:/nsm/rules:rw
|
|
- /opt/so/conf/strelka:/opt/sensoroni/yara:rw
|
|
- /opt/so/conf/sigma:/opt/sensoroni/sigma:rw
|
|
- /opt/so/rules/elastalert/rules:/opt/sensoroni/elastalert:rw
|
|
- /opt/so/saltstack/local/salt/suricata/rules:/opt/sensoroni/suricata/rules:rw
|
|
- /opt/so/saltstack/local/salt/suricata/files:/opt/sensoroni/suricata/threshold:rw
|
|
- /opt/so/conf/soc/fingerprints:/opt/sensoroni/fingerprints:rw
|
|
- /nsm/soc/jobs:/opt/sensoroni/jobs:rw
|
|
- /nsm/soc/uploads:/nsm/soc/uploads:rw
|
|
- /nsm/airgap-resources:/nsm/airgap-resources:rw
|
|
- /opt/so/log/soc/:/opt/sensoroni/logs/:rw
|
|
- /opt/so/conf/soc/soc.json:/opt/sensoroni/sensoroni.json:ro
|
|
- /opt/so/conf/soc/ai_summary_repos:/opt/sensoroni/ai_summary_repos:rw
|
|
- /opt/so/conf/navigator/layers/:/opt/sensoroni/navigator/:rw
|
|
- /opt/so/conf/soc/playbooks/:/opt/sensoroni/playbooks/:rw
|
|
{% if SOCMERGED.telemetryEnabled and not GLOBALS.airgap %}
|
|
- /opt/so/conf/soc/analytics.js:/opt/sensoroni/html/js/analytics.js:ro
|
|
{% endif %}
|
|
- /opt/so/conf/soc/motd.md:/opt/sensoroni/html/motd.md:ro
|
|
- /opt/so/conf/soc/banner.md:/opt/sensoroni/html/login/banner.md:ro
|
|
- /opt/so/conf/soc/sigma_so_pipeline.yaml:/opt/sensoroni/sigma_so_pipeline.yaml:ro
|
|
- /opt/so/conf/soc/sigma_playbook_pipeline.yaml:/opt/sensoroni/sigma_playbook_pipeline.yaml:ro
|
|
- /opt/so/conf/soc/sigma_final_pipeline.yaml:/opt/sensoroni/sigma_final_pipeline.yaml:ro
|
|
- /opt/so/conf/soc/playbook_placeholder_map.yaml:/opt/sensoroni/playbook_placeholder_map.yaml:ro
|
|
- /opt/so/conf/soc/playbook_placeholder_map_custom.yaml:/opt/sensoroni/playbook_placeholder_map_custom.yaml:ro
|
|
- /opt/so/conf/soc/custom.js:/opt/sensoroni/html/js/custom.js:ro
|
|
- /opt/so/conf/soc/custom_roles:/opt/sensoroni/rbac/custom_roles:ro
|
|
- /opt/so/conf/soc/soc_users_roles:/opt/sensoroni/rbac/users_roles:rw
|
|
- /opt/so/conf/soc/soc_clients_roles:/opt/sensoroni/rbac/clients_roles:rw
|
|
- /opt/so/conf/sensoroni/templates:/opt/sensoroni/templates:ro
|
|
- /opt/so/conf/soc/queue:/opt/sensoroni/queue:rw
|
|
- /opt/so/saltstack:/opt/so/saltstack:rw
|
|
- /opt/so/conf/soc/migrations:/opt/so/conf/soc/migrations:rw
|
|
- /nsm/backup/detections-migration:/nsm/backup/detections-migration:ro
|
|
- /opt/so/state:/opt/so/state:rw
|
|
- /etc/pki/tls/certs/intca.crt:/opt/sensoroni/html/so-ca.crt:ro
|
|
- extra_hosts:
|
|
{% for node in DOCKER_EXTRA_HOSTS %}
|
|
{% for hostname, ip in node.items() %}
|
|
- {{hostname}}:{{ip}}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
{% if DOCKERMERGED.containers['so-soc'].extra_hosts %}
|
|
{% for XTRAHOST in DOCKERMERGED.containers['so-soc'].extra_hosts %}
|
|
- {{ XTRAHOST }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
- port_bindings:
|
|
{% for BINDING in DOCKERMERGED.containers['so-soc'].port_bindings %}
|
|
- {{ BINDING }}
|
|
{% endfor %}
|
|
{% if DOCKERMERGED.containers['so-soc'].extra_env %}
|
|
- environment:
|
|
{% for XTRAENV in DOCKERMERGED.containers['so-soc'].extra_env %}
|
|
- {{ XTRAENV }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% if DOCKERMERGED.containers['so-soc'].ulimits %}
|
|
- ulimits:
|
|
{% for ULIMIT in DOCKERMERGED.containers['so-soc'].ulimits %}
|
|
- {{ ULIMIT.name }}={{ ULIMIT.soft }}:{{ ULIMIT.hard }}
|
|
{% endfor %}
|
|
{% endif %}
|
|
- watch:
|
|
- file: trusttheca
|
|
- file: /opt/so/conf/soc/*
|
|
- require:
|
|
- file: trusttheca
|
|
- file: socdatadir
|
|
- file: soclogdir
|
|
- file: socconfig
|
|
- file: socanalytics
|
|
- file: socmotd
|
|
- file: socbanner
|
|
- file: soccustom
|
|
- file: soccustomroles
|
|
- file: socusersroles
|
|
- file: socclientsroles
|
|
- file: socplaybookplaceholdermap
|
|
- file: socplaybookplaceholdermapcustom
|
|
|
|
delete_so-soc_so-status.disabled:
|
|
file.uncomment:
|
|
- name: /opt/so/conf/so-status/so-status.conf
|
|
- regex: ^so-soc$
|
|
|
|
salt-relay:
|
|
cron.present:
|
|
- name: '/opt/so/saltstack/default/salt/soc/files/bin/salt-relay.sh &'
|
|
- identifier: salt-relay
|
|
|
|
{% else %}
|
|
|
|
{{sls}}_state_not_allowed:
|
|
test.fail_without_changes:
|
|
- name: {{sls}}_state_not_allowed
|
|
|
|
{% endif %}
|