1. Describe your incident:
I am trying to migrate a working non-https graylog solution to an https one. I am able to connect to the web interface, but as soon as I do, the docker logs are populated in loop with the following lines:
some-graylog | 2022-03-24 10:29:56,447 WARN : org.graylog2.shared.rest.resources.ProxiedResource - Unable to call https://some-graylog:9000/api/system/metrics/multiple on node <795270ca-9ef2-43de-a800-063115f3a018>: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
some-graylog | 2022-03-24 10:29:58,553 WARN : org.graylog2.shared.rest.resources.ProxiedResource - Unable to call https://some-graylog:9000/api/system/metrics/multiple on node <795270ca-9ef2-43de-a800-063115f3a018>: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
None of the inputs are running. If I try to navigate to system/nodes/, I stumble on an error page with following message:
FetchError: There was an error fetching a resource: Internal Server Error. Additional information: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Check your Graylog logs for more information.
2. Describe your environment:
-
OS Information: Windows 10 + WSL2/ubuntu. I am using wsl2 shells for all the stuff. And a windows 10 browser.
-
Package Version: graylog/graylog:4.2.7-1
-
Service logs, configurations, and environment variables:
Here are the logs before connecting to the web interface:
$ docker logs some-graylog
wait-for-it: waiting 15 seconds for elasticsearch:9200
wait-for-it: timeout occurred after waiting 15 seconds for elasticsearch:9200
2022-03-24 10:42:30,285 INFO : org.graylog2.featureflag.ImmutableFeatureFlagsCollector - Following feature flags are used: {}
2022-03-24 10:42:31,336 INFO : org.graylog2.bootstrap.CmdLineTool - Loaded plugin: AWS plugins 4.2.7 [org.graylog.aws.AWSPlugin]
2022-03-24 10:42:31,338 INFO : org.graylog2.bootstrap.CmdLineTool - Loaded plugin: Integrations 4.2.7 [org.graylog.integrations.IntegrationsPlugin]
2022-03-24 10:42:31,340 INFO : org.graylog2.bootstrap.CmdLineTool - Loaded plugin: Collector 4.2.7 [org.graylog.plugins.collector.CollectorPlugin]
2022-03-24 10:42:31,342 INFO : org.graylog2.bootstrap.CmdLineTool - Loaded plugin: Threat Intelligence Plugin 4.2.7 [org.graylog.plugins.threatintel.ThreatIntelPlugin]
2022-03-24 10:42:31,342 INFO : org.graylog2.bootstrap.CmdLineTool - Loaded plugin: Elasticsearch 6 Support 4.2.7+879e651 [org.graylog.storage.elasticsearch6.Elasticsearch6Plugin]
2022-03-24 10:42:31,343 INFO : org.graylog2.bootstrap.CmdLineTool - Loaded plugin: Elasticsearch 7 Support 4.2.7+879e651 [org.graylog.storage.elasticsearch7.Elasticsearch7Plugin]
2022-03-24 10:42:31,381 INFO : org.graylog2.bootstrap.CmdLineTool - Running with JVM arguments: -Dlog4j2.formatMsgNoLookups=true -Djdk.tls.acknowledgeCloseNotify=true -XX:+UnlockExperimentalVMOptions -XX:NewRatio=1 -XX:MaxMetaspaceSize=256m -XX:+ResizeTLAB -XX:-OmitStackTraceInFastThrow -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSConcurrentMTEnabled -XX:+CMSClassUnloadingEnabled -Dlog4j.configurationFile=/usr/share/graylog/data/config/log4j2.xml -Djava.library.path=/usr/share/graylog/lib/sigar/ -Dgraylog2.installation_source=docker
2022-03-24 10:42:31,628 INFO : org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator null
2022-03-24 10:42:37,841 INFO : org.graylog2.shared.buffers.InputBufferImpl - Message journal is enabled.
2022-03-24 10:42:37,887 INFO : org.graylog2.plugin.system.NodeId - Node ID: 795270ca-9ef2-43de-a800-063115f3a018
2022-03-24 10:42:38,282 INFO : org.graylog.shaded.kafka09.log.LogManager - Loading logs.
2022-03-24 10:42:38,354 INFO : org.graylog.shaded.kafka09.log.LogManager - Logs loading complete.
2022-03-24 10:42:38,361 INFO : org.graylog2.shared.journal.LocalKafkaJournal - Initialized Kafka based journal at data/journal
2022-03-24 10:42:38,432 INFO : org.mongodb.driver.cluster - Cluster created with settings {hosts=[mongo:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=5000}
2022-03-24 10:42:38,565 INFO : org.mongodb.driver.cluster - Cluster description not yet available. Waiting for 30000 ms before timing out
2022-03-24 10:42:38,620 INFO : org.mongodb.driver.connection - Opened connection [connectionId{localValue:1, serverValue:1}] to mongo:27017
2022-03-24 10:42:38,630 INFO : org.mongodb.driver.cluster - Monitor thread successfully connected to server with description ServerDescription{address=mongo:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 4, 12]}, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=6334200}
2022-03-24 10:42:38,657 INFO : org.mongodb.driver.connection - Opened connection [connectionId{localValue:2, serverValue:2}] to mongo:27017
2022-03-24 10:42:38,991 INFO : org.graylog2.shared.buffers.InputBufferImpl - Initialized InputBufferImpl with ring size <65536> and wait strategy <BlockingWaitStrategy>, running 2 parallel message handlers.
2022-03-24 10:42:39,906 INFO : org.graylog2.storage.providers.ElasticsearchVersionProvider - Elasticsearch cluster is running v7.10.2
2022-03-24 10:42:41,288 INFO : org.graylog2.shared.buffers.ProcessBuffer - Initialized ProcessBuffer with ring size <65536> and wait strategy <BlockingWaitStrategy>.
2022-03-24 10:42:41,526 WARN : org.graylog.plugins.map.geoip.GeoIpResolverEngine - GeoIP database file does not exist: /etc/graylog/server/GeoLite2-City.mmdb
2022-03-24 10:42:41,551 INFO : org.graylog2.buffers.OutputBuffer - Initialized OutputBuffer with ring size <65536> and wait strategy <BlockingWaitStrategy>.
2022-03-24 10:42:41,576 INFO : org.mongodb.driver.connection - Opened connection [connectionId{localValue:3, serverValue:3}] to mongo:27017
2022-03-24 10:42:41,614 WARN : org.graylog.plugins.map.geoip.GeoIpResolverEngine - GeoIP database file does not exist: /etc/graylog/server/GeoLite2-City.mmdb
2022-03-24 10:42:41,661 WARN : org.graylog.plugins.map.geoip.GeoIpResolverEngine - GeoIP database file does not exist: /etc/graylog/server/GeoLite2-City.mmdb
2022-03-24 10:42:41,704 WARN : org.graylog.plugins.map.geoip.GeoIpResolverEngine - GeoIP database file does not exist: /etc/graylog/server/GeoLite2-City.mmdb
2022-03-24 10:42:41,743 WARN : org.graylog.plugins.map.geoip.GeoIpResolverEngine - GeoIP database file does not exist: /etc/graylog/server/GeoLite2-City.mmdb
2022-03-24 10:42:42,691 INFO : org.graylog2.bootstrap.ServerBootstrap - Graylog server 4.2.7+879e651 starting up
2022-03-24 10:42:42,692 INFO : org.graylog2.bootstrap.ServerBootstrap - JRE: Oracle Corporation 1.8.0_322 on Linux 5.10.60.1-microsoft-standard-WSL2
2022-03-24 10:42:42,693 INFO : org.graylog2.bootstrap.ServerBootstrap - Deployment: docker
2022-03-24 10:42:42,694 INFO : org.graylog2.bootstrap.ServerBootstrap - OS: Debian GNU/Linux 11 (bullseye) (debian)
2022-03-24 10:42:42,694 INFO : org.graylog2.bootstrap.ServerBootstrap - Arch: amd64
2022-03-24 10:42:42,732 INFO : org.graylog2.shared.initializers.PeriodicalsService - Starting 29 periodicals ...
2022-03-24 10:42:42,733 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.ThroughputCalculator] periodical in [0s], polling every [1s].
2022-03-24 10:42:42,748 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog.plugins.pipelineprocessor.periodical.LegacyDefaultStreamMigration] periodical, running forever.
2022-03-24 10:42:42,774 INFO : org.graylog2.shared.initializers.PeriodicalsService - Not starting [org.graylog2.periodical.AlertScannerThread] periodical. Not configured to run on this node.
2022-03-24 10:42:42,774 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.BatchedElasticSearchOutputFlushThread] periodical in [0s], polling every [1s].
2022-03-24 10:42:42,792 INFO : org.graylog.plugins.pipelineprocessor.periodical.LegacyDefaultStreamMigration - Legacy default stream has no connections, no migration needed.
2022-03-24 10:42:42,808 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.ClusterHealthCheckThread] periodical in [120s], polling every [20s].
2022-03-24 10:42:42,811 INFO : org.graylog2.shared.initializers.PeriodicalsService - Not starting [org.graylog2.periodical.ContentPackLoaderPeriodical] periodical. Not configured to run on this node.
2022-03-24 10:42:42,811 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.GarbageCollectionWarningThread] periodical, running forever.
2022-03-24 10:42:42,814 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.IndexerClusterCheckerThread] periodical in [0s], polling every [30s].
2022-03-24 10:42:42,815 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.IndexRetentionThread] periodical in [0s], polling every [300s].
2022-03-24 10:42:42,816 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.IndexRotationThread] periodical in [0s], polling every [10s].
2022-03-24 10:42:42,818 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.NodePingThread] periodical in [0s], polling every [1s].
2022-03-24 10:42:42,831 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.VersionCheckThread] periodical in [300s], polling every [1800s].
2022-03-24 10:42:42,835 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.ThrottleStateUpdaterThread] periodical in [1s], polling every [1s].
2022-03-24 10:42:42,836 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.events.ClusterEventPeriodical] periodical in [0s], polling every [1s].
2022-03-24 10:42:42,845 INFO : org.mongodb.driver.connection - Opened connection [connectionId{localValue:5, serverValue:5}] to mongo:27017
2022-03-24 10:42:42,846 INFO : org.mongodb.driver.connection - Opened connection [connectionId{localValue:4, serverValue:4}] to mongo:27017
2022-03-24 10:42:42,849 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.events.ClusterEventCleanupPeriodical] periodical in [0s], polling every [86400s].
2022-03-24 10:42:42,859 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.ClusterIdGeneratorPeriodical] periodical, running forever.
2022-03-24 10:42:42,864 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.IndexRangesMigrationPeriodical] periodical, running forever.
2022-03-24 10:42:42,865 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.IndexRangesCleanupPeriodical] periodical in [15s], polling every [3600s].
2022-03-24 10:42:42,878 INFO : org.graylog2.shared.initializers.PeriodicalsService - Not starting [org.graylog2.periodical.UserPermissionMigrationPeriodical] periodical. Not configured to run on this node.
2022-03-24 10:42:42,878 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.ConfigurationManagementPeriodical] periodical, running forever.
2022-03-24 10:42:42,879 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.TrafficCounterCalculator] periodical in [0s], polling every [1s].
2022-03-24 10:42:42,887 INFO : org.mongodb.driver.connection - Opened connection [connectionId{localValue:6, serverValue:6}] to mongo:27017
2022-03-24 10:42:42,887 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.indexer.fieldtypes.IndexFieldTypePollerPeriodical] periodical in [0s], polling every [3600s].
2022-03-24 10:42:42,894 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog.scheduler.periodicals.ScheduleTriggerCleanUp] periodical in [120s], polling every [86400s].
2022-03-24 10:42:42,907 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog2.periodical.ESVersionCheckPeriodical] periodical in [0s], polling every [30s].
2022-03-24 10:42:42,928 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog.plugins.sidecar.periodical.PurgeExpiredSidecarsThread] periodical in [0s], polling every [600s].
2022-03-24 10:42:42,941 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog.plugins.sidecar.periodical.PurgeExpiredConfigurationUploads] periodical in [0s], polling every [600s].
2022-03-24 10:42:42,959 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog.plugins.views.search.db.SearchesCleanUpJob] periodical in [3600s], polling every [28800s].
2022-03-24 10:42:42,961 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog.events.periodicals.EventNotificationStatusCleanUp] periodical in [120s], polling every [86400s].
2022-03-24 10:42:43,020 INFO : org.graylog2.periodical.Periodicals - Starting [org.graylog.plugins.collector.periodical.PurgeExpiredCollectorsThread] periodical in [0s], polling every [3600s].
2022-03-24 10:42:47,024 INFO : org.glassfish.grizzly.http.server.NetworkListener - Started listener bound to [some-graylog:9000]
2022-03-24 10:42:47,026 INFO : org.glassfish.grizzly.http.server.HttpServer - [HttpServer] Started.
2022-03-24 10:42:47,027 INFO : org.graylog2.shared.initializers.JerseyService - Started REST API at <some-graylog:9000>
2022-03-24 10:42:47,027 INFO : org.graylog2.shared.initializers.ServiceManagerListener - Services are healthy
2022-03-24 10:42:47,029 INFO : org.graylog2.bootstrap.ServerBootstrap - Services started, startup times in ms: {FailureHandlingService [RUNNING]=3, GracefulShutdownService [RUNNING]=33, LocalKafkaMessageQueueReader [RUNNING]=33, LocalKafkaMessageQueueWriter [RUNNING]=33, UserSessionTerminationService [RUNNING]=35, UrlWhitelistService [RUNNING]=53, PrometheusExporter [RUNNING]=54, LocalKafkaJournal [RUNNING]=54, InputSetupService [RUNNING]=56, BufferSynchronizerService [RUNNING]=62, MongoDBProcessingStatusRecorderService [RUNNING]=76, JobSchedulerService [RUNNING]=96, EtagService [RUNNING]=97, ConfigurationEtagService [RUNNING]=98, OutputSetupService [RUNNING]=101, LookupTableService [RUNNING]=186, PeriodicalsService [RUNNING]=294, StreamCacheService [RUNNING]=338, JerseyService [RUNNING]=4297}
2022-03-24 10:42:47,030 INFO : org.graylog2.shared.initializers.InputSetupService - Triggering launching persisted inputs, node transitioned from Uninitialized [LB:DEAD] to Running [LB:ALIVE]
2022-03-24 10:42:47,049 INFO : org.graylog2.bootstrap.ServerBootstrap - Graylog server up and running.
2022-03-24 10:42:47,068 INFO : org.graylog2.inputs.InputStateListener - Input [GELF UDP/62347edb3fbc7b573dc69969] is now STARTING
2022-03-24 10:42:47,198 INFO : org.graylog2.inputs.InputStateListener - Input [GELF UDP/62347edb3fbc7b573dc69969] is now RUNNING
And after connecting to the web interface:
2022-03-24 10:44:30,941 WARN : org.graylog2.shared.rest.resources.ProxiedResource - Unable to call https://some-graylog:9000/api/system/metrics/multiple on node <795270ca-9ef2-43de-a800-063115f3a018>: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2022-03-24 10:44:32,472 WARN : org.graylog2.shared.rest.resources.ProxiedResource - Unable to call https://some-graylog:9000/api/system/metrics/multiple on node <795270ca-9ef2-43de-a800-063115f3a018>: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2022-03-24 10:44:34,436 WARN : org.graylog2.shared.rest.resources.ProxiedResource - Unable to call https://some-graylog:9000/api/system/metrics/multiple on node <795270ca-9ef2-43de-a800-063115f3a018>: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2022-03-24 10:44:36,443 WARN : org.graylog2.shared.rest.resources.ProxiedResource - Unable to call https://some-graylog:9000/api/system/metrics/multiple on node <795270ca-9ef2-43de-a800-063115f3a018>: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2022-03-24 10:44:38,477 WARN : org.graylog2.shared.rest.resources.ProxiedResource - Unable to call https://some-graylog:9000/api/system/metrics/multiple on node <795270ca-9ef2-43de-a800-063115f3a018>: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
3. What steps have you already taken to try and solve the problem?
Making a self signed certificate. Here’s my openssl file:
[req]
# Options for the `req` tool (`man req`).
default_bits = 4096
distinguished_name = req_distinguished_name
string_mask = utf8only
# SHA-1 is deprecated, so use SHA-2 instead.
default_md = sha256
# Extension to add when the -x509 option is used.
x509_extensions = v3_req
prompt = no
[ req_distinguished_name ]
# See <https://en.wikipedia.org/wiki/Certificate_signing_request>.
C = US
ST = Some-State
L = Some-City
O = My Company
OU = My Division
CN = some-graylog
[v3_req]
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
# IP addresses and DNS names the certificate should include
# Use IP.### for IP addresses and DNS.### for DNS names,
# with "###" being a consecutive number.
[alt_names]
IP.1 = 127.0.0.1
DNS.1 = localhost
DNS.2 = some-graylog
After certificates generation, I added the cert.pem file to Windows, then I modified the docker file to add the cert to the keystore:
FROM graylog/graylog:4.2.7-1
# I don't know ho to do the following at running by altering entrypoint
USER root
COPY cert.pem /cert.pem
# add certificate to keystore
RUN rm -f /usr/share/graylog/cacerts.jks \
&& cp -a "${JAVA_HOME}/lib/security/cacerts" /usr/share/graylog/cacerts.jks \
&& keytool -noprompt -importcert -keystore /usr/share/graylog/cacerts.jks -storepass changeit -alias graylog-self-signed -file /cert.pem \
&& rm -f /cert.pem \
&& chown graylog:graylog /usr/share/graylog/cacerts.jks
USER graylog
While building the image, I could see that the cert was added to the keystore - and checked it via:
docker exec -it some-graylog bash
keytool -list -v -keystore cacerts.jks | grep graylog-self-signed
Here is the relevant part of the docker compose file:
graylog:
build: ./some-graylog
container_name: some-graylog
hostname: some-graylog
volumes:
- graylog-storage:/usr/share/graylog/data:rw
- ./some-graylog/plugin:/usr/share/graylog/plugin:ro
- /etc/certs/graylog:/etc/certs/graylog:ro
environment:
- GRAYLOG_SERVER_JAVA_OPTS ="-Xms8G -Xmx8G -Djavax.net.ssl.trustStore=/usr/share/graylog/cacerts.jks"
# CHANGE ME (must be at least 16 characters)!
- GRAYLOG_PASSWORD_SECRET=somepasswordpepper
# User / Password: admin/admin
- GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
# http://docs.graylog.org/en/3.0/pages/configuration/server.conf.html#web-rest-api
# https://archivedocs.graylog.org/en/3.0/pages/upgrade/graylog-3.0.html#simplified-http-interface-configuration
# https://hometechhacker.com/how-to-create-a-graylog-container-in-docker/
- GRAYLOG_HTTP_BIND_ADDRESS=some-graylog:9000
- GRAYLOG_HTTP_ENABLE_TLS=true
- GRAYLOG_HTTP_TLS_CERT_FILE= /etc/certs/graylog/cert.pem
- GRAYLOG_HTTP_TLS_KEY_FILE= /etc/certs/graylog/pkcs8-encrypted.pem
# The following env variable is stored in a dedicated env file
#- GRAYLOG_HTTP_TLS_KEY_PASSWORD=
entrypoint: /usr/bin/tini -- wait-for-it elasticsearch:9200 -- /docker-entrypoint.sh
networks:
- graylog
restart: "no"
depends_on:
- fluentd
- mongo
- elasticsearch
ports:
# Graylog web interface and REST API
- 9000:9000
# Syslog TCP
- 1514:1514
# Syslog UDP
- 1514:1514/udp
# GELF TCP
- 12201:12201
# GELF UDP
- 12201:12201/udp
env_file:
- ./some-graylog/graylog.env
The env file export GRAYLOG_HTTP_TLS_KEY_PASSWORD (used to encrypt the cert).
4. How can the community help?
I think I am almost there. From what I saw on forums, it seems that this error is due to a missing cert in the java keystore, but I verified it was added. Maybe there is an issue with the openssl configuration file ?
Best regards,
Jean-Pierre