This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push: new 7534ba628d Allow getting certificates for OpenSSL 7534ba628d is described below commit 7534ba628de5c6aa035105136ad508bc3beb488c Author: remm <r...@apache.org> AuthorDate: Wed Sep 25 14:20:38 2024 +0200 Allow getting certificates for OpenSSL This reverts the fix for 62712 which was only for the APR connector (OpenSSL seems to work properly for me). I will test again on Tomcat 9.0. --- .../apache/catalina/manager/ManagerServlet.java | 63 +++++++++------------- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/java/org/apache/catalina/manager/ManagerServlet.java b/java/org/apache/catalina/manager/ManagerServlet.java index b1fea500c6..50204b6050 100644 --- a/java/org/apache/catalina/manager/ManagerServlet.java +++ b/java/org/apache/catalina/manager/ManagerServlet.java @@ -1554,32 +1554,24 @@ public class ManagerServlet extends HttpServlet implements ContainerServlet { if (Boolean.TRUE.equals(connector.getProperty("SSLEnabled"))) { SSLHostConfig[] sslHostConfigs = connector.getProtocolHandler().findSslHostConfigs(); for (SSLHostConfig sslHostConfig : sslHostConfigs) { - if (sslHostConfig.getOpenSslContext().longValue() == 0) { - // Not set. Must be JSSE based. - Set<SSLHostConfigCertificate> sslHostConfigCerts = sslHostConfig.getCertificates(); - for (SSLHostConfigCertificate sslHostConfigCert : sslHostConfigCerts) { - String name = connector.toString() + "-" + sslHostConfig.getHostName() + "-" + - sslHostConfigCert.getType(); - List<String> certList = new ArrayList<>(); - SSLContext sslContext = sslHostConfigCert.getSslContext(); - String alias = sslHostConfigCert.getCertificateKeyAlias(); - if (alias == null) { - alias = SSLUtilBase.DEFAULT_KEY_ALIAS; - } - X509Certificate[] certs = sslContext.getCertificateChain(alias); - if (certs == null) { - certList.add(smClient.getString("managerServlet.certsNotAvailable")); - } else { - for (Certificate cert : certs) { - certList.add(cert.toString()); - } + Set<SSLHostConfigCertificate> sslHostConfigCerts = sslHostConfig.getCertificates(); + for (SSLHostConfigCertificate sslHostConfigCert : sslHostConfigCerts) { + String name = connector.toString() + "-" + sslHostConfig.getHostName() + "-" + + sslHostConfigCert.getType(); + List<String> certList = new ArrayList<>(); + SSLContext sslContext = sslHostConfigCert.getSslContext(); + String alias = sslHostConfigCert.getCertificateKeyAlias(); + if (alias == null) { + alias = SSLUtilBase.DEFAULT_KEY_ALIAS; + } + X509Certificate[] certs = sslContext.getCertificateChain(alias); + if (certs == null) { + certList.add(smClient.getString("managerServlet.certsNotAvailable")); + } else { + for (Certificate cert : certs) { + certList.add(cert.toString()); } - result.put(name, certList); } - } else { - List<String> certList = new ArrayList<>(); - certList.add(smClient.getString("managerServlet.certsNotAvailable")); - String name = connector.toString() + "-" + sslHostConfig.getHostName(); result.put(name, certList); } } @@ -1604,21 +1596,16 @@ public class ManagerServlet extends HttpServlet implements ContainerServlet { for (SSLHostConfig sslHostConfig : sslHostConfigs) { String name = connector.toString() + "-" + sslHostConfig.getHostName(); List<String> certList = new ArrayList<>(); - if (sslHostConfig.getOpenSslContext().longValue() == 0) { - // Not set. Must be JSSE based. - SSLContext sslContext = sslHostConfig.getCertificates().iterator().next().getSslContext(); - X509Certificate[] certs = sslContext.getAcceptedIssuers(); - if (certs == null) { - certList.add(smClient.getString("managerServlet.certsNotAvailable")); - } else if (certs.length == 0) { - certList.add(smClient.getString("managerServlet.trustedCertsNotConfigured")); - } else { - for (Certificate cert : certs) { - certList.add(cert.toString()); - } - } - } else { + SSLContext sslContext = sslHostConfig.getCertificates().iterator().next().getSslContext(); + X509Certificate[] certs = sslContext.getAcceptedIssuers(); + if (certs == null) { certList.add(smClient.getString("managerServlet.certsNotAvailable")); + } else if (certs.length == 0) { + certList.add(smClient.getString("managerServlet.trustedCertsNotConfigured")); + } else { + for (Certificate cert : certs) { + certList.add(cert.toString()); + } } result.put(name, certList); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org