From c3b4c118365a78e2af09e8ddbe0f2158f52b2472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Muzik=C3=A1=C5=99?= Date: Thu, 1 Aug 2024 18:16:37 +0200 Subject: [PATCH] Fix mail ssl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Václav Muzikář --- pom.xml | 1 - .../java/org/keycloak/email/DefaultEmailSenderProvider.java | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 95910eab9050..7ce7d062b9ff 100644 --- a/pom.xml +++ b/pom.xml @@ -104,7 +104,6 @@ 2.0.1 - 2.0.1 4.0.0 3.0.0 diff --git a/services/src/main/java/org/keycloak/email/DefaultEmailSenderProvider.java b/services/src/main/java/org/keycloak/email/DefaultEmailSenderProvider.java index 41609a5ead98..9b6f20b68bab 100644 --- a/services/src/main/java/org/keycloak/email/DefaultEmailSenderProvider.java +++ b/services/src/main/java/org/keycloak/email/DefaultEmailSenderProvider.java @@ -192,7 +192,10 @@ private void setupTruststore(Properties props) { props.put("mail.smtp.ssl.socketFactory", factory); if (configurator.getProvider().getPolicy() == HostnameVerificationPolicy.ANY) { props.setProperty("mail.smtp.ssl.trust", "*"); - props.put("mail.smtp.ssl.checkserveridentity", Boolean.FALSE.toString()); + props.put("mail.smtp.ssl.checkserveridentity", Boolean.FALSE.toString()); // this should be the default but seems to be impl specific, so set it explicitly just to be sure + } + else { + props.put("mail.smtp.ssl.checkserveridentity", Boolean.TRUE.toString()); } } }