From cc12196d533893867454c4b506ef9d04fb037b66 Mon Sep 17 00:00:00 2001 From: Rob Rudin Date: Fri, 8 Sep 2023 15:00:17 -0400 Subject: [PATCH 1/4] Bumped dev to 4.6-SNAPSHOT --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index e69f49a5..0b1e3f8c 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group = "com.marklogic" -version = "4.6.0" +version = "4.6-SNAPSHOT" java { sourceCompatibility = 1.8 From 82365c41a03144b252afa1d8d89178679d232c53 Mon Sep 17 00:00:00 2001 From: Rob Rudin Date: Fri, 6 Oct 2023 14:18:52 -0400 Subject: [PATCH 2/4] DEVEXP-589 Fixing bug with simple SSL for Manage and Admin servers "simpleSsl" now sets the SSL hostname verifier to ANY, mirroring what happens for the Java Client connections as well. --- .../com/marklogic/rest/util/RestConfig.java | 4 +++- .../mgmt/DefaultManageConfigFactoryTest.java | 14 +++++++++++ .../admin/DefaultAdminConfigFactoryTest.java | 24 +++++++++++++++---- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/marklogic/rest/util/RestConfig.java b/src/main/java/com/marklogic/rest/util/RestConfig.java index 4152e40e..233d8e94 100644 --- a/src/main/java/com/marklogic/rest/util/RestConfig.java +++ b/src/main/java/com/marklogic/rest/util/RestConfig.java @@ -17,6 +17,7 @@ import com.marklogic.client.DatabaseClientBuilder; import com.marklogic.client.DatabaseClientFactory; +import com.marklogic.client.DatabaseClientFactory.SSLHostnameVerifier; import com.marklogic.client.ext.modulesloader.ssl.SimpleX509TrustManager; import com.marklogic.client.ext.ssl.SslConfig; import com.marklogic.client.ext.ssl.SslUtil; @@ -114,7 +115,8 @@ public DatabaseClientBuilder newDatabaseClientBuilder() { .withSSLContext(StringUtils.hasText(sslProtocol) ? SimpleX509TrustManager.newSSLContext(sslProtocol) : SimpleX509TrustManager.newSSLContext()) - .withTrustManager(new SimpleX509TrustManager()); + .withTrustManager(new SimpleX509TrustManager()) + .withSSLHostnameVerifier(SSLHostnameVerifier.ANY); } else { builder.withSSLProtocol(sslProtocol); } diff --git a/src/test/java/com/marklogic/mgmt/DefaultManageConfigFactoryTest.java b/src/test/java/com/marklogic/mgmt/DefaultManageConfigFactoryTest.java index a51caca7..e10eecd4 100644 --- a/src/test/java/com/marklogic/mgmt/DefaultManageConfigFactoryTest.java +++ b/src/test/java/com/marklogic/mgmt/DefaultManageConfigFactoryTest.java @@ -16,6 +16,7 @@ package com.marklogic.mgmt; import com.marklogic.client.DatabaseClientFactory; +import com.marklogic.client.DatabaseClientFactory.SSLHostnameVerifier; import com.marklogic.mgmt.util.SimplePropertySource; import org.junit.jupiter.api.Test; @@ -104,6 +105,19 @@ public void sslProperties() { assertEquals("PKIX", config.getTrustManagementAlgorithm()); } + @Test + void simpleSsl() { + ManageConfig config = configure( + "mlManageSimpleSsl", "true", + "mlUsername", "admin", + "mlPassword", "admin" + ); + + DatabaseClientFactory.Bean bean = config.newDatabaseClientBuilder().buildBean(); + SSLHostnameVerifier verifier = bean.getSecurityContext().getSSLHostnameVerifier(); + assertEquals(SSLHostnameVerifier.ANY, verifier, "simpleSsl should default to using the ANY hostname verifier"); + } + @Test public void mlHost() { ManageConfig config = configure("mlHost", "host1"); diff --git a/src/test/java/com/marklogic/mgmt/admin/DefaultAdminConfigFactoryTest.java b/src/test/java/com/marklogic/mgmt/admin/DefaultAdminConfigFactoryTest.java index 8e1e7bb8..5f164a89 100644 --- a/src/test/java/com/marklogic/mgmt/admin/DefaultAdminConfigFactoryTest.java +++ b/src/test/java/com/marklogic/mgmt/admin/DefaultAdminConfigFactoryTest.java @@ -15,15 +15,16 @@ */ package com.marklogic.mgmt.admin; -import com.marklogic.client.DatabaseClientFactory; -import com.marklogic.mgmt.util.SimplePropertySource; -import org.junit.jupiter.api.Test; - import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.Test; + +import com.marklogic.client.DatabaseClientFactory; +import com.marklogic.client.DatabaseClientFactory.SSLHostnameVerifier; +import com.marklogic.mgmt.util.SimplePropertySource; + public class DefaultAdminConfigFactoryTest { @Test @@ -75,6 +76,19 @@ public void sslProperties() { assertEquals("PKIX", config.getTrustManagementAlgorithm()); } + @Test + void simpleSsl() { + AdminConfig config = configure( + "mlAdminSimpleSsl", "true", + "mlUsername", "admin", + "mlPassword", "admin" + ); + + DatabaseClientFactory.Bean bean = config.newDatabaseClientBuilder().buildBean(); + SSLHostnameVerifier verifier = bean.getSecurityContext().getSSLHostnameVerifier(); + assertEquals(SSLHostnameVerifier.ANY, verifier, "simpleSsl should default to using the ANY hostname verifier"); + } + @Test void cloudApiKeyAndBasePath() { AdminConfig config = configure( From c338b0cba99035c328574f20713ec38f2386a29b Mon Sep 17 00:00:00 2001 From: Rob Rudin Date: Thu, 11 Jan 2024 08:45:42 -0500 Subject: [PATCH 3/4] MLE-11792 Submitting one request per custom forests file Addresses a support ticket where 900+ forests are in a single file and the request times out. --- .../forests/DeployCustomForestsCommand.java | 22 +++++++++---------- .../forests/DeployCustomForestsTest.java | 7 ++++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/marklogic/appdeployer/command/forests/DeployCustomForestsCommand.java b/src/main/java/com/marklogic/appdeployer/command/forests/DeployCustomForestsCommand.java index 6c01948a..c29ecef0 100644 --- a/src/main/java/com/marklogic/appdeployer/command/forests/DeployCustomForestsCommand.java +++ b/src/main/java/com/marklogic/appdeployer/command/forests/DeployCustomForestsCommand.java @@ -49,28 +49,19 @@ public DeployCustomForestsCommand() { @Override public void execute(CommandContext context) { - Configuration configuration = null; - if (context.getAppConfig().getCmaConfig().isDeployForests()) { - configuration = new Configuration(); - } - for (ConfigDir configDir : context.getAppConfig().getConfigDirs()) { File dir = new File(configDir.getBaseDir(), customForestsPath); if (dir != null && dir.exists()) { payloadParser = new PayloadParser(); for (File f : dir.listFiles()) { if (f.isDirectory()) { - processDirectory(f, context, configuration); + processDirectory(f, context); } } } else { logResourceDirectoryNotFound(dir); } } - - if (configuration != null) { - deployConfiguration(context, configuration); - } } /** @@ -79,7 +70,7 @@ public void execute(CommandContext context) { * @param dir * @param context */ - protected void processDirectory(File dir, CommandContext context, Configuration configuration) { + protected void processDirectory(File dir, CommandContext context) { if (logger.isInfoEnabled()) { logger.info("Processing custom forest files in directory: " + dir.getAbsolutePath()); } @@ -91,6 +82,11 @@ protected void processDirectory(File dir, CommandContext context, Configuration } String payload = readResourceFromFile(context, f); + // As of 4.6.1, create a CMA request per file so that the user has control over how many forests are + // submitted in a single request, thus avoiding potential timeouts. + Configuration configuration = context.getAppConfig().getCmaConfig().isDeployForests() ? + new Configuration() : null; + if (payloadParser.isJsonPayload(payload)) { if (configuration != null) { addForestsToCmaConfiguration(context, payload, configuration); @@ -104,6 +100,10 @@ protected void processDirectory(File dir, CommandContext context, Configuration mgr.save(payload); } } + + if (configuration != null) { + deployConfiguration(context, configuration); + } } } diff --git a/src/test/java/com/marklogic/appdeployer/command/forests/DeployCustomForestsTest.java b/src/test/java/com/marklogic/appdeployer/command/forests/DeployCustomForestsTest.java index 751eb062..49f3e8ff 100644 --- a/src/test/java/com/marklogic/appdeployer/command/forests/DeployCustomForestsTest.java +++ b/src/test/java/com/marklogic/appdeployer/command/forests/DeployCustomForestsTest.java @@ -51,9 +51,12 @@ public void test() { assertTrue(mgr.exists("sample-app-content-custom-3")); } + /** + * Can examine logging to verify that one request is made per forest. + */ @Test - public void deployWithCma() { - appConfig.getCmaConfig().enableAll(); + public void deployWithoutCMA() { + appConfig.getCmaConfig().setDeployForests(false); test(); } } From 54c098a40bf262d4561848d42a358ecf73fe4d91 Mon Sep 17 00:00:00 2001 From: Rob Rudin Date: Thu, 11 Jan 2024 10:31:37 -0500 Subject: [PATCH 4/4] Bumped to 4.6.1 --- build.gradle | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 0b1e3f8c..a90f26ed 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ plugins { } group = "com.marklogic" -version = "4.6-SNAPSHOT" +version = "4.6.1" java { sourceCompatibility = 1.8 diff --git a/pom.xml b/pom.xml index 22830b64..8c8a31b5 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ It is not intended to be used to build this project. 4.0.0 com.marklogic ml-app-deployer - 4.6.0 + 4.6.1 com.marklogic:ml-app-deployer Java client for the MarkLogic REST Management API and for deploying applications to MarkLogic https://github.com/marklogic/ml-app-deployer