Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TLS certificates to web UIs across integrations' docker environments #297

Merged
merged 6 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions integrations/docker/compose.amazon-security-lake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,17 @@ services:
- 5601:5601 # Map host port 5601 to container port 5601
expose:
- "5601" # Expose port 5601 for web access to OpenSearch Dashboards
volumes:
- ./certs/:/usr/share/opensearch-dashboards/config/certs/
- ./certs/wazuh.dashboard-key.pem:/usr/share/opensearch-dashboards/config/certs/opensearch.key
- ./certs/wazuh.dashboard.pem:/usr/share/opensearch-dashboards/config/certs/opensearch.pem
- ./certs/root-ca.pem:/usr/share/opensearch-dashboards/config/certs/root-ca.pem
environment:
OPENSEARCH_HOSTS: '["https://wazuh.indexer:9200"]' # Define the OpenSearch nodes that OpenSearch Dashboards will query
SERVER_SSL_ENABLED: 'true'
SERVER_SSL_KEY: '/usr/share/opensearch-dashboards/config/certs/opensearch.key'
SERVER_SSL_CERTIFICATE: '/usr/share/opensearch-dashboards/config/certs/opensearch.pem'
OPENSEARCH_SSL_CERTIFICATEAUTHORITIES: '/usr/share/opensearch-dashboards/config/certs/root-ca.pem'

wazuh.integration.security.lake:
image: wazuh/indexer-security-lake-integration
Expand Down Expand Up @@ -128,10 +137,33 @@ services:
- ../amazon-security-lake/src:/var/task
ports:
- "9000:8080"

generate-certs-config:
image: alpine:latest
volumes:
- ./config:/config
command: |
sh -c "
echo '
nodes:
indexer:
- name: wazuh.indexer
ip: \"wazuh.indexer\"
server:
- name: wazuh.manager
ip: \"wazuh.manager\"
dashboard:
- name: wazuh.dashboard
ip: \"wazuh.dashboard\"
' > /config/certs.yml
"

wazuh-certs-generator:
image: wazuh/wazuh-certs-generator:0.0.1
hostname: wazuh-certs-generator
depends_on:
generate-certs-config:
condition: service_completed_successfully
container_name: wazuh-certs-generator
entrypoint: sh -c "/entrypoint.sh; chown -R 1000:999 /certificates; chmod 740 /certificates; chmod 440 /certificates/*"
volumes:
Expand Down
43 changes: 42 additions & 1 deletion integrations/docker/compose.indexer-elastic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,44 @@ services:
- 5601:5601 # Map host port 5601 to container port 5601
expose:
- "5601" # Expose port 5601 for web access to OpenSearch Dashboards
volumes:
- ./certs/:/usr/share/opensearch-dashboards/config/certs/
- ./certs/wazuh.dashboard-key.pem:/usr/share/opensearch-dashboards/config/certs/opensearch.key
- ./certs/wazuh.dashboard.pem:/usr/share/opensearch-dashboards/config/certs/opensearch.pem
- ./certs/root-ca.pem:/usr/share/opensearch-dashboards/config/certs/root-ca.pem
environment:
OPENSEARCH_HOSTS: '["https://wazuh.indexer:9200"]' # Define the OpenSearch nodes that OpenSearch Dashboards will query
SERVER_SSL_ENABLED: 'true'
SERVER_SSL_KEY: '/usr/share/opensearch-dashboards/config/certs/opensearch.key'
SERVER_SSL_CERTIFICATE: '/usr/share/opensearch-dashboards/config/certs/opensearch.pem'
OPENSEARCH_SSL_CERTIFICATEAUTHORITIES: '/usr/share/opensearch-dashboards/config/certs/root-ca.pem'

generate-certs-config:
image: alpine:latest
volumes:
- ./config:/config
command: |
sh -c "
echo '
nodes:
indexer:
- name: wazuh.indexer
ip: \"wazuh.indexer\"
server:
- name: wazuh.manager
ip: \"wazuh.manager\"
dashboard:
- name: wazuh.dashboard
ip: \"wazuh.dashboard\"
' > /config/certs.yml
"

wazuh-certs-generator:
image: wazuh/wazuh-certs-generator:0.0.1
hostname: wazuh-certs-generator
depends_on:
generate-certs-config:
condition: service_completed_successfully
entrypoint: sh -c "/entrypoint.sh; chown -R 1000:999 /certificates; chmod 740 /certificates; chmod 440 /certificates/*"
volumes:
- ./certs/:/certificates/
Expand Down Expand Up @@ -105,6 +137,12 @@ services:
" - localhost\n"\
" ip:\n"\
" - 127.0.0.1\n"\
" - name: kibana\n"\
" dns:\n"\
" - kibana\n"\
" - localhost\n"\
" ip:\n"\
" - 127.0.0.1\n"\
> config/certs/instances.yml;
bin/elasticsearch-certutil cert --silent --pem -out config/certs/certs.zip --in config/certs/instances.yml --ca-cert config/certs/ca/ca.crt --ca-key config/certs/ca/ca.key;
unzip config/certs/certs.zip -d config/certs;
Expand Down Expand Up @@ -181,12 +219,15 @@ services:
- ELASTICSEARCH_USERNAME=kibana_system
- ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD}
- ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES=config/certs/ca/ca.crt
- SERVER_SSL_ENABLED=true
- SERVER_SSL_KEY=/usr/share/kibana/config/certs/kibana/kibana.key
- SERVER_SSL_CERTIFICATE=/usr/share/kibana/config/certs/kibana/kibana.crt
mem_limit: ${MEM_LIMIT}
healthcheck:
test:
[
'CMD-SHELL',
"curl -s -I http://localhost:5601 | grep -q 'HTTP/1.1 302 Found'",
"curl -s -I https://localhost:5601 | grep -q 'HTTP/1.1 302 Found'",
]
interval: 10s
timeout: 10s
Expand Down
26 changes: 26 additions & 0 deletions integrations/docker/compose.indexer-opensearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,36 @@ services:
SERVER.SSL_CERTIFICATE: '/usr/share/opensearch-dashboards/config/certs/opensearch.pem'
OPENSEARCH_SSL_CERTIFICATEAUTHORITIES: '/usr/share/opensearch-dashboards/config/certs/root-ca.pem'

