Skip to content
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

Configurable certificate validation #122

Merged
merged 5 commits into from
Nov 19, 2018
Merged

Conversation

plavjanik
Copy link
Contributor

@plavjanik plavjanik commented Nov 19, 2018

Resolves #79.

This PR brings a possibility to use and register services that do not have trusted certificate to the APIML.

The functionality is covered by some "unit" tests in TomcatHttpsTests but it was also tested manually with a real service:

  1. A wrong keystore (e.g. localhost2.keystore.p12) has been used in config/local/discoverable-client.yml
  2. --apiml.security.verifySslCertificatesOfServices=false was set in package.json fo GW, DS, and AC
  3. With this setting, the DC client was able to register and work via the gateway

This is documented in the documentation for developers (inside api-layer repository) on purpose because certificate validation is recommended for other users.

Copy link
Contributor

@JirkaAichler JirkaAichler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, I haven't found any issues. IntelliJ has few ideas related to exceptions :-)

@@ -113,13 +160,13 @@ private void startTomcatAndDoHttpsRequest(HttpsConfig httpsConfig) throws IOExce

private HttpsConfig.HttpsConfigBuilder correctHttpsKeyStoreSettings() throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IOException is never thrown

@@ -103,9 +109,9 @@ public static void main(String[] args) throws LifecycleException, ClientProtocol

HttpsConfig httpsConfig = HttpsConfig.builder()
.keyStore(new File("keystore/localhost/localhost.keystore.p12").getCanonicalPath())
.keyStorePassword("password").keyPassword("password")
.keyStorePassword(STORE_PASSWORD).keyPassword(STORE_PASSWORD)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ClientProtocolException is never thrown because of more general exception

@@ -41,7 +41,8 @@

@Slf4j
public class TomcatServerFactory {
private final static String SERVLET_NAME = "hello";
private static final String SERVLET_NAME = "hello";
private static final String STORE_PASSWORD = "password"; // NOSONAR

public Tomcat startTomcat(HttpsConfig httpsConfig) throws IOException {
Tomcat tomcat = new Tomcat();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ServletException is never thrown

@plavjanik plavjanik merged commit e0172b1 into master Nov 19, 2018
@ghost ghost removed the review label Nov 19, 2018
@plavjanik plavjanik deleted the https-verification-off-#79 branch November 19, 2018 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants