mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Merge pull request #10823 from Security-Onion-Solutions/2.4/dockerips
2.4/dockerips
This commit is contained in:
@@ -1,13 +1,11 @@
|
|||||||
{%- set DOCKERRANGE = salt['pillar.get']('docker:range', '172.17.0.0/24') %}
|
|
||||||
{%- set DOCKERBIND = salt['pillar.get']('docker:bip', '172.17.0.1/24') %}
|
|
||||||
{
|
{
|
||||||
"registry-mirrors": [
|
"registry-mirrors": [
|
||||||
"https://:5000"
|
"https://:5000"
|
||||||
],
|
],
|
||||||
"bip": "{{ DOCKERBIND }}",
|
"bip": "172.17.0.1/24",
|
||||||
"default-address-pools": [
|
"default-address-pools": [
|
||||||
{
|
{
|
||||||
"base": "{{ DOCKERRANGE }}",
|
"base": "172.17.0.0/24",
|
||||||
"size": 24
|
"size": 24
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
docker:
|
docker:
|
||||||
bip: '172.17.0.1'
|
range: '172.17.1.0/24'
|
||||||
range: '172.17.0.0/24'
|
gateway: '172.17.1.1'
|
||||||
sorange: '172.17.1.0/24'
|
|
||||||
sobip: '172.17.1.1'
|
|
||||||
containers:
|
containers:
|
||||||
'so-dockerregistry':
|
'so-dockerregistry':
|
||||||
final_octet: 20
|
final_octet: 20
|
||||||
@@ -202,4 +200,4 @@ docker:
|
|||||||
final_octet: 99
|
final_octet: 99
|
||||||
custom_bind_mounts: []
|
custom_bind_mounts: []
|
||||||
extra_hosts: []
|
extra_hosts: []
|
||||||
extra_env: []
|
extra_env: []
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% import_yaml 'docker/defaults.yaml' as DOCKERDEFAULTS %}
|
{% import_yaml 'docker/defaults.yaml' as DOCKERDEFAULTS %}
|
||||||
{% set DOCKER = salt['pillar.get']('docker', DOCKERDEFAULTS.docker, merge=True) %}
|
{% set DOCKER = salt['pillar.get']('docker', DOCKERDEFAULTS.docker, merge=True) %}
|
||||||
{% set RANGESPLIT = DOCKER.sorange.split('.') %}
|
{% set RANGESPLIT = DOCKER.range.split('.') %}
|
||||||
{% set FIRSTTHREE = RANGESPLIT[0] ~ '.' ~ RANGESPLIT[1] ~ '.' ~ RANGESPLIT[2] ~ '.' %}
|
{% set FIRSTTHREE = RANGESPLIT[0] ~ '.' ~ RANGESPLIT[1] ~ '.' ~ RANGESPLIT[2] ~ '.' %}
|
||||||
|
|
||||||
{% for container, vals in DOCKER.containers.items() %}
|
{% for container, vals in DOCKER.containers.items() %}
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ dockerreserveports:
|
|||||||
sos_docker_net:
|
sos_docker_net:
|
||||||
docker_network.present:
|
docker_network.present:
|
||||||
- name: sobridge
|
- name: sobridge
|
||||||
- subnet: {{ DOCKER.sorange }}
|
- subnet: {{ DOCKER.range }}
|
||||||
- gateway: {{ DOCKER.sobip }}
|
- gateway: {{ DOCKER.gateway }}
|
||||||
- options:
|
- options:
|
||||||
com.docker.network.bridge.name: 'sobridge'
|
com.docker.network.bridge.name: 'sobridge'
|
||||||
com.docker.network.driver.mtu: '1500'
|
com.docker.network.driver.mtu: '1500'
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
docker:
|
docker:
|
||||||
bip:
|
gateway:
|
||||||
description: Bind IP for the default docker interface.
|
description: Gateway for the default docker interface.
|
||||||
helpLink: docker.html
|
helpLink: docker.html
|
||||||
advanced: True
|
advanced: True
|
||||||
range:
|
range:
|
||||||
description: Default docker IP range for containers.
|
description: Default docker IP range for containers.
|
||||||
helpLink: docker.html
|
helpLink: docker.html
|
||||||
advanced: True
|
advanced: True
|
||||||
sobip:
|
|
||||||
description: Bind IP for the SO docker interface.
|
|
||||||
helpLink: docker.html
|
|
||||||
advanced: True
|
|
||||||
sorange:
|
|
||||||
description: IP range for the SO docker containers.
|
|
||||||
helpLink: docker.html
|
|
||||||
advanced: True
|
|
||||||
containers:
|
containers:
|
||||||
so-curator: &dockerOptions
|
so-curator: &dockerOptions
|
||||||
final_octet:
|
final_octet:
|
||||||
@@ -68,4 +60,4 @@ docker:
|
|||||||
so-strelka-filestream: *dockerOptions
|
so-strelka-filestream: *dockerOptions
|
||||||
so-strelka-frontend: *dockerOptions
|
so-strelka-frontend: *dockerOptions
|
||||||
so-strelka-gatekeeper: *dockerOptions
|
so-strelka-gatekeeper: *dockerOptions
|
||||||
so-strelka-manager: *dockerOptions
|
so-strelka-manager: *dockerOptions
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
:DOCKER - [0:0]
|
:DOCKER - [0:0]
|
||||||
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
|
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
|
||||||
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
|
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
|
||||||
-A POSTROUTING -s {{DOCKER.sorange}} ! -o sobridge -j MASQUERADE
|
-A POSTROUTING -s {{DOCKER.range}} ! -o sobridge -j MASQUERADE
|
||||||
{%- for rule in PR %}
|
{%- for rule in PR %}
|
||||||
{{ rule }}
|
{{ rule }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{# add our ip to self #}
|
{# add our ip to self #}
|
||||||
{% do FIREWALL_DEFAULT.firewall.hostgroups.self.append(GLOBALS.node_ip) %}
|
{% do FIREWALL_DEFAULT.firewall.hostgroups.self.append(GLOBALS.node_ip) %}
|
||||||
{# add dockernet range #}
|
{# add dockernet range #}
|
||||||
{% do FIREWALL_DEFAULT.firewall.hostgroups.dockernet.append(DOCKER.sorange) %}
|
{% do FIREWALL_DEFAULT.firewall.hostgroups.dockernet.append(DOCKER.range) %}
|
||||||
|
|
||||||
{% if GLOBALS.role == 'so-idh' %}
|
{% if GLOBALS.role == 'so-idh' %}
|
||||||
{% from 'idh/opencanary_config.map.jinja' import IDH_PORTGROUPS %}
|
{% from 'idh/opencanary_config.map.jinja' import IDH_PORTGROUPS %}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ so-mysql:
|
|||||||
- {{ BINDING }}
|
- {{ BINDING }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
- environment:
|
- environment:
|
||||||
- MYSQL_ROOT_HOST={{ GLOBALS.so_docker_bip }}
|
- MYSQL_ROOT_HOST={{ GLOBALS.so_docker_gateway }}
|
||||||
- MYSQL_ROOT_PASSWORD=/etc/mypass
|
- MYSQL_ROOT_PASSWORD=/etc/mypass
|
||||||
{% if DOCKER.containers['so-mysql'].extra_env %}
|
{% if DOCKER.containers['so-mysql'].extra_env %}
|
||||||
{% for XTRAENV in DOCKER.containers['so-mysql'].extra_env %}
|
{% for XTRAENV in DOCKER.containers['so-mysql'].extra_env %}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ create_playbookdbuser:
|
|||||||
mysql_user.present:
|
mysql_user.present:
|
||||||
- name: playbookdbuser
|
- name: playbookdbuser
|
||||||
- password: {{ PLAYBOOKPASS }}
|
- password: {{ PLAYBOOKPASS }}
|
||||||
- host: "{{ DOCKER.sorange.split('/')[0] }}/255.255.255.0"
|
- host: "{{ DOCKER.range.split('/')[0] }}/255.255.255.0"
|
||||||
- connection_host: {{ GLOBALS.manager }}
|
- connection_host: {{ GLOBALS.manager }}
|
||||||
- connection_port: 3306
|
- connection_port: 3306
|
||||||
- connection_user: root
|
- connection_user: root
|
||||||
@@ -27,7 +27,7 @@ create_playbookdbuser:
|
|||||||
query_playbookdbuser_grants:
|
query_playbookdbuser_grants:
|
||||||
mysql_query.run:
|
mysql_query.run:
|
||||||
- database: playbook
|
- database: playbook
|
||||||
- query: "GRANT ALL ON playbook.* TO 'playbookdbuser'@'{{ DOCKER.sorange.split('/')[0] }}/255.255.255.0';"
|
- query: "GRANT ALL ON playbook.* TO 'playbookdbuser'@'{{ DOCKER.range.split('/')[0] }}/255.255.255.0';"
|
||||||
- connection_host: {{ GLOBALS.manager }}
|
- connection_host: {{ GLOBALS.manager }}
|
||||||
- connection_port: 3306
|
- connection_port: 3306
|
||||||
- connection_user: root
|
- connection_user: root
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ podman_docker_symlink:
|
|||||||
sos_docker_net:
|
sos_docker_net:
|
||||||
docker_network.present:
|
docker_network.present:
|
||||||
- name: sobridge
|
- name: sobridge
|
||||||
- subnet: {{ DOCKER.sorange }}
|
- subnet: {{ DOCKER.range }}
|
||||||
- gateway: {{ DOCKER.sobip }}
|
- gateway: {{ DOCKER.bip }}
|
||||||
- options:
|
- options:
|
||||||
com.docker.network.bridge.name: 'sobridge'
|
com.docker.network.bridge.name: 'sobridge'
|
||||||
com.docker.network.driver.mtu: '1500'
|
com.docker.network.driver.mtu: '1500'
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% do SOCDEFAULTS.soc.config.server.modules.statickeyauth.update({'anonymousCidr': DOCKER.sorange, 'apiKey': pillar.sensoroni.config.sensoronikey}) %}
|
{% do SOCDEFAULTS.soc.config.server.modules.statickeyauth.update({'anonymousCidr': DOCKER.range, 'apiKey': pillar.sensoroni.config.sensoronikey}) %}
|
||||||
|
|
||||||
{% do SOCDEFAULTS.soc.config.server.client.case.update({'analyzerNodeId': GLOBALS.hostname}) %}
|
{% do SOCDEFAULTS.soc.config.server.client.case.update({'analyzerNodeId': GLOBALS.hostname}) %}
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
'md_engine': INIT.PILLAR.global.mdengine,
|
'md_engine': INIT.PILLAR.global.mdengine,
|
||||||
'pipeline': INIT.PILLAR.global.pipeline,
|
'pipeline': INIT.PILLAR.global.pipeline,
|
||||||
'so_version': INIT.PILLAR.global.soversion,
|
'so_version': INIT.PILLAR.global.soversion,
|
||||||
'so_docker_bip': DOCKER.sobip,
|
'so_docker_gateway': DOCKER.gateway,
|
||||||
'so_docker_range': DOCKER.sorange,
|
'so_docker_range': DOCKER.range,
|
||||||
'url_base': INIT.PILLAR.global.url_base,
|
'url_base': INIT.PILLAR.global.url_base,
|
||||||
'so_model': INIT.GRAINS.get('sosmodel',''),
|
'so_model': INIT.GRAINS.get('sosmodel',''),
|
||||||
'sensoroni_key': INIT.PILLAR.sensoroni.config.sensoronikey,
|
'sensoroni_key': INIT.PILLAR.sensoroni.config.sensoronikey,
|
||||||
|
|||||||
@@ -254,15 +254,10 @@ collect_dns_domain() {
|
|||||||
collect_dockernet() {
|
collect_dockernet() {
|
||||||
if ! whiptail_dockernet_check; then
|
if ! whiptail_dockernet_check; then
|
||||||
whiptail_dockernet_sosnet "172.17.1.0"
|
whiptail_dockernet_sosnet "172.17.1.0"
|
||||||
whiptail_dockernet_nososnet "172.17.0.0"
|
|
||||||
|
|
||||||
while ! valid_ip4 "$DOCKERNET"; do
|
while ! valid_ip4 "$DOCKERNET" || [[ $DOCKERNET =~ "172.17.0." ]]; do
|
||||||
whiptail_invalid_input
|
whiptail_invalid_input
|
||||||
whiptail_dockernet_nonsosnet "$DOCKERNET"
|
whiptail_dockernet_sosnet "$DOCKERNET"
|
||||||
done
|
|
||||||
while ! valid_ip4 "$DOCKERNET2"; do
|
|
||||||
whiptail_invalid_input
|
|
||||||
whiptail_dockernet_sosnet "$DOCKERNET2"
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -1099,35 +1094,6 @@ disable_ipv6() {
|
|||||||
} >> /etc/sysctl.conf
|
} >> /etc/sysctl.conf
|
||||||
}
|
}
|
||||||
|
|
||||||
docker_registry() {
|
|
||||||
|
|
||||||
title "Setting up Docker Registry"
|
|
||||||
logCmd "mkdir -p /etc/docker"
|
|
||||||
# This will get applied so docker can attempt to start
|
|
||||||
if [ -z "$DOCKERNET" ]; then
|
|
||||||
DOCKERNET=172.17.0.0
|
|
||||||
fi
|
|
||||||
if [ -z "$DOCKERNET2" ]; then
|
|
||||||
DOCKERNET2=172.17.1.0
|
|
||||||
fi
|
|
||||||
# Make the host use the manager docker registry
|
|
||||||
DNETBIP=$(echo $DOCKERNET | awk -F'.' '{print $1,$2,$3,1}' OFS='.')/24
|
|
||||||
if [ -n "$TURBO" ]; then local proxy="$TURBO"; else local proxy="https://$MSRV"; fi
|
|
||||||
printf '%s\n'\
|
|
||||||
"{"\
|
|
||||||
" \"registry-mirrors\": [ \"$proxy:5000\" ],"\
|
|
||||||
" \"bip\": \"$DNETBIP\","\
|
|
||||||
" \"default-address-pools\": ["\
|
|
||||||
" {"\
|
|
||||||
" \"base\" : \"$DOCKERNET/24\","\
|
|
||||||
" \"size\" : 24"\
|
|
||||||
" }"\
|
|
||||||
" ]"\
|
|
||||||
"}" > /etc/docker/daemon.json
|
|
||||||
info "Docker Registry Setup - Complete"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
docker_seed_update() {
|
docker_seed_update() {
|
||||||
local name=$1
|
local name=$1
|
||||||
local percent_delta=1
|
local percent_delta=1
|
||||||
@@ -1490,16 +1456,6 @@ create_global() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$DOCKERNET" ]; then
|
|
||||||
DOCKERNET=172.17.0.0
|
|
||||||
DOCKERNET2=172.17.1.0
|
|
||||||
DOCKERBIP=$(echo $DOCKERNET | awk -F'.' '{print $1,$2,$3,1}' OFS='.')/24
|
|
||||||
DOCKER2BIP=$(echo $DOCKERNET2 | awk -F'.' '{print $1,$2,$3,1}' OFS='.')
|
|
||||||
else
|
|
||||||
DOCKERBIP=$(echo $DOCKERNET | awk -F'.' '{print $1,$2,$3,1}' OFS='.')/24
|
|
||||||
DOCKER2BIP=$(echo $DOCKERNET2 | awk -F'.' '{print $1,$2,$3,1}' OFS='.')
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$global_pillar_file" ]; then
|
if [ -f "$global_pillar_file" ]; then
|
||||||
rm $global_pillar_file
|
rm $global_pillar_file
|
||||||
fi
|
fi
|
||||||
@@ -1560,12 +1516,15 @@ soctopus_pillar() {
|
|||||||
docker_pillar() {
|
docker_pillar() {
|
||||||
title "Create the docker pillar file"
|
title "Create the docker pillar file"
|
||||||
touch $adv_docker_pillar_file
|
touch $adv_docker_pillar_file
|
||||||
printf '%s\n'\
|
touch $docker_pillar_file
|
||||||
"docker:"\
|
|
||||||
" sorange: '$DOCKERNET2/24'"\
|
if [ ! -z "$DOCKERNET" ]; then
|
||||||
" sobip: '$DOCKER2BIP'"\
|
DOCKERGATEWAY=$(echo $DOCKERNET | awk -F'.' '{print $1,$2,$3,1}' OFS='.')
|
||||||
" range: '$DOCKERNET/24'"\
|
printf '%s\n'\
|
||||||
" bip: '$DOCKERBIP'" > $docker_pillar_file
|
"docker:"\
|
||||||
|
" range: '$DOCKERNET/24'"\
|
||||||
|
" gateway: '$DOCKERGATEWAY'" > $docker_pillar_file
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
redis_pillar() {
|
redis_pillar() {
|
||||||
|
|||||||
@@ -329,20 +329,8 @@ whiptail_dockernet_sosnet() {
|
|||||||
|
|
||||||
[ -n "$TESTING" ] && return
|
[ -n "$TESTING" ] && return
|
||||||
|
|
||||||
DOCKERNET2=$(whiptail --title "$whiptail_title" --inputbox \
|
|
||||||
"\nEnter a /24 size network range for SOS containers to use WITHOUT the /24 suffix. This range will be used on ALL nodes." 11 65 "$1" 3>&1 1>&2 2>&3)
|
|
||||||
|
|
||||||
local exitstatus=$?
|
|
||||||
whiptail_check_exitstatus $exitstatus
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
whiptail_dockernet_nososnet() {
|
|
||||||
|
|
||||||
[ -n "$TESTING" ] && return
|
|
||||||
|
|
||||||
DOCKERNET=$(whiptail --title "$whiptail_title" --inputbox \
|
DOCKERNET=$(whiptail --title "$whiptail_title" --inputbox \
|
||||||
"\nEnter a /24 size network range for NON SOS containers to use WITHOUT the /24 suffix. This range will be used on ALL nodes." 11 65 "$1" 3>&1 1>&2 2>&3)
|
"\nEnter a /24 size network range for SOS containers to use WITHOUT the /24 suffix. This range will be used on ALL nodes. Any range within 172.17.0.0/24 cannot be used." 11 65 "$1" 3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
local exitstatus=$?
|
local exitstatus=$?
|
||||||
whiptail_check_exitstatus $exitstatus
|
whiptail_check_exitstatus $exitstatus
|
||||||
@@ -410,7 +398,7 @@ whiptail_end_settings() {
|
|||||||
|
|
||||||
[[ -n $WEBUSER ]] && __append_end_msg "Web User: $WEBUSER"
|
[[ -n $WEBUSER ]] && __append_end_msg "Web User: $WEBUSER"
|
||||||
|
|
||||||
[[ -n $DOCKERNET ]] && __append_end_msg "Docker network: $DOCKERNET"
|
[[ -n $DOCKERNET ]] && __append_end_msg "Docker network: $DOCKERNET/24"
|
||||||
if [[ ${#ntp_servers[@]} -gt 0 ]]; then
|
if [[ ${#ntp_servers[@]} -gt 0 ]]; then
|
||||||
__append_end_msg "NTP Servers:"
|
__append_end_msg "NTP Servers:"
|
||||||
for server in "${ntp_servers[@]}"; do
|
for server in "${ntp_servers[@]}"; do
|
||||||
|
|||||||
Reference in New Issue
Block a user