generate-certs-config:
image: alpine:latest
volumes:
- ./config:/config
command: |
sh -c "
echo '
nodes:
indexer:
- name: wazuh.indexer
ip: \"wazuh.indexer\"
- name: opensearch.node
ip: \"opensearch.node\"
server:
- name: wazuh.manager
ip: \"wazuh.manager\"
dashboard:
- name: wazuh.dashboard
ip: \"wazuh.dashboard\"
- name: opensearch.dashboards
ip: \"opensearch.dashboards\"
' > /config/certs.yml
"

wazuh-certs-generator:
image: wazuh/wazuh-certs-generator:0.0.1
hostname: wazuh-certs-generator
depends_on:
generate-certs-config:
condition: service_completed_successfully
entrypoint: sh -c "/entrypoint.sh; chown -R 1000:999 /certificates; chmod 740 /certificates; chmod 440 /certificates/*"
volumes:
- ./certs/:/certificates/
Expand Down
32 changes: 32 additions & 0 deletions integrations/docker/compose.indexer-splunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,44 @@ services:
- 5601:5601 # Map host port 5601 to container port 5601
expose:
- "5601" # Expose port 5601 for web access to OpenSearch Dashboards
volumes:
- ./certs/:/usr/share/opensearch-dashboards/config/certs/
- ./certs/wazuh.dashboard-key.pem:/usr/share/opensearch-dashboards/config/certs/opensearch.key
- ./certs/wazuh.dashboard.pem:/usr/share/opensearch-dashboards/config/certs/opensearch.pem
- ./certs/root-ca.pem:/usr/share/opensearch-dashboards/config/certs/root-ca.pem
environment:
OPENSEARCH_HOSTS: '["https://wazuh.indexer:9200"]' # Define the OpenSearch nodes that OpenSearch Dashboards will query
SERVER_SSL_ENABLED: 'true'
SERVER_SSL_KEY: '/usr/share/opensearch-dashboards/config/certs/opensearch.key'
SERVER_SSL_CERTIFICATE: '/usr/share/opensearch-dashboards/config/certs/opensearch.pem'
OPENSEARCH_SSL_CERTIFICATEAUTHORITIES: '/usr/share/opensearch-dashboards/config/certs/root-ca.pem'

generate-certs-config:
image: alpine:latest
volumes:
- ./config:/config
command: |
sh -c "
echo '
nodes:
indexer:
- name: wazuh.indexer
ip: \"wazuh.indexer\"
server:
- name: wazuh.manager
ip: \"wazuh.manager\"
dashboard:
- name: wazuh.dashboard
ip: \"wazuh.dashboard\"
' > /config/certs.yml
"

wazuh-certs-generator:
image: wazuh/wazuh-certs-generator:0.0.1
hostname: wazuh-certs-generator
depends_on:
generate-certs-config:
condition: service_completed_successfully
entrypoint: sh -c "/entrypoint.sh; chown -R 1000:999 /certificates; chmod 740 /certificates; chmod 440 /certificates/*"
volumes:
- ./certs/:/certificates/
Expand Down
11 changes: 10 additions & 1 deletion integrations/docker/compose.manager-elastic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ services:
" - localhost\n"\
" ip:\n"\
" - 127.0.0.1\n"\
" - name: kibana\n"\
" dns:\n"\
" - kibana\n"\
" - localhost\n"\
" ip:\n"\
" - 127.0.0.1\n"\
> config/certs/instances.yml;
bin/elasticsearch-certutil cert --silent --pem -out config/certs/certs.zip --in config/certs/instances.yml --ca-cert config/certs/ca/ca.crt --ca-key config/certs/ca/ca.key;
unzip config/certs/certs.zip -d config/certs;
Expand Down Expand Up @@ -226,12 +232,15 @@ services:
- ELASTICSEARCH_USERNAME=kibana_system
- ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD}
- ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES=config/certs/ca/ca.crt
- SERVER_SSL_ENABLED=true
- SERVER_SSL_KEY=/usr/share/kibana/config/certs/kibana/kibana.key
- SERVER_SSL_CERTIFICATE=/usr/share/kibana/config/certs/kibana/kibana.crt
mem_limit: ${MEM_LIMIT}
healthcheck:
test:
[
'CMD-SHELL',
"curl -s -I http://localhost:5601 | grep -q 'HTTP/1.1 302 Found'",
"curl -s -I https://localhost:5601 | grep -q 'HTTP/1.1 302 Found'",
]
interval: 10s
timeout: 10s
Expand Down