From 22ae8ac96a7a08cc7ffc8f90849a85a936d0a538 Mon Sep 17 00:00:00 2001 From: Josh Brower Date: Tue, 7 Apr 2020 11:58:35 -0400 Subject: [PATCH] Redirect SOC Fleet link to current Fleet instance --- salt/common/nginx/nginx.conf.so-eval | 9 ++++++++- salt/common/nginx/nginx.conf.so-master | 9 ++++++++- salt/common/nginx/nginx.conf.so-mastersearch | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/salt/common/nginx/nginx.conf.so-eval b/salt/common/nginx/nginx.conf.so-eval index 19ddf0c5f..f0f03bac2 100644 --- a/salt/common/nginx/nginx.conf.so-eval +++ b/salt/common/nginx/nginx.conf.so-eval @@ -1,5 +1,7 @@ {%- set masterip = salt['pillar.get']('master:mainip', '') %} {%- set FLEET_MASTER = salt['pillar.get']('static:fleet_master') %} +{%- set FLEET_NODE = salt['pillar.get']('static:fleet_node') %} +{%- set FLEET_IP = salt['pillar.get']('static:fleet_ip', None) %} # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ @@ -217,6 +219,11 @@ http { } + {%- if FLEET_NODE %} + location /fleet/ { + return 301 https://{{ FLEET_IP }}/fleet; + } + {%- else %} location /fleet/ { proxy_pass https://{{ masterip }}:8080; proxy_read_timeout 90; @@ -225,8 +232,8 @@ http { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Proxy ""; - } + {%- endif %} location /thehive/ { proxy_pass http://{{ masterip }}:9000/thehive/; diff --git a/salt/common/nginx/nginx.conf.so-master b/salt/common/nginx/nginx.conf.so-master index 19ddf0c5f..f0f03bac2 100644 --- a/salt/common/nginx/nginx.conf.so-master +++ b/salt/common/nginx/nginx.conf.so-master @@ -1,5 +1,7 @@ {%- set masterip = salt['pillar.get']('master:mainip', '') %} {%- set FLEET_MASTER = salt['pillar.get']('static:fleet_master') %} +{%- set FLEET_NODE = salt['pillar.get']('static:fleet_node') %} +{%- set FLEET_IP = salt['pillar.get']('static:fleet_ip', None) %} # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ @@ -217,6 +219,11 @@ http { } + {%- if FLEET_NODE %} + location /fleet/ { + return 301 https://{{ FLEET_IP }}/fleet; + } + {%- else %} location /fleet/ { proxy_pass https://{{ masterip }}:8080; proxy_read_timeout 90; @@ -225,8 +232,8 @@ http { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Proxy ""; - } + {%- endif %} location /thehive/ { proxy_pass http://{{ masterip }}:9000/thehive/; diff --git a/salt/common/nginx/nginx.conf.so-mastersearch b/salt/common/nginx/nginx.conf.so-mastersearch index 19ddf0c5f..f0f03bac2 100644 --- a/salt/common/nginx/nginx.conf.so-mastersearch +++ b/salt/common/nginx/nginx.conf.so-mastersearch @@ -1,5 +1,7 @@ {%- set masterip = salt['pillar.get']('master:mainip', '') %} {%- set FLEET_MASTER = salt['pillar.get']('static:fleet_master') %} +{%- set FLEET_NODE = salt['pillar.get']('static:fleet_node') %} +{%- set FLEET_IP = salt['pillar.get']('static:fleet_ip', None) %} # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ @@ -217,6 +219,11 @@ http { } + {%- if FLEET_NODE %} + location /fleet/ { + return 301 https://{{ FLEET_IP }}/fleet; + } + {%- else %} location /fleet/ { proxy_pass https://{{ masterip }}:8080; proxy_read_timeout 90; @@ -225,8 +232,8 @@ http { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Proxy ""; - } + {%- endif %} location /thehive/ { proxy_pass http://{{ masterip }}:9000/thehive/;