7 Replies Latest reply on Dec 31, 2013 12:43 AM by Ricardo Arguello

    Custom ssl configuration in mail subsystem

    Alexey Volkov Newbie

      Hello.

       

      I'm using JBoss 7.1  and try to use mail subsystem, but my smtp server has server certificate that should be trusted. Is there any way to configure connection to server using ssl with certificates (like connector for web-subsystem)?

       

      here is mail substem configuration:

              <subsystem xmlns="urn:jboss:domain:mail:1.0">

                  <mail-session jndi-name="java:jboss/mail/Default">

                      <smtp-server outbound-socket-binding-ref="mail-smtp" ssl="true">

                                  <login name="login" password="password" />

                      </smtp-server>

                  </mail-session>

              </subsystem>

      ....

                 <outbound-socket-binding name="mail-smtp">

                     <remote-destination host="server.url" port="587"/>

                </outbound-socket-binding>

       

       

      When I try to send mail I have this exception:

       

      Caused by: javax.mail.MessagingException: Could not connect to SMTP host: server.url, port: 587;

        nested exception is:

                javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

                at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)

                at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)

                at javax.mail.Service.connect(Service.java:317)

                at javax.mail.Service.connect(Service.java:176)

                at javax.mail.Service.connect(Service.java:125)

                at javax.mail.Transport.send0(Transport.java:194)

                at javax.mail.Transport.send(Transport.java:124)

                at test.base.SendEmailBean.construct(SendEmailBean.java:32)

                ... 39 more

      Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

                at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) [jsse.jar:1.7.0_05]

                at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1868) [jsse.jar:1.7.0_05]

                at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276) [jsse.jar:1.7.0_05]

                at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270) [jsse.jar:1.7.0_05]

                at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1338) [jsse.jar:1.7.0_05]

                at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:154) [jsse.jar:1.7.0_05]

                at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868) [jsse.jar:1.7.0_05]

                at sun.security.ssl.Handshaker.process_record(Handshaker.java:804) [jsse.jar:1.7.0_05]

                at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:998) [jsse.jar:1.7.0_05]

                at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1294) [jsse.jar:1.7.0_05]

                at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1321) [jsse.jar:1.7.0_05]

                at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1305) [jsse.jar:1.7.0_05]

                at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:507)

                at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)

                at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)

                ... 46 more

      Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

                at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385) [rt.jar:1.7.0_05]

                at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292) [rt.jar:1.7.0_05]

                at sun.security.validator.Validator.validate(Validator.java:260) [rt.jar:1.7.0_05]

                at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:326) [jsse.jar:1.7.0_05]

                at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231) [jsse.jar:1.7.0_05]

                at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126) [jsse.jar:1.7.0_05]

                at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1320) [jsse.jar:1.7.0_05]

                ... 56 more

      Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

                at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196) [rt.jar:1.7.0_05]

                at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268) [rt.jar:1.7.0_05]

                at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380) [rt.jar:1.7.0_05]

                ... 62 more