Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
FROM opensearchproject/opensearch:2.14.0
FROM opensearchproject/opensearch-dashboards:2.14.0
Describe the issue:
I’m trying to configure TSL/SSL certificate on HTTP and REST layer on opensearch + dashboard on signle node configuration but it kept sending me this error :
{"type":"log","@timestamp":"2024-06-12T11:20:04Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: self-signed certificate"}
{"type":"log","@timestamp":"2024-06-12T11:20:06Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: self-signed certificate"}
Configuration:
compose file
---
version: '3'
services:
opensearch-node:
build:
context: .
dockerfile: ./node-compose
container_name: opensearch-node
ports:
- 9200:9200
environment:
- discovery.type=single-node
- "DISABLE_INSTALL_DEMO_CONFIG=true"
- bootstrap.memory_lock=true
- "OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m"
- "OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- opensearch-data:/usr/share/opensearch/data
networks:
- opensearch-net
opensearch-dashboard:
build:
context: .
dockerfile: ./dashboards-compose
container_name: opensearch-dashboard
ports:
- 5601:5601
networks:
- opensearch-net
volumes:
opensearch-data:
networks:
opensearch-net:
node compose
FROM opensearchproject/opensearch:2.14.0
ADD ./certs/root-ca.pem /usr/share/opensearch/config/root-ca.pem
ADD ./certs/node.pem /usr/share/opensearch/config/node.pem
ADD ./certs/node-key.pem /usr/share/opensearch/config/node-key.pem
ADD ./certs/admin.pem /usr/share/opensearch/config/admin.pem
ADD ./certs/admin-key.pem /usr/share/opensearch/config/admin-key.pem
# ADD custom-security-config.yml /usr/share/opensearch/opensearch-security/config.yml
# ADD custom_roles_mapping.yml /usr/share/opensearch/opensearch-security/roles_mapping.yml
ADD custom-opensearch.yml /usr/share/opensearch/config/opensearch.yml
USER root
RUN chown -R 1000:1000 /usr/share/opensearch/config/
RUN chmod 0700 /usr/share/opensearch/config/
RUN chmod 0600 /usr/share/opensearch/config/opensearch.yml
RUN chmod 0600 /usr/share/opensearch/config/admin.pem
RUN chmod 0600 /usr/share/opensearch/config/admin-key.pem
RUN chmod 0600 /usr/share/opensearch/config/node.pem
RUN chmod 0600 /usr/share/opensearch/config/node-key.pem
RUN chmod 0600 /usr/share/opensearch/config/root-ca.pem
USER opensearch
opensearch.yml
---
network.host: 0.0.0.0
bootstrap.memory_lock: true
plugins.security.disabled: false
plugins.security.ssl.transport.pemcert_filepath: node.pem
plugins.security.ssl.transport.pemkey_filepath: node-key.pem
plugins.security.ssl.transport.pemtrustedcas_filepath: root-ca.pem
plugins.security.ssl.http.enabled: true
plugins.security.ssl.http.pemcert_filepath: node.pem
plugins.security.ssl.http.pemkey_filepath: node-key.pem
plugins.security.ssl.http.pemtrustedcas_filepath: root-ca.pem
plugins.security.allow_unsafe_democertificates: false
plugins.security.authcz.admin_dn:
- '########'
plugins.security.nodes_dn:
- '########'
plugins.security.allow_default_init_securityindex: true
# plugins.security.http.compression: true
plugins.security.audit.type: internal_opensearch
plugins.security.enable_snapshot_restore_privilege: true
plugins.security.check_snapshot_restore_write_privileges: true
plugins.security.restapi.roles_enabled: ["all_access", "security_rest_api_access"]
plugins.security.system_indices.enabled: true
plugins.security.system_indices.indices: [".plugins-ml-config", ".plugins-ml-connector", ".plugins-ml-model-group", ".plugins-ml-model", ".plugins-ml-task", ".plugins-ml-conversation-meta", ".plugins-ml-conversation-interactions", ".opendistro-alerting-config", ".opendistro-alerting-alert*", ".opendistro-anomaly-results*", ".opendistro-anomaly-detector*", ".opendistro-anomaly-checkpoints", ".opendistro-anomaly-detection-state", ".opendistro-reports-*", ".opensearch-notifications-*", ".opensearch-notebooks", ".opensearch-observability", ".ql-datasources", ".opendistro-asynchronous-search-response*", ".replication-metadata-store", ".opensearch-knn-models", ".geospatial-ip2geo-data*"]
dashboard-compose
FROM opensearchproject/opensearch-dashboards:2.14.0
ADD ./certs/root-ca.pem /usr/share/opensearch-dashboards/config/root-ca.pem
ADD ./certs/dashboard.pem /usr/share/opensearch-dashboards/config/dashboard.pem
ADD ./certs/dashboard-key.pem /usr/share/opensearch-dashboards/config/dashboard-key.pem
ADD custom_opensearch_dashboards.yml /usr/share/opensearch-dashboards/config/opensearch_dashboards.yml
USER root
RUN chown -R 1000:1000 /usr/share/opensearch-dashboards/config
USER opensearch-dashboards
opensearch-dashboard.yml
---
opensearch.username: dashboards
opensearch.password: *********
server.host: '0.0.0.0'
opensearch.hosts: ["https://opensearch-node:9200"]
server.ssl.enabled: true
server.ssl.certificate: /usr/share/opensearch-dashboards/config/dashboard.pem
server.ssl.key: /usr/share/opensearch-dashboards/config/dashboard-key.pem
opensearch.ssl.verificationMode: certificate
opensearch.ssl.certificateAuthorities: ["/usr/share/opensearch-dashboards/config/root-ca.pem"]
opensearch_security.multitenancy.enabled: true
opensearch_security.multitenancy.tenants.preferred: ["Private", "Global"]
opensearch_security.readonly_mode.roles: ["kibana_read_only"]
opensearch_security.cookie.secure: true
and generating cert&key following the official doc
Relevant Logs or Screenshots:
{"type":"log","@timestamp":"2024-06-12T11:20:04Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: self-signed certificate"}
{"type":"log","@timestamp":"2024-06-12T11:20:06Z","tags":["error","opensearch","data"],"pid":1,"message":"[ConnectionError]: self-signed certificate"}