obiba / agate

OBiBa's user ID provider.
GNU General Public License v3.0
4 stars 7 forks source link

TLS 1.2 handshake doesnt work on JavaMailSenderImpl #517

Closed massej closed 12 months ago

massej commented 1 year ago

Describe the bug TLS 1.2 handshake doesnt work on JavaMailSenderImpl on port 587.

Error : image

Use a TLS mail server that require at least TLS 1.2.

There is a missing property that need to be set : props.put("mail.smtp.ssl.protocols", "TLSv1.2");

jonathanmassehsj commented 1 year ago

See file : https://github.com/obiba/agate/blob/b6463f73e0bb69c354af8d1bf6b46ec696d677ae/agate-core/src/main/java/org/obiba/agate/config/MailConfiguration.java#L42

massej commented 1 year ago

@ymarcon is there a new version coming to add the missing line?

ymarcon commented 1 year ago

Isn't it something that you can pass in the JAVA_OPTS?

... -Dmail.smtp.ssl.protocols=TLSv1.2 ...

Note: PROP_TLS is for extracting the spring.mail.tls property, which value is a logical.

massej commented 1 year ago

Still doesnt connect.

image

image

massej commented 1 year ago

I forgot to add in the spring.log I also have this

javax.mail.AuthenticationFailedException: 421 4.7.66 TLS 1.0 and 1.1 are not supported. Please upgrade/update your client to support TLS 1.2

massej commented 1 year ago

https://stackoverflow.com/questions/47166425/how-to-force-javamailsenderimpl-to-use-tls1-2

Alot of people have the same issue

returned as an SMTP error by some Microsoft mail server) and didn't go away with 1.5.0-b01; but upgrading to latest available (com.sun.mail:javax-mail:1.6.2) along with the session property, seemed to resolve the issue

We are also using a Microsoft mail server, and when I check the current agate version 2.8.0 of the mailx it is 1.5.0-b01.

I think we just need to update the mailx-mail client to at least 1.6 and it will support TLS 1.2, is it possible to have a docker image with the mailx version 1.6 that I can test on my side?

We are using this docker repos : https://hub.docker.com/r/obiba/agate/tags

meek0 commented 12 months ago

Hi, a new snapshot image is available for testing with your setup. It uses new javax.mail version (1.6.2) and explicitly sets mail ssl protocol to tls1.2

massej commented 12 months ago

I just tested the snapshot version (2.9.0-snapshot), @meek0 everything works! You're the best, thank you!