无法使用Play-Mailer 5.0禁用TLS v1.0(使用Play 2.5.x)

时间:2018-09-17 16:55:43

标签: security playframework java-security

我使用java.security(使用Java 8)文件在Play网络服务器(2.5.x + Scala)上禁用了TLS版本,如下所示:

jdk.tls.disabledAlgorithms=SSLv3, TLSv1, RC4, MD5withRSA, DH keySize < 768, \
    EC keySize < 224, 3DES_EDE_CBC

使用此更改(TLSv1),我无法将电子邮件发送到smtp.gmail.com:465。我正在使用播放邮件程序版本5.0.0。 application.conf文件中的设置:

host = smtp.gmail.com
port = 465
ssl = yes

我收到以下错误:

Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2055)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697)
    at javax.mail.Service.connect(Service.java:386)
    at javax.mail.Service.connect(Service.java:245)
    at javax.mail.Service.connect(Service.java:194)
    at javax.mail.Transport.send0(Transport.java:253)
    at javax.mail.Transport.send(Transport.java:124)
    at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411)
    at org.apache.commons.mail.Email.send(Email.java:1448)
    at play.api.libs.mailer.SMTPMailer$$anon$2.send(MailerPlugin.scala:100)
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
    at sun.security.ssl.Handshaker.activate(Handshaker.java:503)
    at sun.security.ssl.SSLSocketImpl.kickstartHandshake(SSLSocketImpl.java:1482)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1351)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:543)
    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:348)
    at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:215)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2019)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697)

2 个答案:

答案 0 :(得分:1)

问题已解决。参考:https://github.com/playframework/play-mailer/issues/150

简而言之:通过系统属性配置ssl协议。

答案 1 :(得分:0)

这看起来像预期的行为。您将收到协议被禁用的例外。您期望什么行为?