-
Notifications
You must be signed in to change notification settings - Fork 4
DATAGO-116001: event-management-agent: Configure JCSMP to use default JDK truststore for Event Portal connections #282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
513803d
7db131c
5ce4699
0a337d0
4bd47ce
6bb8041
01b42a3
8559ebe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package com.solace.maas.ep.event.management.agent.plugin.common.util; | ||
|
|
||
| import org.springframework.stereotype.Component; | ||
|
|
||
| @Component | ||
| public class EnvironmentUtil { | ||
|
|
||
| /** | ||
| * Checks if custom CA certificates are present via the CUSTOM_CA_CERTS_PRESENT environment variable. | ||
| * Currently, Only Private CEMAs are capable of importing and using custom ca certs for operating ep runtime operations | ||
| * on brokers that may be setup with certs signed by custom ca | ||
| * @return true if CUSTOM_CA_CERTS_PRESENT is set to "1", false otherwise | ||
| */ | ||
| public boolean isCustomCACertPresent() { | ||
| String customCaCertsPresent = System.getenv("CUSTOM_CA_CERTS_PRESENT"); | ||
| return "1".equals(customCaCertsPresent); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |||||
| import com.solace.maas.ep.event.management.agent.plugin.jacoco.ExcludeFromJacocoGeneratedReport; | ||||||
| import com.solace.maas.ep.event.management.agent.plugin.messagingService.MessagingServiceConnectionProperties; | ||||||
| import com.solace.maas.ep.event.management.agent.plugin.messagingService.MessagingServiceUsersProperties; | ||||||
| import com.solace.maas.ep.event.management.agent.plugin.common.util.EnvironmentUtil; | ||||||
| import com.solace.messaging.config.SolaceConstants; | ||||||
| import com.solace.messaging.config.SolaceProperties; | ||||||
| import com.solacesystems.solclientj.core.handle.SessionHandle; | ||||||
|
|
@@ -16,8 +17,11 @@ | |||||
| import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||||||
| import org.springframework.context.annotation.Configuration; | ||||||
|
|
||||||
| import java.io.File; | ||||||
| import java.net.InetAddress; | ||||||
| import java.net.UnknownHostException; | ||||||
| import java.nio.file.Path; | ||||||
| import java.nio.file.Paths; | ||||||
| import java.util.ArrayList; | ||||||
| import java.util.List; | ||||||
| import java.util.NoSuchElementException; | ||||||
|
|
@@ -38,6 +42,7 @@ public class VMRProperties { | |||||
| private static final String SOLACE_PROXY_PASSWORD = "solace.proxy.password"; | ||||||
|
|
||||||
| private final EventPortalPluginProperties eventPortalPluginProperties; | ||||||
| private final EnvironmentUtil environmentUtil; | ||||||
|
|
||||||
| /** | ||||||
| * The host used to connect to the VMR | ||||||
|
|
@@ -74,8 +79,9 @@ public class VMRProperties { | |||||
| */ | ||||||
|
|
||||||
| @Autowired | ||||||
| public VMRProperties(EventPortalPluginProperties eventPortalPluginProperties) { | ||||||
| public VMRProperties(EventPortalPluginProperties eventPortalPluginProperties, EnvironmentUtil environmentUtil) { | ||||||
| this.eventPortalPluginProperties = eventPortalPluginProperties; | ||||||
| this.environmentUtil = environmentUtil; | ||||||
| } | ||||||
|
|
||||||
| public void parseVmrProperties() { | ||||||
|
|
@@ -122,9 +128,44 @@ public Properties getVmrProperties() { | |||||
| properties.setProperty(SolaceProperties.AuthenticationProperties.SCHEME_BASIC_PASSWORD, password); | ||||||
| properties.setProperty(SolaceProperties.ClientProperties.NAME, clientName); | ||||||
|
|
||||||
| //We will always use the default jks truststore for connecting to the EVMR | ||||||
|
||||||
| //We will always use the default jks truststore for connecting to the EVMR | |
| // Explicitly configure the default JKS truststore for connecting to the EVMR only when custom CA certificates are present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this comment 👍
moodiRealist marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
moodiRealist marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package private to help in testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use
@MockitoBeanin here as well?