Graylog transport email error using gmail as smtp

I am using gmail smtp settings in graylog/server.conf file.

Getting below error message when try to send test mail
"The Graylog server encountered an error while trying to send an email. This is the detailed error message: org.apache.commons.mail.EmailException: Sending the email to the following server failed : (javax.mail.MessagingException: Could not connect to SMTP host:, port: 465; nested exception is: PKIX path building failed: unable to find valid certification path to requested target)"

Even I have tried our company mail server SMTP keeping SSL and TLS option set as true, but getting same error as mentioned above.

How to solve this?

Any help will be apprecaited.

Are you using a custom trust store for your JVM?
Are you using the latest “official” trust store (e. g. via the package ca-certificates-java if you’re using Ubuntu Linux) for your JVM?

I have followed the Graylog documentation to create the self signed certificate.

How to confirm whether it is a custom trust store for JVM or usind package ca-certificates-java?

What have you been doing exactly?
What JVM command line parameters are you using?

I have placed below JAVA_OPTS inside /etc/default/graylog-server

GRAYLOG_SERVER_JAVA_OPTS="-Xms1g -Xmx1g -XX:NewRatio=1 -server -XX:+ResizeTLAB -XX:+UseConcMarkSweepGC -XX:+CMSConcurrentMTEnabled -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC -XX:-OmitStackTraceInFastThrow"

After that I was able to start Graylog with TLS enable.

You’re overwriting the default trust store, which contains all well-known certificate authorities (i. e. the one that issued the certificate for with the system property.

I think Gmail certificates is already there inside truststore, below is the output

keytool -keystore /etc/ssl/certs/java/cacerts.jks -storepass xxxxx -list | grep globalsign

debian:globalsign_root_ca_-r3.pem, Nov 23, 2017, trustedCertEntry,
-r5.pem, Nov 23, 2017, trustedCertEntry,
-r2.pem, Nov 23, 2017, trustedCertEntry,
-_r4.pem, Nov 23, 2017, trustedCertEntry,
debian:globalsign_root_ca.pem, Nov 23, 2017, trustedCertEntry,

Yes, but you’re using /etc/graylog/ssl/keystore.jks as your JVM trust store with Graylog…

Thank You for pointing the exact cause of issue.

Is there a way to import all default certificate authorities into /etc/graylog/ssl/keystore.jks?

Reason of creating this custom keystore is just only to enable TLS which was not working with default cacerts.jks.

Why not do it the other way round and import your self-signed certificates or your custom CA certificate into the existing trust store?

Other than that, you could use keytool -importkeystore to import the contents of the existing trust store into your own trust store:

1 Like

Thank You so much.

I have imported existing CA to /etc/graylog/ssl/keystore.jks and now mails are getting triggered based on event condition.

:Nishit Shah

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.