[java-idp-integration-tests] branch main updated: Set jetty.ssl.sniHostCheck=false for Jetty 10

Tom Zeller tzeller at dragonacea.biz
Thu Jan 27 23:36:41 UTC 2022


This is an automated email from the git hooks/post-receive script.

tzeller pushed a commit to branch main
in repository java-idp-integration-tests.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=f405f689fb26e47aee35d693037002746f05a403

The following commit(s) were added to refs/heads/main by this push:
     new f405f68  Set jetty.ssl.sniHostCheck=false for Jetty 10
f405f68 is described below

commit f405f689fb26e47aee35d693037002746f05a403
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Thu Jan 27 17:36:33 2022 -0600

    Set jetty.ssl.sniHostCheck=false for Jetty 10
---
 .../shibboleth/idp/test/BaseIntegrationTest.java   | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 79da553..2ea0313 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -370,6 +370,9 @@ public abstract class BaseIntegrationTest
 
     /** IdP version determined from distribution name. **/
     @Nullable protected String idpVersion;
+    
+    /** Jetty version determined from distribution name. **/
+    @Nullable protected String jettyVersion;
 
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(BaseIntegrationTest.class);
@@ -564,6 +567,17 @@ public abstract class BaseIntegrationTest
             log.debug("Path to jetty.home '{}'", pathToJettyHome.toAbsolutePath());
             Assert.assertTrue(pathToJettyHome.toAbsolutePath().toFile().exists(), "Path to jetty.home not found");
 
+            // Determine Jetty version from distribution name
+            final Pattern pattern = Pattern.compile("jetty-home-(.*)");
+            final Matcher matcher = pattern.matcher(pathToJettyHome.getFileName().toString());
+            if (matcher.find()) {
+                jettyVersion = matcher.group(1);
+            }
+            log.debug("Testing Jetty version '{}'", jettyVersion);
+            if (jettyVersion == null || jettyVersion.isBlank()) {
+                log.error("Unable to determine version of Jetty");
+            }
+
             // Path to jetty.base
             pathToJettyBase = pathToIdPHome.resolve(Paths.get("jetty-base"));
             log.debug("Path to jetty.base '{}'", pathToJettyBase.toAbsolutePath());
@@ -580,6 +594,26 @@ public abstract class BaseIntegrationTest
         }
     }
 
+    /**
+     * Disable SNI host check by adding jetty.ssl.sniHostCheck=false to idp.ini for Jetty after version 9.
+     * 
+     * @throws IOException
+     */
+    @BeforeClass(enabled = true, dependsOnMethods = {"setUpJettyPaths"})
+    public void setUpJettySNI() throws IOException {
+        if (jettyVersion.startsWith("9")) {
+            return;
+        } ;
+        final Path idpIni = pathToJettyBase.resolve(Paths.get("start.d", "idp.ini"));
+        log.debug("Path to idp.ini '{}'", idpIni.toAbsolutePath());
+        if (idpIni.toAbsolutePath().toFile().exists()) {
+            log.debug("Disabling Jetty SNI host check for version '{}'", jettyVersion);
+            replaceFile(idpIni, "\\z", System.lineSeparator() + "jetty.ssl.sniHostCheck=false");
+        } else {
+            Assert.fail("Unable to find idp.ini");
+        }
+    }
+
     /**
      * Add testbed webapp to Jetty.
      * 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list