From 3dbf97944d2550789193484d390553fdab147332 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Thu, 14 Dec 2023 10:26:29 -0500 Subject: [PATCH] fix extra_hosts. https://github.com/Security-Onion-Solutions/securityonion/issues/12015 --- salt/elasticsearch/enabled.sls | 7 ++++++- salt/logstash/enabled.sls | 11 ++++++++--- salt/soc/enabled.sls | 23 ++++++++++++++--------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/salt/elasticsearch/enabled.sls b/salt/elasticsearch/enabled.sls index f7ab7749f0..591840817b 100644 --- a/salt/elasticsearch/enabled.sls +++ b/salt/elasticsearch/enabled.sls @@ -26,7 +26,12 @@ so-elasticsearch: - networks: - sobridge: - ipv4_address: {{ DOCKER.containers['so-elasticsearch'].ip }} - - extra_hosts: {{ LOGSTASH_NODES }} + - extra_hosts: + {% for node in LOGSTASH_NODES %} + {% for hostname, ip in node.items() %} + - {{hostname}}:{{ip}} + {% endfor %} + {% endfor %} {% if DOCKER.containers['so-elasticsearch'].extra_hosts %} {% for XTRAHOST in DOCKER.containers['so-elasticsearch'].extra_hosts %} - {{ XTRAHOST }} diff --git a/salt/logstash/enabled.sls b/salt/logstash/enabled.sls index c76f81d214..5337351fce 100644 --- a/salt/logstash/enabled.sls +++ b/salt/logstash/enabled.sls @@ -33,11 +33,16 @@ so-logstash: - sobridge: - ipv4_address: {{ DOCKER.containers['so-logstash'].ip }} - user: logstash - - extra_hosts: {{ REDIS_NODES }} + - extra_hosts: + {% for node in REDIS_NODES %} + {% for hostname, ip in node.items() %} + - {{hostname}}:{{ip}} + {% endfor %} + {% endfor %} {% if DOCKER.containers['so-logstash'].extra_hosts %} - {% for XTRAHOST in DOCKER.containers['so-logstash'].extra_hosts %} + {% for XTRAHOST in DOCKER.containers['so-logstash'].extra_hosts %} - {{ XTRAHOST }} - {% endfor %} + {% endfor %} {% endif %} - environment: - LS_JAVA_OPTS=-Xms{{ lsheap }} -Xmx{{ lsheap }} diff --git a/salt/soc/enabled.sls b/salt/soc/enabled.sls index 9e588e5b1e..2661587f48 100644 --- a/salt/soc/enabled.sls +++ b/salt/soc/enabled.sls @@ -33,21 +33,26 @@ so-soc: - /opt/so/conf/soc/soc_users_roles:/opt/sensoroni/rbac/users_roles:rw - /opt/so/conf/soc/queue:/opt/sensoroni/queue:rw - /opt/so/saltstack:/opt/so/saltstack:rw - - extra_hosts: {{ DOCKER_EXTRA_HOSTS }} - {% if DOCKER.containers['so-soc'].extra_hosts %} - {% for XTRAHOST in DOCKER.containers['so-soc'].extra_hosts %} + - extra_hosts: + {% for node in DOCKER_EXTRA_HOSTS %} + {% for hostname, ip in node.items() %} + - {{hostname}}:{{ip}} + {% endfor %} + {% endfor %} + {% if DOCKER.containers['so-soc'].extra_hosts %} + {% for XTRAHOST in DOCKER.containers['so-soc'].extra_hosts %} - {{ XTRAHOST }} - {% endfor %} - {% endif %} + {% endfor %} + {% endif %} - port_bindings: - {% for BINDING in DOCKER.containers['so-soc'].port_bindings %} + {% for BINDING in DOCKER.containers['so-soc'].port_bindings %} - {{ BINDING }} - {% endfor %} + {% endfor %} {% if DOCKER.containers['so-soc'].extra_env %} - environment: - {% for XTRAENV in DOCKER.containers['so-soc'].extra_env %} + {% for XTRAENV in DOCKER.containers['so-soc'].extra_env %} - {{ XTRAENV }} - {% endfor %} + {% endfor %} {% endif %} - watch: - file: /opt/so/conf/soc/*