From 624bbc8b50f7b5b6a1addc62040e4f2587f24f1b Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Thu, 30 Jul 2020 15:15:09 -0400 Subject: [PATCH 1/9] add allow list for proxy.stream endpoint --- .../main/asciidoc/spring-cloud-netflix.adoc | 4 ++ .../HystrixDashboardConfiguration.java | 49 ++++++++++++++++--- .../dashboard/HystrixDashboardProperties.java | 17 +++++++ .../HystrixDashboardConfigurationTests.java | 47 ++++++++++++++++-- 4 files changed, 107 insertions(+), 10 deletions(-) diff --git a/docs/src/main/asciidoc/spring-cloud-netflix.adoc b/docs/src/main/asciidoc/spring-cloud-netflix.adoc index 789672194..f00a67b91 100755 --- a/docs/src/main/asciidoc/spring-cloud-netflix.adoc +++ b/docs/src/main/asciidoc/spring-cloud-netflix.adoc @@ -753,6 +753,10 @@ Then visit `/hystrix` and point the dashboard to an individual instance's `/hyst NOTE: When connecting to a `/hystrix.stream` endpoint that uses HTTPS, the certificate used by the server must be trusted by the JVM. If the certificate is not trusted, you must import the certificate into the JVM in order for the Hystrix Dashboard to make a successful connection to the stream endpoint. +NOTE: In order to use the `/proxy.stream` endpoint you must configure a list of hosts to allow connections to. To set the +list of allowed hosts use `hystrix.dashboard.proxyStreamAllowList`. You can use an Ant-style pattern in the host name to +match against a wider range of host names. + === Turbine Looking at an individual instance's Hystrix data is not very useful in terms of the overall health of the system. https://github.com/Netflix/Turbine[Turbine] is an application that aggregates all of the relevant `/hystrix.stream` endpoints into a combined `/turbine.stream` for use in the Hystrix Dashboard. diff --git a/spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfiguration.java b/spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfiguration.java index 9e0fa7431..4775881d9 100644 --- a/spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfiguration.java +++ b/spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfiguration.java @@ -19,7 +19,10 @@ package org.springframework.cloud.netflix.hystrix.dashboard; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Map; +import java.util.Optional; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -47,6 +50,8 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpHeaders; import org.springframework.ui.freemarker.SpringTemplateLoader; +import org.springframework.util.AntPathMatcher; +import org.springframework.util.PathMatcher; import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; /** @@ -88,8 +93,9 @@ public class HystrixDashboardConfiguration { } @Bean - public ServletRegistrationBean proxyStreamServlet() { - final ProxyStreamServlet proxyStreamServlet = new ProxyStreamServlet(); + public ServletRegistrationBean proxyStreamServlet( + HystrixDashboardProperties properties) { + final ProxyStreamServlet proxyStreamServlet = new ProxyStreamServlet(properties); proxyStreamServlet.setEnableIgnoreConnectionCloseHeader( this.dashboardProperties.isEnableIgnoreConnectionCloseHeader()); final ServletRegistrationBean registration = new ServletRegistrationBean( @@ -118,6 +124,8 @@ public class HystrixDashboardConfiguration { private boolean enableIgnoreConnectionCloseHeader = false; + private HystrixDashboardProperties properties; + public void setEnableIgnoreConnectionCloseHeader( boolean enableIgnoreConnectionCloseHeader) { this.enableIgnoreConnectionCloseHeader = enableIgnoreConnectionCloseHeader; @@ -125,6 +133,11 @@ public class HystrixDashboardConfiguration { public ProxyStreamServlet() { super(); + this.properties = new HystrixDashboardProperties(); + } + + public ProxyStreamServlet(HystrixDashboardProperties properties) { + this.properties = properties; } /** @@ -169,10 +182,18 @@ public class HystrixDashboardConfiguration { url.append(key).append("=").append(value); } } - String proxyUrl = url.toString(); - log.info("\n\nProxy opening connection to: " + proxyUrl + "\n\n"); + String proxyUrlString = url.toString(); + + if (!isAllowedToProxy(proxyUrlString)) { + log.warn("Origin parameter: " + origin + + " is not in the allowed list of proxy host names. If it " + + "should be allowed add it to hystrix.dashboard.proxyStreamAllowList."); + return; + } + + log.info("\n\nProxy opening connection to: " + proxyUrlString + "\n\n"); try { - httpget = new HttpGet(proxyUrl); + httpget = new HttpGet(proxyUrlString); HttpClient client = ProxyConnectionManager.httpClient; HttpResponse httpResponse = client.execute(httpget); int statusCode = httpResponse.getStatusLine().getStatusCode(); @@ -218,7 +239,7 @@ public class HystrixDashboardConfiguration { } } else { - log.warn("Failed opening connection to " + proxyUrl + " : " + log.warn("Failed opening connection to " + proxyUrlString + " : " + statusCode + " : " + httpResponse.getStatusLine()); } } @@ -250,6 +271,22 @@ public class HystrixDashboardConfiguration { } + private boolean isAllowedToProxy(String proxyUrlString) + throws MalformedURLException { + + URL proxyUrl = new URL(proxyUrlString); + String host = proxyUrl.getHost(); + PathMatcher pathMatcher = new AntPathMatcher("."); + Optional optionalPattern = properties.getProxyStreamAllowList() + .stream().filter(pattern -> pathMatcher.match(pattern, host)) + .findFirst(); + + if (optionalPattern.isPresent()) { + return true; + } + return false; + } + private void copyHeadersToServletResponse(Header[] headers, HttpServletResponse response) { for (Header header : headers) { diff --git a/spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardProperties.java b/spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardProperties.java index 932f7aa8c..9145135f0 100644 --- a/spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardProperties.java +++ b/spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardProperties.java @@ -16,7 +16,10 @@ package org.springframework.cloud.netflix.hystrix.dashboard; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -41,6 +44,20 @@ public class HystrixDashboardProperties { */ private Map initParameters = new HashMap<>(); + private List proxyStreamAllowList = new ArrayList<>(); + + public List getProxyStreamAllowList() { + return proxyStreamAllowList; + } + + public void setProxyStreamAllowList(List proxyStreamAllowList) { + this.proxyStreamAllowList = proxyStreamAllowList; + } + + public void setProxyStreamAllowList(String... regex) { + this.proxyStreamAllowList = Arrays.asList(regex); + } + public boolean isEnableIgnoreConnectionCloseHeader() { return enableIgnoreConnectionCloseHeader; } diff --git a/spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfigurationTests.java b/spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfigurationTests.java index 8245745ef..928ae2b7b 100644 --- a/spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfigurationTests.java +++ b/spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfigurationTests.java @@ -41,7 +41,8 @@ public class HystrixDashboardConfigurationTests { MockHttpServletResponse response = new MockHttpServletResponse(); Header[] headers = new Header[1]; headers[0] = new BasicHeader("Content-Type", "text/proxy.stream"); - HystrixDashboardConfiguration.ProxyStreamServlet proxyStreamServlet = new HystrixDashboardConfiguration.ProxyStreamServlet(); + HystrixDashboardConfiguration.ProxyStreamServlet proxyStreamServlet = new HystrixDashboardConfiguration.ProxyStreamServlet( + new HystrixDashboardProperties()); ReflectionTestUtils.invokeMethod(proxyStreamServlet, "copyHeadersToServletResponse", headers, response); assertThat(response.getHeaderNames().size()).isEqualTo(1); @@ -54,7 +55,8 @@ public class HystrixDashboardConfigurationTests { Header[] headers = new Header[2]; headers[0] = new BasicHeader("Content-Type", "text/proxy.stream"); headers[1] = new BasicHeader("Connection", "close"); - HystrixDashboardConfiguration.ProxyStreamServlet proxyStreamServlet = new HystrixDashboardConfiguration.ProxyStreamServlet(); + HystrixDashboardConfiguration.ProxyStreamServlet proxyStreamServlet = new HystrixDashboardConfiguration.ProxyStreamServlet( + new HystrixDashboardProperties()); ReflectionTestUtils.invokeMethod(proxyStreamServlet, "copyHeadersToServletResponse", headers, response); assertThat(response.getHeaderNames().size()).isEqualTo(2); @@ -68,7 +70,8 @@ public class HystrixDashboardConfigurationTests { Header[] headers = new Header[2]; headers[0] = new BasicHeader("Content-Type", "text/proxy.stream"); headers[1] = new BasicHeader("Connection", "close"); - HystrixDashboardConfiguration.ProxyStreamServlet proxyStreamServlet = new HystrixDashboardConfiguration.ProxyStreamServlet(); + HystrixDashboardConfiguration.ProxyStreamServlet proxyStreamServlet = new HystrixDashboardConfiguration.ProxyStreamServlet( + new HystrixDashboardProperties()); proxyStreamServlet.setEnableIgnoreConnectionCloseHeader(true); ReflectionTestUtils.invokeMethod(proxyStreamServlet, "copyHeadersToServletResponse", headers, response); @@ -83,7 +86,8 @@ public class HystrixDashboardConfigurationTests { Header[] headers = new Header[2]; headers[0] = new BasicHeader("Content-Type", "text/proxy.stream"); headers[1] = new BasicHeader("Connection", "close"); - HystrixDashboardConfiguration.ProxyStreamServlet proxyStreamServlet = new HystrixDashboardConfiguration.ProxyStreamServlet(); + HystrixDashboardConfiguration.ProxyStreamServlet proxyStreamServlet = new HystrixDashboardConfiguration.ProxyStreamServlet( + new HystrixDashboardProperties()); proxyStreamServlet.setEnableIgnoreConnectionCloseHeader(false); ReflectionTestUtils.invokeMethod(proxyStreamServlet, "copyHeadersToServletResponse", headers, response); @@ -111,4 +115,39 @@ public class HystrixDashboardConfigurationTests { }); } + @Test + public void allowedHostsTest() { + HystrixDashboardProperties properties = new HystrixDashboardProperties(); + HystrixDashboardConfiguration.ProxyStreamServlet proxyStreamServlet = new HystrixDashboardConfiguration.ProxyStreamServlet( + properties); + boolean allowed = ReflectionTestUtils.invokeMethod(proxyStreamServlet, + "isAllowedToProxy", "http://foo.com"); + assertThat(allowed).isFalse(); + + properties.setProxyStreamAllowList("foo.com", "bar.*", "*world.com"); + allowed = ReflectionTestUtils.invokeMethod(proxyStreamServlet, "isAllowedToProxy", + "http://user:password@foo.com"); + assertThat(allowed).isTrue(); + + allowed = ReflectionTestUtils.invokeMethod(proxyStreamServlet, "isAllowedToProxy", + "http://bar.com"); + assertThat(allowed).isTrue(); + + allowed = ReflectionTestUtils.invokeMethod(proxyStreamServlet, "isAllowedToProxy", + "http://bar.org"); + assertThat(allowed).isTrue(); + + allowed = ReflectionTestUtils.invokeMethod(proxyStreamServlet, "isAllowedToProxy", + "http://helloworld.com"); + assertThat(allowed).isTrue(); + + allowed = ReflectionTestUtils.invokeMethod(proxyStreamServlet, "isAllowedToProxy", + "http://world.com"); + assertThat(allowed).isTrue(); + + allowed = ReflectionTestUtils.invokeMethod(proxyStreamServlet, "isAllowedToProxy", + "http://world.org"); + assertThat(allowed).isFalse(); + } + } From a579eb4594713f2f92c90600d74ab7d3930b22b7 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Fri, 31 Jul 2020 20:33:25 +0000 Subject: [PATCH 2/9] Update SNAPSHOT to 2.2.4.RELEASE --- docs/pom.xml | 2 +- pom.xml | 10 +++++----- spring-cloud-netflix-archaius/pom.xml | 2 +- spring-cloud-netflix-concurrency-limits/pom.xml | 2 +- spring-cloud-netflix-core/pom.xml | 2 +- spring-cloud-netflix-dependencies/pom.xml | 4 ++-- spring-cloud-netflix-eureka-client/pom.xml | 2 +- spring-cloud-netflix-eureka-server/pom.xml | 2 +- spring-cloud-netflix-hystrix-contract/pom.xml | 4 ++-- spring-cloud-netflix-hystrix-dashboard/pom.xml | 2 +- spring-cloud-netflix-hystrix-stream/pom.xml | 2 +- spring-cloud-netflix-hystrix/pom.xml | 2 +- spring-cloud-netflix-ribbon/pom.xml | 2 +- spring-cloud-netflix-sidecar/pom.xml | 2 +- spring-cloud-netflix-turbine-stream/pom.xml | 2 +- spring-cloud-netflix-turbine/pom.xml | 2 +- spring-cloud-netflix-zuul/pom.xml | 2 +- spring-cloud-starter-netflix/pom.xml | 2 +- .../spring-cloud-starter-netflix-archaius/pom.xml | 2 +- .../spring-cloud-starter-netflix-eureka-client/pom.xml | 2 +- .../spring-cloud-starter-netflix-eureka-server/pom.xml | 2 +- .../pom.xml | 2 +- .../spring-cloud-starter-netflix-hystrix/pom.xml | 2 +- .../spring-cloud-starter-netflix-ribbon/pom.xml | 2 +- .../pom.xml | 2 +- .../spring-cloud-starter-netflix-turbine/pom.xml | 2 +- .../spring-cloud-starter-netflix-zuul/pom.xml | 2 +- 27 files changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index 177586100..7ee648445 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-netflix-docs pom diff --git a/pom.xml b/pom.xml index 0c41d1a44..d1e5b7f43 100644 --- a/pom.xml +++ b/pom.xml @@ -3,14 +3,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE pom Spring Cloud Netflix Spring Cloud Netflix org.springframework.cloud spring-cloud-build - 2.3.1.BUILD-SNAPSHOT + 2.3.1.RELEASE @@ -21,9 +21,9 @@ netflix - 2.2.4.BUILD-SNAPSHOT - 2.2.4.BUILD-SNAPSHOT - Horsham.SR5 + 2.2.4.RELEASE + 2.2.4.RELEASE + Horsham.SR7 2.2.1.RELEASE diff --git a/spring-cloud-netflix-archaius/pom.xml b/spring-cloud-netflix-archaius/pom.xml index 39e2aef2c..d79396bdd 100644 --- a/spring-cloud-netflix-archaius/pom.xml +++ b/spring-cloud-netflix-archaius/pom.xml @@ -6,7 +6,7 @@ spring-cloud-netflix org.springframework.cloud - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. diff --git a/spring-cloud-netflix-concurrency-limits/pom.xml b/spring-cloud-netflix-concurrency-limits/pom.xml index 4c44c3e41..eb9a5b271 100644 --- a/spring-cloud-netflix-concurrency-limits/pom.xml +++ b/spring-cloud-netflix-concurrency-limits/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-netflix-concurrency-limits diff --git a/spring-cloud-netflix-core/pom.xml b/spring-cloud-netflix-core/pom.xml index 56d868c69..2bf6bd57c 100644 --- a/spring-cloud-netflix-core/pom.xml +++ b/spring-cloud-netflix-core/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-netflix-core diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index 0df49ebfd..ef68d5777 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.3.1.BUILD-SNAPSHOT + 2.3.1.RELEASE spring-cloud-netflix-dependencies - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE pom spring-cloud-netflix-dependencies Spring Cloud Netflix Dependencies diff --git a/spring-cloud-netflix-eureka-client/pom.xml b/spring-cloud-netflix-eureka-client/pom.xml index c572a300b..fadc40ef5 100644 --- a/spring-cloud-netflix-eureka-client/pom.xml +++ b/spring-cloud-netflix-eureka-client/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-netflix-eureka-client diff --git a/spring-cloud-netflix-eureka-server/pom.xml b/spring-cloud-netflix-eureka-server/pom.xml index 0857a5ab7..58e073da7 100644 --- a/spring-cloud-netflix-eureka-server/pom.xml +++ b/spring-cloud-netflix-eureka-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-netflix-eureka-server diff --git a/spring-cloud-netflix-hystrix-contract/pom.xml b/spring-cloud-netflix-hystrix-contract/pom.xml index abf0cbba5..dad6d8dec 100644 --- a/spring-cloud-netflix-hystrix-contract/pom.xml +++ b/spring-cloud-netflix-hystrix-contract/pom.xml @@ -5,11 +5,11 @@ org.springframework.cloud spring-cloud-build - 2.3.0.RELEASE + 2.3.1.RELEASE spring-cloud-netflix-hystrix-contract - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE jar spring-cloud-netflix-hystrix-contract Spring Cloud Netflix Hystrix Contract diff --git a/spring-cloud-netflix-hystrix-dashboard/pom.xml b/spring-cloud-netflix-hystrix-dashboard/pom.xml index 003f6de8c..50515e29e 100644 --- a/spring-cloud-netflix-hystrix-dashboard/pom.xml +++ b/spring-cloud-netflix-hystrix-dashboard/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. diff --git a/spring-cloud-netflix-hystrix-stream/pom.xml b/spring-cloud-netflix-hystrix-stream/pom.xml index 86975fe44..4efeafac6 100644 --- a/spring-cloud-netflix-hystrix-stream/pom.xml +++ b/spring-cloud-netflix-hystrix-stream/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-netflix-hystrix-stream diff --git a/spring-cloud-netflix-hystrix/pom.xml b/spring-cloud-netflix-hystrix/pom.xml index 2f7a13de4..98a1380f2 100644 --- a/spring-cloud-netflix-hystrix/pom.xml +++ b/spring-cloud-netflix-hystrix/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-netflix-hystrix diff --git a/spring-cloud-netflix-ribbon/pom.xml b/spring-cloud-netflix-ribbon/pom.xml index c5a5de0aa..10f9b9067 100644 --- a/spring-cloud-netflix-ribbon/pom.xml +++ b/spring-cloud-netflix-ribbon/pom.xml @@ -5,7 +5,7 @@ spring-cloud-netflix org.springframework.cloud - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. 4.0.0 diff --git a/spring-cloud-netflix-sidecar/pom.xml b/spring-cloud-netflix-sidecar/pom.xml index e9f5cd232..54638bb11 100644 --- a/spring-cloud-netflix-sidecar/pom.xml +++ b/spring-cloud-netflix-sidecar/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-netflix-sidecar diff --git a/spring-cloud-netflix-turbine-stream/pom.xml b/spring-cloud-netflix-turbine-stream/pom.xml index 0409250d0..5aa572b6c 100644 --- a/spring-cloud-netflix-turbine-stream/pom.xml +++ b/spring-cloud-netflix-turbine-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-netflix-turbine-stream diff --git a/spring-cloud-netflix-turbine/pom.xml b/spring-cloud-netflix-turbine/pom.xml index 675f0e98e..0b6ad282b 100644 --- a/spring-cloud-netflix-turbine/pom.xml +++ b/spring-cloud-netflix-turbine/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-netflix-turbine diff --git a/spring-cloud-netflix-zuul/pom.xml b/spring-cloud-netflix-zuul/pom.xml index 545a40cc6..9f554536c 100644 --- a/spring-cloud-netflix-zuul/pom.xml +++ b/spring-cloud-netflix-zuul/pom.xml @@ -6,7 +6,7 @@ spring-cloud-netflix org.springframework.cloud - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. diff --git a/spring-cloud-starter-netflix/pom.xml b/spring-cloud-starter-netflix/pom.xml index a646b47d8..319e67095 100644 --- a/spring-cloud-starter-netflix/pom.xml +++ b/spring-cloud-starter-netflix/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE .. spring-cloud-starter-netflix diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml index 8c59bfd92..9353a5445 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-starter-netflix-archaius Spring Cloud Starter Netflix Archaius diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml index ae1c5da85..cff5b8b81 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-starter-netflix-eureka-client Spring Cloud Starter Netflix Eureka Client diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml index 756b4f6ea..111c28c90 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml @@ -3,7 +3,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-starter-netflix-eureka-server Spring Cloud Starter Netflix Eureka Server diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml index e362fb8f3..34bea0ba2 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-starter-netflix-hystrix-dashboard Spring Cloud Starter Netflix Hystrix Dashboard diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml index 3823c7517..6355fc6d6 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-starter-netflix-hystrix Spring Cloud Starter Netflix Hystrix diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml index d26d13cb0..281f037e7 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-starter-netflix-ribbon Spring Cloud Starter Netflix Ribbon diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml index 3bebef9b8..156e62269 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-starter-netflix-turbine-stream Spring Cloud Starter Netflix Turbine Stream diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml index 27ada3d40..71115221a 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-starter-netflix-turbine Spring Cloud Starter Netflix Turbine diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml index 78cce918a..3280b8b31 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.4.RELEASE spring-cloud-starter-netflix-zuul Spring Cloud Starter Netflix Zuul From a826a960e6649de21044919bd2cc6c160677da83 Mon Sep 17 00:00:00 2001 From: buildmaster Date: Fri, 31 Jul 2020 20:37:36 +0000 Subject: [PATCH 3/9] Going back to snapshots --- docs/pom.xml | 2 +- pom.xml | 10 +++++----- spring-cloud-netflix-archaius/pom.xml | 2 +- spring-cloud-netflix-concurrency-limits/pom.xml | 2 +- spring-cloud-netflix-core/pom.xml | 2 +- spring-cloud-netflix-dependencies/pom.xml | 4 ++-- spring-cloud-netflix-eureka-client/pom.xml | 2 +- spring-cloud-netflix-eureka-server/pom.xml | 2 +- spring-cloud-netflix-hystrix-contract/pom.xml | 4 ++-- spring-cloud-netflix-hystrix-dashboard/pom.xml | 2 +- spring-cloud-netflix-hystrix-stream/pom.xml | 2 +- spring-cloud-netflix-hystrix/pom.xml | 2 +- spring-cloud-netflix-ribbon/pom.xml | 2 +- spring-cloud-netflix-sidecar/pom.xml | 2 +- spring-cloud-netflix-turbine-stream/pom.xml | 2 +- spring-cloud-netflix-turbine/pom.xml | 2 +- spring-cloud-netflix-zuul/pom.xml | 2 +- spring-cloud-starter-netflix/pom.xml | 2 +- .../spring-cloud-starter-netflix-archaius/pom.xml | 2 +- .../spring-cloud-starter-netflix-eureka-client/pom.xml | 2 +- .../spring-cloud-starter-netflix-eureka-server/pom.xml | 2 +- .../pom.xml | 2 +- .../spring-cloud-starter-netflix-hystrix/pom.xml | 2 +- .../spring-cloud-starter-netflix-ribbon/pom.xml | 2 +- .../pom.xml | 2 +- .../spring-cloud-starter-netflix-turbine/pom.xml | 2 +- .../spring-cloud-starter-netflix-zuul/pom.xml | 2 +- 27 files changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index 7ee648445..177586100 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-netflix-docs pom diff --git a/pom.xml b/pom.xml index d1e5b7f43..0c41d1a44 100644 --- a/pom.xml +++ b/pom.xml @@ -3,14 +3,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT pom Spring Cloud Netflix Spring Cloud Netflix org.springframework.cloud spring-cloud-build - 2.3.1.RELEASE + 2.3.1.BUILD-SNAPSHOT @@ -21,9 +21,9 @@ netflix - 2.2.4.RELEASE - 2.2.4.RELEASE - Horsham.SR7 + 2.2.4.BUILD-SNAPSHOT + 2.2.4.BUILD-SNAPSHOT + Horsham.SR5 2.2.1.RELEASE diff --git a/spring-cloud-netflix-archaius/pom.xml b/spring-cloud-netflix-archaius/pom.xml index d79396bdd..39e2aef2c 100644 --- a/spring-cloud-netflix-archaius/pom.xml +++ b/spring-cloud-netflix-archaius/pom.xml @@ -6,7 +6,7 @@ spring-cloud-netflix org.springframework.cloud - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. diff --git a/spring-cloud-netflix-concurrency-limits/pom.xml b/spring-cloud-netflix-concurrency-limits/pom.xml index eb9a5b271..4c44c3e41 100644 --- a/spring-cloud-netflix-concurrency-limits/pom.xml +++ b/spring-cloud-netflix-concurrency-limits/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-netflix-concurrency-limits diff --git a/spring-cloud-netflix-core/pom.xml b/spring-cloud-netflix-core/pom.xml index 2bf6bd57c..56d868c69 100644 --- a/spring-cloud-netflix-core/pom.xml +++ b/spring-cloud-netflix-core/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-netflix-core diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index ef68d5777..0df49ebfd 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.3.1.RELEASE + 2.3.1.BUILD-SNAPSHOT spring-cloud-netflix-dependencies - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT pom spring-cloud-netflix-dependencies Spring Cloud Netflix Dependencies diff --git a/spring-cloud-netflix-eureka-client/pom.xml b/spring-cloud-netflix-eureka-client/pom.xml index fadc40ef5..c572a300b 100644 --- a/spring-cloud-netflix-eureka-client/pom.xml +++ b/spring-cloud-netflix-eureka-client/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-netflix-eureka-client diff --git a/spring-cloud-netflix-eureka-server/pom.xml b/spring-cloud-netflix-eureka-server/pom.xml index 58e073da7..0857a5ab7 100644 --- a/spring-cloud-netflix-eureka-server/pom.xml +++ b/spring-cloud-netflix-eureka-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-netflix-eureka-server diff --git a/spring-cloud-netflix-hystrix-contract/pom.xml b/spring-cloud-netflix-hystrix-contract/pom.xml index dad6d8dec..abf0cbba5 100644 --- a/spring-cloud-netflix-hystrix-contract/pom.xml +++ b/spring-cloud-netflix-hystrix-contract/pom.xml @@ -5,11 +5,11 @@ org.springframework.cloud spring-cloud-build - 2.3.1.RELEASE + 2.3.0.RELEASE spring-cloud-netflix-hystrix-contract - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT jar spring-cloud-netflix-hystrix-contract Spring Cloud Netflix Hystrix Contract diff --git a/spring-cloud-netflix-hystrix-dashboard/pom.xml b/spring-cloud-netflix-hystrix-dashboard/pom.xml index 50515e29e..003f6de8c 100644 --- a/spring-cloud-netflix-hystrix-dashboard/pom.xml +++ b/spring-cloud-netflix-hystrix-dashboard/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. diff --git a/spring-cloud-netflix-hystrix-stream/pom.xml b/spring-cloud-netflix-hystrix-stream/pom.xml index 4efeafac6..86975fe44 100644 --- a/spring-cloud-netflix-hystrix-stream/pom.xml +++ b/spring-cloud-netflix-hystrix-stream/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-netflix-hystrix-stream diff --git a/spring-cloud-netflix-hystrix/pom.xml b/spring-cloud-netflix-hystrix/pom.xml index 98a1380f2..2f7a13de4 100644 --- a/spring-cloud-netflix-hystrix/pom.xml +++ b/spring-cloud-netflix-hystrix/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-netflix-hystrix diff --git a/spring-cloud-netflix-ribbon/pom.xml b/spring-cloud-netflix-ribbon/pom.xml index 10f9b9067..c5a5de0aa 100644 --- a/spring-cloud-netflix-ribbon/pom.xml +++ b/spring-cloud-netflix-ribbon/pom.xml @@ -5,7 +5,7 @@ spring-cloud-netflix org.springframework.cloud - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. 4.0.0 diff --git a/spring-cloud-netflix-sidecar/pom.xml b/spring-cloud-netflix-sidecar/pom.xml index 54638bb11..e9f5cd232 100644 --- a/spring-cloud-netflix-sidecar/pom.xml +++ b/spring-cloud-netflix-sidecar/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-netflix-sidecar diff --git a/spring-cloud-netflix-turbine-stream/pom.xml b/spring-cloud-netflix-turbine-stream/pom.xml index 5aa572b6c..0409250d0 100644 --- a/spring-cloud-netflix-turbine-stream/pom.xml +++ b/spring-cloud-netflix-turbine-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-netflix-turbine-stream diff --git a/spring-cloud-netflix-turbine/pom.xml b/spring-cloud-netflix-turbine/pom.xml index 0b6ad282b..675f0e98e 100644 --- a/spring-cloud-netflix-turbine/pom.xml +++ b/spring-cloud-netflix-turbine/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-netflix-turbine diff --git a/spring-cloud-netflix-zuul/pom.xml b/spring-cloud-netflix-zuul/pom.xml index 9f554536c..545a40cc6 100644 --- a/spring-cloud-netflix-zuul/pom.xml +++ b/spring-cloud-netflix-zuul/pom.xml @@ -6,7 +6,7 @@ spring-cloud-netflix org.springframework.cloud - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. diff --git a/spring-cloud-starter-netflix/pom.xml b/spring-cloud-starter-netflix/pom.xml index 319e67095..a646b47d8 100644 --- a/spring-cloud-starter-netflix/pom.xml +++ b/spring-cloud-starter-netflix/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT .. spring-cloud-starter-netflix diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml index 9353a5445..8c59bfd92 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-starter-netflix-archaius Spring Cloud Starter Netflix Archaius diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml index cff5b8b81..ae1c5da85 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-starter-netflix-eureka-client Spring Cloud Starter Netflix Eureka Client diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml index 111c28c90..756b4f6ea 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml @@ -3,7 +3,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-starter-netflix-eureka-server Spring Cloud Starter Netflix Eureka Server diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml index 34bea0ba2..e362fb8f3 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-starter-netflix-hystrix-dashboard Spring Cloud Starter Netflix Hystrix Dashboard diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml index 6355fc6d6..3823c7517 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-starter-netflix-hystrix Spring Cloud Starter Netflix Hystrix diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml index 281f037e7..d26d13cb0 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-starter-netflix-ribbon Spring Cloud Starter Netflix Ribbon diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml index 156e62269..3bebef9b8 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-starter-netflix-turbine-stream Spring Cloud Starter Netflix Turbine Stream diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml index 71115221a..27ada3d40 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-starter-netflix-turbine Spring Cloud Starter Netflix Turbine diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml index 3280b8b31..78cce918a 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.RELEASE + 2.2.4.BUILD-SNAPSHOT spring-cloud-starter-netflix-zuul Spring Cloud Starter Netflix Zuul From 896b33c109066ef652ee4652605e47b56017a1ab Mon Sep 17 00:00:00 2001 From: buildmaster Date: Fri, 31 Jul 2020 20:37:36 +0000 Subject: [PATCH 4/9] Bumping versions to 2.2.5.BUILD-SNAPSHOT after release --- docs/pom.xml | 2 +- pom.xml | 10 +++++----- spring-cloud-netflix-archaius/pom.xml | 2 +- spring-cloud-netflix-concurrency-limits/pom.xml | 2 +- spring-cloud-netflix-core/pom.xml | 2 +- spring-cloud-netflix-dependencies/pom.xml | 4 ++-- spring-cloud-netflix-eureka-client/pom.xml | 2 +- spring-cloud-netflix-eureka-server/pom.xml | 2 +- spring-cloud-netflix-hystrix-contract/pom.xml | 4 ++-- spring-cloud-netflix-hystrix-dashboard/pom.xml | 2 +- spring-cloud-netflix-hystrix-stream/pom.xml | 2 +- spring-cloud-netflix-hystrix/pom.xml | 2 +- spring-cloud-netflix-ribbon/pom.xml | 2 +- spring-cloud-netflix-sidecar/pom.xml | 2 +- spring-cloud-netflix-turbine-stream/pom.xml | 2 +- spring-cloud-netflix-turbine/pom.xml | 2 +- spring-cloud-netflix-zuul/pom.xml | 2 +- spring-cloud-starter-netflix/pom.xml | 2 +- .../spring-cloud-starter-netflix-archaius/pom.xml | 2 +- .../spring-cloud-starter-netflix-eureka-client/pom.xml | 2 +- .../spring-cloud-starter-netflix-eureka-server/pom.xml | 2 +- .../pom.xml | 2 +- .../spring-cloud-starter-netflix-hystrix/pom.xml | 2 +- .../spring-cloud-starter-netflix-ribbon/pom.xml | 2 +- .../pom.xml | 2 +- .../spring-cloud-starter-netflix-turbine/pom.xml | 2 +- .../spring-cloud-starter-netflix-zuul/pom.xml | 2 +- 27 files changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index 177586100..310e2738d 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-netflix-docs pom diff --git a/pom.xml b/pom.xml index 0c41d1a44..80a074046 100644 --- a/pom.xml +++ b/pom.xml @@ -3,14 +3,14 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT pom Spring Cloud Netflix Spring Cloud Netflix org.springframework.cloud spring-cloud-build - 2.3.1.BUILD-SNAPSHOT + 2.3.1.RELEASE @@ -21,9 +21,9 @@ netflix - 2.2.4.BUILD-SNAPSHOT - 2.2.4.BUILD-SNAPSHOT - Horsham.SR5 + 2.2.5.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT + Horsham.SR7 2.2.1.RELEASE diff --git a/spring-cloud-netflix-archaius/pom.xml b/spring-cloud-netflix-archaius/pom.xml index 39e2aef2c..e47c38262 100644 --- a/spring-cloud-netflix-archaius/pom.xml +++ b/spring-cloud-netflix-archaius/pom.xml @@ -6,7 +6,7 @@ spring-cloud-netflix org.springframework.cloud - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. diff --git a/spring-cloud-netflix-concurrency-limits/pom.xml b/spring-cloud-netflix-concurrency-limits/pom.xml index 4c44c3e41..4bf630155 100644 --- a/spring-cloud-netflix-concurrency-limits/pom.xml +++ b/spring-cloud-netflix-concurrency-limits/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-netflix-concurrency-limits diff --git a/spring-cloud-netflix-core/pom.xml b/spring-cloud-netflix-core/pom.xml index 56d868c69..3a9e6baf6 100644 --- a/spring-cloud-netflix-core/pom.xml +++ b/spring-cloud-netflix-core/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-netflix-core diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index 0df49ebfd..1b892418a 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 2.3.1.BUILD-SNAPSHOT + 2.3.2.BUILD-SNAPSHOT spring-cloud-netflix-dependencies - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT pom spring-cloud-netflix-dependencies Spring Cloud Netflix Dependencies diff --git a/spring-cloud-netflix-eureka-client/pom.xml b/spring-cloud-netflix-eureka-client/pom.xml index c572a300b..0a1dffb15 100644 --- a/spring-cloud-netflix-eureka-client/pom.xml +++ b/spring-cloud-netflix-eureka-client/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-netflix-eureka-client diff --git a/spring-cloud-netflix-eureka-server/pom.xml b/spring-cloud-netflix-eureka-server/pom.xml index 0857a5ab7..693152602 100644 --- a/spring-cloud-netflix-eureka-server/pom.xml +++ b/spring-cloud-netflix-eureka-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-netflix-eureka-server diff --git a/spring-cloud-netflix-hystrix-contract/pom.xml b/spring-cloud-netflix-hystrix-contract/pom.xml index abf0cbba5..d54f78f78 100644 --- a/spring-cloud-netflix-hystrix-contract/pom.xml +++ b/spring-cloud-netflix-hystrix-contract/pom.xml @@ -5,11 +5,11 @@ org.springframework.cloud spring-cloud-build - 2.3.0.RELEASE + 2.3.1.RELEASE spring-cloud-netflix-hystrix-contract - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT jar spring-cloud-netflix-hystrix-contract Spring Cloud Netflix Hystrix Contract diff --git a/spring-cloud-netflix-hystrix-dashboard/pom.xml b/spring-cloud-netflix-hystrix-dashboard/pom.xml index 003f6de8c..18d9fa7bd 100644 --- a/spring-cloud-netflix-hystrix-dashboard/pom.xml +++ b/spring-cloud-netflix-hystrix-dashboard/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. diff --git a/spring-cloud-netflix-hystrix-stream/pom.xml b/spring-cloud-netflix-hystrix-stream/pom.xml index 86975fe44..c1017309f 100644 --- a/spring-cloud-netflix-hystrix-stream/pom.xml +++ b/spring-cloud-netflix-hystrix-stream/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-netflix-hystrix-stream diff --git a/spring-cloud-netflix-hystrix/pom.xml b/spring-cloud-netflix-hystrix/pom.xml index 2f7a13de4..19cd5fbdb 100644 --- a/spring-cloud-netflix-hystrix/pom.xml +++ b/spring-cloud-netflix-hystrix/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-netflix-hystrix diff --git a/spring-cloud-netflix-ribbon/pom.xml b/spring-cloud-netflix-ribbon/pom.xml index c5a5de0aa..9cfe6bbd2 100644 --- a/spring-cloud-netflix-ribbon/pom.xml +++ b/spring-cloud-netflix-ribbon/pom.xml @@ -5,7 +5,7 @@ spring-cloud-netflix org.springframework.cloud - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. 4.0.0 diff --git a/spring-cloud-netflix-sidecar/pom.xml b/spring-cloud-netflix-sidecar/pom.xml index e9f5cd232..38356ae18 100644 --- a/spring-cloud-netflix-sidecar/pom.xml +++ b/spring-cloud-netflix-sidecar/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-netflix-sidecar diff --git a/spring-cloud-netflix-turbine-stream/pom.xml b/spring-cloud-netflix-turbine-stream/pom.xml index 0409250d0..3d0387a18 100644 --- a/spring-cloud-netflix-turbine-stream/pom.xml +++ b/spring-cloud-netflix-turbine-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-netflix-turbine-stream diff --git a/spring-cloud-netflix-turbine/pom.xml b/spring-cloud-netflix-turbine/pom.xml index 675f0e98e..0924ab7f4 100644 --- a/spring-cloud-netflix-turbine/pom.xml +++ b/spring-cloud-netflix-turbine/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-netflix-turbine diff --git a/spring-cloud-netflix-zuul/pom.xml b/spring-cloud-netflix-zuul/pom.xml index 545a40cc6..0689e2e6f 100644 --- a/spring-cloud-netflix-zuul/pom.xml +++ b/spring-cloud-netflix-zuul/pom.xml @@ -6,7 +6,7 @@ spring-cloud-netflix org.springframework.cloud - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. diff --git a/spring-cloud-starter-netflix/pom.xml b/spring-cloud-starter-netflix/pom.xml index a646b47d8..669362e6a 100644 --- a/spring-cloud-starter-netflix/pom.xml +++ b/spring-cloud-starter-netflix/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT .. spring-cloud-starter-netflix diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml index 8c59bfd92..40089bb19 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-archaius/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-starter-netflix-archaius Spring Cloud Starter Netflix Archaius diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml index ae1c5da85..7812ce208 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-client/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-starter-netflix-eureka-client Spring Cloud Starter Netflix Eureka Client diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml index 756b4f6ea..eee911c44 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-eureka-server/pom.xml @@ -3,7 +3,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-starter-netflix-eureka-server Spring Cloud Starter Netflix Eureka Server diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml index e362fb8f3..8c6c481be 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix-dashboard/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-starter-netflix-hystrix-dashboard Spring Cloud Starter Netflix Hystrix Dashboard diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml index 3823c7517..7cbdf5b56 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-hystrix/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-starter-netflix-hystrix Spring Cloud Starter Netflix Hystrix diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml index d26d13cb0..454c6dea6 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-ribbon/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-starter-netflix-ribbon Spring Cloud Starter Netflix Ribbon diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml index 3bebef9b8..7a932a9da 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine-stream/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-starter-netflix-turbine-stream Spring Cloud Starter Netflix Turbine Stream diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml index 27ada3d40..4b8ed4e06 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-turbine/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-starter-netflix-turbine Spring Cloud Starter Netflix Turbine diff --git a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml index 78cce918a..24eee2308 100644 --- a/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml +++ b/spring-cloud-starter-netflix/spring-cloud-starter-netflix-zuul/pom.xml @@ -4,7 +4,7 @@ org.springframework.cloud spring-cloud-starter-netflix - 2.2.4.BUILD-SNAPSHOT + 2.2.5.BUILD-SNAPSHOT spring-cloud-starter-netflix-zuul Spring Cloud Starter Netflix Zuul From cbc914259bc7906d6882cb91842f5e38d581db2e Mon Sep 17 00:00:00 2001 From: JiaLin Date: Sun, 26 Jul 2020 21:23:10 +0800 Subject: [PATCH 5/9] add client side TLS support --- pom.xml | 14 + .../pom.xml | 100 +++++++ .../cloud/netflix/eureka/AppRunner.java | 125 +++++++++ .../cloud/netflix/eureka/BaseCertTest.java | 93 +++++++ .../netflix/eureka/EurekaClientRunner.java | 99 +++++++ .../netflix/eureka/EurekaClientTest.java | 158 +++++++++++ .../netflix/eureka/EurekaServerRunner.java | 56 ++++ .../cloud/netflix/eureka/KeyAndCert.java | 94 +++++++ .../cloud/netflix/eureka/KeyTool.java | 126 +++++++++ ...coveryClientOptionalArgsConfiguration.java | 38 ++- .../netflix/eureka/config/TlsProperties.java | 255 ++++++++++++++++++ 11 files changed, 1152 insertions(+), 6 deletions(-) create mode 100644 spring-cloud-netflix-eureka-client-tls-tests/pom.xml create mode 100644 spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/AppRunner.java create mode 100644 spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java create mode 100644 spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientRunner.java create mode 100644 spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientTest.java create mode 100644 spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaServerRunner.java create mode 100644 spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/KeyAndCert.java create mode 100644 spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/KeyTool.java create mode 100644 spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/TlsProperties.java diff --git a/pom.xml b/pom.xml index 0c41d1a44..9983be32b 100644 --- a/pom.xml +++ b/pom.xml @@ -34,6 +34,9 @@ java 1.19.1 1.4.11.1 + + 1.64 + 2.1 @@ -176,6 +179,16 @@ ${xstream.version} + + org.bouncycastle + bcpkix-jdk15on + ${bouncycastle.version} + + + javax.xml + jaxb-impl + ${jaxb.version} + @@ -204,6 +217,7 @@ spring-cloud-netflix-ribbon spring-cloud-starter-netflix spring-cloud-netflix-hystrix + spring-cloud-netflix-eureka-client-tls-tests docs diff --git a/spring-cloud-netflix-eureka-client-tls-tests/pom.xml b/spring-cloud-netflix-eureka-client-tls-tests/pom.xml new file mode 100644 index 000000000..a1fe4c08e --- /dev/null +++ b/spring-cloud-netflix-eureka-client-tls-tests/pom.xml @@ -0,0 +1,100 @@ + + + 4.0.0 + + org.springframework.cloud + spring-cloud-netflix + 2.2.4.BUILD-SNAPSHOT + .. + + spring-cloud-netflix-eureka-client-tls-tests + jar + Spring Cloud Netflix Eureka Client TLS Tests + Spring Cloud Netflix Eureka Client TLS Tests + + + + org.springframework.cloud + spring-cloud-netflix-eureka-client + + + org.springframework.cloud + spring-cloud-netflix-eureka-server + + + + org.springframework.boot + spring-boot + + + org.springframework.boot + spring-boot-autoconfigure + + + org.springframework.boot + spring-boot-starter-logging + true + + + org.springframework.cloud + spring-cloud-commons + + + org.springframework.cloud + spring-cloud-context + + + org.springframework + spring-web + + + com.fasterxml.jackson.core + jackson-annotations + + + org.springframework.retry + spring-retry + true + + + org.springframework.boot + spring-boot-starter-actuator + true + + + org.springframework.boot + spring-boot-starter-aop + true + + + com.fasterxml.jackson.core + jackson-databind + + + org.springframework.boot + spring-boot-autoconfigure-processor + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.junit.vintage + junit-vintage-engine + test + + + org.bouncycastle + bcpkix-jdk15on + test + + + javax.xml + jaxb-impl + + + diff --git a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/AppRunner.java b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/AppRunner.java new file mode 100644 index 000000000..3e48433f9 --- /dev/null +++ b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/AppRunner.java @@ -0,0 +1,125 @@ +/* + * Copyright 2018-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.eureka; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.util.SocketUtils; + +public class AppRunner implements AutoCloseable { + + private Class appClass; + + private Map props; + + private ConfigurableApplicationContext app; + + public AppRunner(Class appClass) { + this.appClass = appClass; + props = new LinkedHashMap<>(); + } + + public void property(String key, String value) { + props.put(key, value); + } + + public void start() { + if (app == null) { + SpringApplicationBuilder builder = new SpringApplicationBuilder(appClass); + builder.properties("spring.jmx.enabled=false"); + builder.properties(String.format("server.port=%d", availabeTcpPort())); + builder.properties(props()); + + app = builder.build().run(); + } + } + + private int availabeTcpPort() { + return SocketUtils.findAvailableTcpPort(); + } + + private String[] props() { + List result = new ArrayList<>(); + + for (String key : props.keySet()) { + String value = props.get(key); + result.add(String.format("%s=%s", key, value)); + } + + return result.toArray(new String[0]); + } + + public void stop() { + if (app != null) { + app.stop(); + app = null; + } + } + + public ConfigurableApplicationContext app() { + return app; + } + + public String getProperty(String key) { + return app.getEnvironment().getProperty(key); + } + + public T getBean(Class type) { + return app.getBean(type); + } + + public ApplicationContext parent() { + return app.getParent(); + } + + public Map getParentBeans(Class type) { + return parent().getBeansOfType(type); + } + + public int port() { + if (app == null) { + throw new RuntimeException("App is not running."); + } + return app.getEnvironment().getProperty("server.port", Integer.class, -1); + } + + public String root() { + if (app == null) { + throw new RuntimeException("App is not running."); + } + + String protocol = tlsEnabled() ? "https" : "http"; + return String.format("%s://localhost:%d/", protocol, port()); + } + + private boolean tlsEnabled() { + return app.getEnvironment().getProperty("server.ssl.enabled", Boolean.class, + false); + } + + @Override + public void close() { + stop(); + } + +} diff --git a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java new file mode 100644 index 000000000..b224ecb0c --- /dev/null +++ b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java @@ -0,0 +1,93 @@ +/* + * Copyright 2018-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.eureka; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.security.KeyStore; + +import org.junit.BeforeClass; + +public class BaseCertTest { + + protected static final String KEY_STORE_PASSWORD = "test-key-store-password"; + + protected static final String KEY_PASSWORD = "test-key-password"; + + protected static final String WRONG_PASSWORD = "test-wrong-password"; + + protected static File caCert; + + protected static File wrongCaCert; + + protected static File serverCert; + + protected static File clientCert; + + protected static File wrongClientCert; + + @BeforeClass + public static void createCertificates() throws Exception { + KeyTool tool = new KeyTool(); + + KeyAndCert ca = tool.createCA("MyCA"); + KeyAndCert server = ca.sign("server"); + KeyAndCert client = ca.sign("client"); + + caCert = saveCert(ca); + serverCert = saveKeyAndCert(server); + clientCert = saveKeyAndCert(client); + + KeyAndCert wrongCa = tool.createCA("WrongCA"); + KeyAndCert wrongClient = wrongCa.sign("client"); + + wrongCaCert = saveCert(wrongCa); + wrongClientCert = saveKeyAndCert(wrongClient); + + System.setProperty("javax.net.ssl.trustStore", caCert.getAbsolutePath()); + System.setProperty("javax.net.ssl.trustStorePassword", KEY_STORE_PASSWORD); + } + + private static File saveKeyAndCert(KeyAndCert keyCert) throws Exception { + return saveKeyStore(keyCert.subject(), + () -> keyCert.storeKeyAndCert(KEY_PASSWORD)); + } + + private static File saveCert(KeyAndCert keyCert) throws Exception { + return saveKeyStore(keyCert.subject(), () -> keyCert.storeCert()); + } + + private static File saveKeyStore(String prefix, KeyStoreSupplier func) + throws Exception { + File result = File.createTempFile(prefix, ".p12"); + result.deleteOnExit(); + + try (OutputStream output = new FileOutputStream(result)) { + KeyStore store = func.createKeyStore(); + store.store(output, KEY_STORE_PASSWORD.toCharArray()); + } + return result; + } + + interface KeyStoreSupplier { + + KeyStore createKeyStore() throws Exception; + + } + +} diff --git a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientRunner.java b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientRunner.java new file mode 100644 index 000000000..6923e8ac2 --- /dev/null +++ b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientRunner.java @@ -0,0 +1,99 @@ +/* + * Copyright 2018-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.eureka; + +import java.io.File; +import java.util.function.BooleanSupplier; + +import org.springframework.cloud.client.discovery.DiscoveryClient; + +public class EurekaClientRunner extends AppRunner { + + public EurekaClientRunner(Class appClass, AppRunner server) { + super(appClass); + + property("eureka.client.registerWithEureka", "false"); + property("eureka.client.fetchRegistry", "true"); + property("eureka.client.serviceUrl.defaultZone", server.root() + "eureka/"); + property("eureka.client.refresh.enable", "true"); + } + + public EurekaClientRunner(Class appClass, AppRunner server, String service) { + this(appClass, server); + property("eureka.client.registerWithEureka", "true"); + property("spring.application.name", service); + } + + public void enableTls() { + property("eureka.client.tls.enabled", "true"); + } + + public void disableTls() { + property("eureka.client.tls.enabled", "false"); + } + + public void setKeyStore(File keyStore, String keyStorePassword, String keyPassword) { + property("eureka.client.tls.key-store", pathOf(keyStore)); + property("eureka.client.tls.key-store-password", keyStorePassword); + property("eureka.client.tls.key-password", keyPassword); + } + + public void setKeyStore(File keyStore) { + property("eureka.client.tls.key-store", pathOf(keyStore)); + } + + public void setTrustStore(File trustStore, String password) { + property("eureka.client.tls.trust-store", pathOf(trustStore)); + property("eureka.client.tls.trust-store-password", password); + } + + public void setTrustStore(File trustStore) { + property("eureka.client.tls.trust-store", pathOf(trustStore)); + } + + private String pathOf(File file) { + return String.format("file:%s", file.getAbsolutePath()); + } + + public void waitServiceViaEureka(int seconds) { + assertInSeconds(() -> foundServiceViaEureka(), seconds); + } + + private void assertInSeconds(BooleanSupplier assertion, int seconds) { + long start = System.currentTimeMillis(); + long limit = 1000L * seconds; + long duration = 0; + + do { + if (assertion.getAsBoolean()) { + return; + } + duration = System.currentTimeMillis() - start; + Thread.yield(); + + } + while (duration < limit); + + throw new RuntimeException(); + } + + public boolean foundServiceViaEureka() { + DiscoveryClient discovery = getBean(DiscoveryClient.class); + return !discovery.getServices().isEmpty(); + } + +} diff --git a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientTest.java b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientTest.java new file mode 100644 index 000000000..e2d066bf9 --- /dev/null +++ b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientTest.java @@ -0,0 +1,158 @@ +/* + * Copyright 2018-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.eureka; + +import java.io.File; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import org.springframework.beans.factory.BeanCreationException; +import org.springframework.boot.SpringBootConfiguration; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +import static org.assertj.core.api.Assertions.assertThat; + +public class EurekaClientTest extends BaseCertTest { + + private static EurekaServerRunner server; + + private static EurekaClientRunner service; + + @BeforeClass + public static void setupAll() { + startEurekaServer(); + startService(); + waitForRegistration(); + } + + @AfterClass + public static void tearDownAll() { + stopService(); + stopEurekaServer(); + } + + private static void startEurekaServer() { + server = new EurekaServerRunner(TestEurekaServer.class); + server.enableTls(); + server.setKeyStore(serverCert, KEY_STORE_PASSWORD, "server", KEY_PASSWORD); + server.setTrustStore(caCert, KEY_STORE_PASSWORD); + + server.start(); + } + + private static void stopEurekaServer() { + server.stop(); + } + + private static void startService() { + service = new EurekaClientRunner(TestApp.class, server, "testservice"); + enableTlsClient(service); + service.start(); + } + + private static void stopService() { + service.stop(); + } + + private static void waitForRegistration() { + try (EurekaClientRunner client = createEurekaClient()) { + enableTlsClient(client); + client.start(); + client.waitServiceViaEureka(60); + } + } + + private static EurekaClientRunner createEurekaClient() { + return new EurekaClientRunner(TestApp.class, server); + } + + private static void enableTlsClient(EurekaClientRunner runner) { + runner.enableTls(); + runner.setKeyStore(clientCert, KEY_STORE_PASSWORD, KEY_PASSWORD); + runner.setTrustStore(caCert, KEY_STORE_PASSWORD); + } + + /** + * Already proved this in waitForRegistration(). Keep this Test to express test + * purpose explicitly. + */ + @Test + public void clientCertCanWork() { + } + + @Test + public void noCertCannotWork() { + try (EurekaClientRunner client = createEurekaClient()) { + client.disableTls(); + client.start(); + assertThat(client.foundServiceViaEureka()).isFalse(); + } + } + + @Test + public void wrongCertCannotWork() { + try (EurekaClientRunner client = createEurekaClient()) { + enableTlsClient(client); + client.setKeyStore(wrongClientCert); + client.start(); + assertThat(client.foundServiceViaEureka()).isFalse(); + } + } + + @Test(expected = BeanCreationException.class) + public void wrongPasswordCauseFailure() { + EurekaClientRunner client = createEurekaClient(); + enableTlsClient(client); + client.setKeyStore(clientCert, WRONG_PASSWORD, WRONG_PASSWORD); + client.start(); + } + + @Test(expected = BeanCreationException.class) + public void nonExistKeyStoreCauseFailure() { + EurekaClientRunner client = createEurekaClient(); + enableTlsClient(client); + client.setKeyStore(new File("nonExistFile")); + client.start(); + } + + @Test + public void wrongTrustStoreCannotWork() { + try (EurekaClientRunner client = createEurekaClient()) { + enableTlsClient(client); + client.setTrustStore(wrongCaCert); + client.start(); + assertThat(client.foundServiceViaEureka()).isFalse(); + } + } + + @SpringBootConfiguration + @EnableAutoConfiguration + public static class TestApp { + + } + + @SpringBootConfiguration + @EnableAutoConfiguration + @EnableEurekaServer + public static class TestEurekaServer { + + } + +} diff --git a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaServerRunner.java b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaServerRunner.java new file mode 100644 index 000000000..a5fb15763 --- /dev/null +++ b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/EurekaServerRunner.java @@ -0,0 +1,56 @@ +/* + * Copyright 2018-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.eureka; + +import java.io.File; + +public class EurekaServerRunner extends AppRunner { + + public EurekaServerRunner(Class appClass) { + super(appClass); + + property("eureka.client.registerWithEureka", "false"); + property("eureka.client.fetchRegistry", "false"); + property("eureka.server.waitTimeInMsWhenSyncEmpty", "0"); + property("eureka.client.refresh.enable", "true"); + } + + public void enableTls() { + property("server.ssl.enabled", "true"); + property("server.ssl.client-auth", "need"); + } + + public void setKeyStore(File keyStore, String keyStorePassword, String key, + String keyPassword) { + property("server.ssl.key-store", pathOf(keyStore)); + property("server.ssl.key-store-type", "PKCS12"); + property("server.ssl.key-store-password", keyStorePassword); + property("server.ssl.key-alias", key); + property("server.ssl.key-password", keyPassword); + } + + public void setTrustStore(File trustStore, String password) { + property("server.ssl.trust-store", pathOf(trustStore)); + property("server.ssl.trust-store-type", "PKCS12"); + property("server.ssl.trust-store-password", password); + } + + private String pathOf(File file) { + return String.format("file:%s", file.getAbsolutePath()); + } + +} diff --git a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/KeyAndCert.java b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/KeyAndCert.java new file mode 100644 index 000000000..192febd07 --- /dev/null +++ b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/KeyAndCert.java @@ -0,0 +1,94 @@ +/* + * Copyright 2018-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.eureka; + +import java.security.KeyPair; +import java.security.KeyStore; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.cert.Certificate; +import java.security.cert.X509Certificate; + +public class KeyAndCert { + + private KeyPair keyPair; + + private X509Certificate certificate; + + public KeyAndCert(KeyPair keyPair, X509Certificate certificate) { + this.keyPair = keyPair; + this.certificate = certificate; + } + + public KeyPair keyPair() { + return keyPair; + } + + public PublicKey publicKey() { + return keyPair.getPublic(); + } + + public PrivateKey privateKey() { + return keyPair.getPrivate(); + } + + public X509Certificate certificate() { + return certificate; + } + + public String subject() { + String dn = certificate.getSubjectDN().getName(); + int index = dn.indexOf('='); + return dn.substring(index + 1); + } + + public KeyAndCert sign(String subject) throws Exception { + KeyTool tool = new KeyTool(); + return tool.signCertificate(subject, this); + } + + public KeyAndCert sign(KeyPair keyPair, String subject) throws Exception { + KeyTool tool = new KeyTool(); + return tool.signCertificate(keyPair, subject, this); + } + + public KeyStore storeKeyAndCert(String keyPassword) throws Exception { + KeyStore result = KeyStore.getInstance("PKCS12"); + result.load(null); + + result.setKeyEntry(subject(), keyPair.getPrivate(), keyPassword.toCharArray(), + certChain()); + return result; + } + + private Certificate[] certChain() { + return new Certificate[] { certificate() }; + } + + public KeyStore storeCert() throws Exception { + return storeCert("PKCS12"); + } + + public KeyStore storeCert(String storeType) throws Exception { + KeyStore result = KeyStore.getInstance(storeType); + result.load(null); + + result.setCertificateEntry(subject(), certificate()); + return result; + } + +} diff --git a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/KeyTool.java b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/KeyTool.java new file mode 100644 index 000000000..b1e22fea1 --- /dev/null +++ b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/KeyTool.java @@ -0,0 +1,126 @@ +/* + * Copyright 2018-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.eureka; + +import java.math.BigInteger; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.util.Date; + +import org.bouncycastle.asn1.DERSequence; +import org.bouncycastle.asn1.x500.X500Name; +import org.bouncycastle.asn1.x509.BasicConstraints; +import org.bouncycastle.asn1.x509.Extension; +import org.bouncycastle.asn1.x509.GeneralName; +import org.bouncycastle.asn1.x509.GeneralNames; +import org.bouncycastle.asn1.x509.KeyUsage; +import org.bouncycastle.cert.X509CertificateHolder; +import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; +import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; +import org.bouncycastle.operator.ContentSigner; +import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; + +public class KeyTool { + + private static final long ONE_DAY = 1000L * 60L * 60L * 24L; + + private static final long TEN_YEARS = ONE_DAY * 365L * 10L; + + public KeyAndCert createCA(String ca) throws Exception { + KeyPair keyPair = createKeyPair(); + X509Certificate certificate = createCert(keyPair, ca); + return new KeyAndCert(keyPair, certificate); + } + + public KeyAndCert signCertificate(String subject, KeyAndCert signer) + throws Exception { + return signCertificate(createKeyPair(), subject, signer); + } + + public KeyAndCert signCertificate(KeyPair keyPair, String subject, KeyAndCert signer) + throws Exception { + X509Certificate certificate = createCert(keyPair.getPublic(), signer.privateKey(), + signer.subject(), subject); + KeyAndCert result = new KeyAndCert(keyPair, certificate); + + return result; + } + + public KeyPair createKeyPair() throws Exception { + return createKeyPair(1024); + } + + public KeyPair createKeyPair(int keySize) throws Exception { + KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); + gen.initialize(keySize, new SecureRandom()); + return gen.generateKeyPair(); + } + + public X509Certificate createCert(KeyPair keyPair, String ca) throws Exception { + JcaX509v3CertificateBuilder builder = certBuilder(keyPair.getPublic(), ca, ca); + builder.addExtension(Extension.keyUsage, true, + new KeyUsage(KeyUsage.keyCertSign)); + builder.addExtension(Extension.basicConstraints, false, + new BasicConstraints(true)); + + return signCert(builder, keyPair.getPrivate()); + } + + public X509Certificate createCert(PublicKey publicKey, PrivateKey privateKey, + String issuer, String subject) throws Exception { + JcaX509v3CertificateBuilder builder = certBuilder(publicKey, issuer, subject); + builder.addExtension(Extension.keyUsage, true, + new KeyUsage(KeyUsage.digitalSignature)); + builder.addExtension(Extension.basicConstraints, false, + new BasicConstraints(false)); + + GeneralName[] names = new GeneralName[] { + new GeneralName(GeneralName.dNSName, "localhost") }; + builder.addExtension(Extension.subjectAlternativeName, false, + GeneralNames.getInstance(new DERSequence(names))); + + return signCert(builder, privateKey); + } + + private JcaX509v3CertificateBuilder certBuilder(PublicKey publicKey, String issuer, + String subject) { + X500Name issuerName = new X500Name(String.format("dc=%s", issuer)); + X500Name subjectName = new X500Name(String.format("dc=%s", subject)); + + long now = System.currentTimeMillis(); + BigInteger serialNum = BigInteger.valueOf(now); + Date notBefore = new Date(now - ONE_DAY); + Date notAfter = new Date(now + TEN_YEARS); + + return new JcaX509v3CertificateBuilder(issuerName, serialNum, notBefore, notAfter, + subjectName, publicKey); + } + + private X509Certificate signCert(JcaX509v3CertificateBuilder builder, + PrivateKey privateKey) throws Exception { + ContentSigner signer = new JcaContentSignerBuilder("SHA256WithRSA") + .build(privateKey); + X509CertificateHolder holder = builder.build(signer); + + return new JcaX509CertificateConverter().getCertificate(holder); + } + +} diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java index be5d14cc7..88300bcc7 100644 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java @@ -16,15 +16,20 @@ package org.springframework.cloud.netflix.eureka.config; +import java.io.IOException; +import java.security.GeneralSecurityException; + import com.netflix.discovery.AbstractDiscoveryClientOptionalArgs; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.SearchStrategy; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.cloud.netflix.eureka.MutableDiscoveryClientOptionalArgs; import org.springframework.cloud.netflix.eureka.http.RestTemplateDiscoveryClientOptionalArgs; import org.springframework.cloud.netflix.eureka.http.WebClientDiscoveryClientOptionalArgs; @@ -35,8 +40,12 @@ import org.springframework.context.annotation.Configuration; * @author Daniel Lavoie */ @Configuration(proxyBeanMethods = false) +@EnableConfigurationProperties(TlsProperties.class) public class DiscoveryClientOptionalArgsConfiguration { + @Autowired + private TlsProperties tls; + protected final Log logger = LogFactory.getLog(getClass()); @Bean @@ -45,9 +54,12 @@ public class DiscoveryClientOptionalArgsConfiguration { search = SearchStrategy.CURRENT) @ConditionalOnProperty(prefix = "eureka.client", name = "webclient.enabled", matchIfMissing = true, havingValue = "false") - public RestTemplateDiscoveryClientOptionalArgs restTemplateDiscoveryClientOptionalArgs() { + public RestTemplateDiscoveryClientOptionalArgs restTemplateDiscoveryClientOptionalArgs() + throws GeneralSecurityException, IOException { logger.info("Eureka HTTP Client uses RestTemplate."); - return new RestTemplateDiscoveryClientOptionalArgs(); + RestTemplateDiscoveryClientOptionalArgs result = new RestTemplateDiscoveryClientOptionalArgs(); + setupTLS(result); + return result; } @Bean @@ -60,17 +72,31 @@ public class DiscoveryClientOptionalArgsConfiguration { search = SearchStrategy.CURRENT) @ConditionalOnProperty(prefix = "eureka.client", name = "webclient.enabled", havingValue = "true") - public WebClientDiscoveryClientOptionalArgs webClientDiscoveryClientOptionalArgs() { + public WebClientDiscoveryClientOptionalArgs webClientDiscoveryClientOptionalArgs() + throws GeneralSecurityException, IOException { logger.info("Eureka HTTP Client uses WebClient."); - return new WebClientDiscoveryClientOptionalArgs(); + WebClientDiscoveryClientOptionalArgs result = new WebClientDiscoveryClientOptionalArgs(); + setupTLS(result); + return result; } @Bean @ConditionalOnClass(name = "com.sun.jersey.api.client.filter.ClientFilter") @ConditionalOnMissingBean(value = AbstractDiscoveryClientOptionalArgs.class, search = SearchStrategy.CURRENT) - public MutableDiscoveryClientOptionalArgs discoveryClientOptionalArgs() { - return new MutableDiscoveryClientOptionalArgs(); + public MutableDiscoveryClientOptionalArgs discoveryClientOptionalArgs() + throws GeneralSecurityException, IOException { + logger.info("Eureka HTTP Client uses Jersey"); + MutableDiscoveryClientOptionalArgs result = new MutableDiscoveryClientOptionalArgs(); + setupTLS(result); + return result; + } + + private void setupTLS(AbstractDiscoveryClientOptionalArgs args) + throws GeneralSecurityException, IOException { + if (tls.isEnabled()) { + args.setSSLContext(tls.createSSLContext()); + } } @Configuration diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/TlsProperties.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/TlsProperties.java new file mode 100644 index 000000000..9f8958789 --- /dev/null +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/TlsProperties.java @@ -0,0 +1,255 @@ +/* + * Copyright 2017-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.eureka.config; + +import java.io.IOException; +import java.io.InputStream; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.UnrecoverableKeyException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.net.ssl.SSLContext; + +import org.apache.http.ssl.SSLContextBuilder; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.core.io.Resource; + +/** + * Eureka client TLS properties. + */ +@ConfigurationProperties(TlsProperties.PREFIX) +public class TlsProperties { + + /** + * Prefix for Eureka client TLS properties. + */ + public static final String PREFIX = "eureka.client.tls"; + + private static final String DEFAULT_STORE_TYPE = "PKCS12"; + + private static final Map EXTENSION_STORE_TYPES = extTypes(); + + private boolean enabled; + + private Resource keyStore; + + private String keyStoreType; + + private String keyStorePassword = ""; + + private String keyPassword = ""; + + private Resource trustStore; + + private String trustStoreType; + + private String trustStorePassword = ""; + + private static Map extTypes() { + Map result = new HashMap<>(); + + result.put("p12", "PKCS12"); + result.put("pfx", "PKCS12"); + result.put("jks", "JKS"); + + return Collections.unmodifiableMap(result); + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public Resource getKeyStore() { + return keyStore; + } + + public void setKeyStore(Resource keyStore) { + this.keyStore = keyStore; + } + + public String getKeyStoreType() { + return keyStoreType; + } + + public void setKeyStoreType(String keyStoreType) { + this.keyStoreType = keyStoreType; + } + + public String getKeyStorePassword() { + return keyStorePassword; + } + + public void setKeyStorePassword(String keyStorePassword) { + this.keyStorePassword = keyStorePassword; + } + + public char[] keyStorePassword() { + return keyStorePassword.toCharArray(); + } + + public String getKeyPassword() { + return keyPassword; + } + + public void setKeyPassword(String keyPassword) { + this.keyPassword = keyPassword; + } + + public char[] keyPassword() { + return keyPassword.toCharArray(); + } + + public Resource getTrustStore() { + return trustStore; + } + + public void setTrustStore(Resource trustStore) { + this.trustStore = trustStore; + } + + public String getTrustStoreType() { + return trustStoreType; + } + + public void setTrustStoreType(String trustStoreType) { + this.trustStoreType = trustStoreType; + } + + public String getTrustStorePassword() { + return trustStorePassword; + } + + public void setTrustStorePassword(String trustStorePassword) { + this.trustStorePassword = trustStorePassword; + } + + public char[] trustStorePassword() { + return trustStorePassword.toCharArray(); + } + + @PostConstruct + public void postConstruct() { + if (keyStore != null && keyStoreType == null) { + keyStoreType = storeTypeOf(keyStore); + } + if (trustStore != null && trustStoreType == null) { + trustStoreType = storeTypeOf(trustStore); + } + } + + private String storeTypeOf(Resource resource) { + String extension = fileExtensionOf(resource); + String type = EXTENSION_STORE_TYPES.get(extension); + + return (type == null) ? DEFAULT_STORE_TYPE : type; + } + + private String fileExtensionOf(Resource resource) { + String name = resource.getFilename(); + int index = name.lastIndexOf('.'); + + return index < 0 ? "" : name.substring(index + 1).toLowerCase(); + } + + public SSLContext createSSLContext() throws GeneralSecurityException, IOException { + SSLContextBuilder builder = new SSLContextBuilder(); + char[] keyPassword = keyPassword(); + KeyStore keyStore = createKeyStore(); + + try { + builder.loadKeyMaterial(keyStore, keyPassword); + } + catch (UnrecoverableKeyException e) { + if (keyPassword.length == 0) { + // Retry if empty password, see + // https://rt.openssl.org/Ticket/Display.html?id=1497&user=guest&pass=guest + builder.loadKeyMaterial(keyStore, new char[] { '\0' }); + } + else { + throw e; + } + } + + KeyStore trust = createTrustStore(); + if (trust != null) { + builder.loadTrustMaterial(trust, null); + } + + return builder.build(); + } + + private KeyStore createKeyStore() throws GeneralSecurityException, IOException { + if (keyStore == null) { + throw new KeyStoreException("Keystore not specified."); + } + if (!keyStore.exists()) { + throw new KeyStoreException("Keystore not exists: " + keyStore); + } + + KeyStore result = KeyStore.getInstance(keyStoreType); + char[] keyStorePassword = keyStorePassword(); + + try { + loadKeyStore(result, keyStore, keyStorePassword); + } + catch (IOException e) { + // Retry if empty password, see + // https://rt.openssl.org/Ticket/Display.html?id=1497&user=guest&pass=guest + if (keyStorePassword.length == 0) { + loadKeyStore(result, keyStore, new char[] { '\0' }); + } + else { + throw e; + } + } + + return result; + } + + private static void loadKeyStore(KeyStore keyStore, Resource keyStoreResource, + char[] keyStorePassword) throws IOException, GeneralSecurityException { + try (InputStream inputStream = keyStoreResource.getInputStream()) { + keyStore.load(inputStream, keyStorePassword); + } + } + + private KeyStore createTrustStore() throws GeneralSecurityException, IOException { + if (trustStore == null) { + return null; + } + if (!trustStore.exists()) { + throw new KeyStoreException("KeyStore not exists: " + trustStore); + } + + KeyStore result = KeyStore.getInstance(trustStoreType); + try (InputStream input = trustStore.getInputStream()) { + result.load(input, trustStorePassword()); + } + return result; + } + +} From 072418826ee01b050f19963d6f7470aafe1a52ff Mon Sep 17 00:00:00 2001 From: JiaLin Date: Sat, 1 Aug 2020 22:19:48 +0800 Subject: [PATCH 6/9] Update spring-cloud-netflix.adoc --- .../main/asciidoc/spring-cloud-netflix.adoc | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/src/main/asciidoc/spring-cloud-netflix.adoc b/docs/src/main/asciidoc/spring-cloud-netflix.adoc index 789672194..3e8578819 100755 --- a/docs/src/main/asciidoc/spring-cloud-netflix.adoc +++ b/docs/src/main/asciidoc/spring-cloud-netflix.adoc @@ -87,6 +87,26 @@ For more complex needs, you can create a `@Bean` of type `DiscoveryClientOptiona NOTE: Because of a limitation in Eureka, it is not possible to support per-server basic auth credentials, so only the first set that are found is used. +When Eureka server requires client side certificate for authentication, the client side certificate and trust store can be configured via properties, as shown in following example: + +.application.yml +[source,yaml] +---- +eureka: + client: + tls: + enabled: true + key-store: + key-store-type: PKCS12 + key-store-password: + key-password: + trust-store: + trust-store-type: PKCS12 + trust-store-password: +---- + +The `eureka.client.tls.enabled` needs to be true to enable Eureka client side TLS. When `eureka.client.tls.trust-store` is omitted, a JVM default trust store is used. The default value for `eureka.client.tls.key-store-type` and `eureka.client.tls.trust-store-type` is PKCS12. When password properties are omitted, empty password is assumed. + === Status Page and Health Indicator The status page and health indicators for a Eureka instance default to `/info` and `/health` respectively, which are the default locations of useful endpoints in a Spring Boot Actuator application. From 23d15f70bc34357ce913edec86f432d625905950 Mon Sep 17 00:00:00 2001 From: spencergibb Date: Mon, 3 Aug 2020 13:00:36 -0400 Subject: [PATCH 7/9] Updates s-c-build to 2.3.2.BUILD-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 80a074046..52c659309 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.springframework.cloud spring-cloud-build - 2.3.1.RELEASE + 2.3.2.BUILD-SNAPSHOT From a3436d08eb337211736af3e1f42ea72dcd8253a7 Mon Sep 17 00:00:00 2001 From: JiaLin Date: Sun, 23 Aug 2020 15:53:14 +0800 Subject: [PATCH 8/9] Use common TLS classes --- .../cloud/netflix/eureka/BaseCertTest.java | 3 - ...coveryClientOptionalArgsConfiguration.java | 34 ++- .../eureka/config/EurekaTlsProperties.java | 33 +++ .../netflix/eureka/config/TlsProperties.java | 255 ------------------ 4 files changed, 48 insertions(+), 277 deletions(-) create mode 100644 spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaTlsProperties.java delete mode 100644 spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/TlsProperties.java diff --git a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java index f4bb62115..c910111af 100644 --- a/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java +++ b/spring-cloud-netflix-eureka-client-tls-tests/src/test/java/org/springframework/cloud/netflix/eureka/BaseCertTest.java @@ -61,9 +61,6 @@ public abstract class BaseCertTest { wrongCaCert = saveCert(wrongCa); wrongClientCert = saveKeyAndCert(wrongClient); - - System.setProperty("javax.net.ssl.trustStore", caCert.getAbsolutePath()); - System.setProperty("javax.net.ssl.trustStorePassword", KEY_STORE_PASSWORD); } private static File saveKeyAndCert(KeyAndCert keyCert) throws Exception { diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java index 5b5b32aa9..d6ecf832a 100644 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java @@ -31,6 +31,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClas import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.SearchStrategy; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.cloud.configuration.SSLContextFactory; +import org.springframework.cloud.configuration.TlsProperties; import org.springframework.cloud.netflix.eureka.MutableDiscoveryClientOptionalArgs; import org.springframework.cloud.netflix.eureka.http.RestTemplateDiscoveryClientOptionalArgs; import org.springframework.cloud.netflix.eureka.http.WebClientDiscoveryClientOptionalArgs; @@ -42,15 +44,15 @@ import org.springframework.web.reactive.function.client.WebClient; * @author Daniel Lavoie */ @Configuration(proxyBeanMethods = false) -@EnableConfigurationProperties(TlsProperties.class) +@EnableConfigurationProperties(EurekaTlsProperties.class) public class DiscoveryClientOptionalArgsConfiguration { - @Autowired - private TlsProperties tls; - protected static final Log logger = LogFactory .getLog(DiscoveryClientOptionalArgsConfiguration.class); + @Autowired + private EurekaTlsProperties tlsProperties; + @Bean @ConditionalOnMissingClass("com.sun.jersey.api.client.filter.ClientFilter") @ConditionalOnMissingBean(value = { AbstractDiscoveryClientOptionalArgs.class }, @@ -61,7 +63,7 @@ public class DiscoveryClientOptionalArgsConfiguration { throws GeneralSecurityException, IOException { logger.info("Eureka HTTP Client uses RestTemplate."); RestTemplateDiscoveryClientOptionalArgs result = new RestTemplateDiscoveryClientOptionalArgs(); - setupTLS(result); + setupTLS(result, tlsProperties); return result; } @@ -73,14 +75,15 @@ public class DiscoveryClientOptionalArgsConfiguration { throws GeneralSecurityException, IOException { logger.info("Eureka HTTP Client uses Jersey"); MutableDiscoveryClientOptionalArgs result = new MutableDiscoveryClientOptionalArgs(); - setupTLS(result); + setupTLS(result, tlsProperties); return result; } - private void setupTLS(AbstractDiscoveryClientOptionalArgs args) - throws GeneralSecurityException, IOException { - if (tls.isEnabled()) { - args.setSSLContext(tls.createSSLContext()); + private static void setupTLS(AbstractDiscoveryClientOptionalArgs args, + TlsProperties properties) throws GeneralSecurityException, IOException { + if (properties.isEnabled()) { + SSLContextFactory factory = new SSLContextFactory(properties); + args.setSSLContext(factory.createSSLContext()); } } @@ -92,7 +95,7 @@ public class DiscoveryClientOptionalArgsConfiguration { protected static class WebClientConfiguration { @Autowired - private TlsProperties tls; + private EurekaTlsProperties tlsProperties; @Bean @ConditionalOnMissingBean( @@ -105,17 +108,10 @@ public class DiscoveryClientOptionalArgsConfiguration { logger.info("Eureka HTTP Client uses WebClient."); WebClientDiscoveryClientOptionalArgs result = new WebClientDiscoveryClientOptionalArgs( builder::getIfAvailable); - setupTLS(result); + setupTLS(result, tlsProperties); return result; } - private void setupTLS(AbstractDiscoveryClientOptionalArgs args) - throws GeneralSecurityException, IOException { - if (tls.isEnabled()) { - args.setSSLContext(tls.createSSLContext()); - } - } - } @Configuration diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaTlsProperties.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaTlsProperties.java new file mode 100644 index 000000000..441f79a2f --- /dev/null +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaTlsProperties.java @@ -0,0 +1,33 @@ +/* + * Copyright 2017-2020 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.eureka.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.cloud.configuration.TlsProperties; + +/** + * Eureka client TLS properties. + */ +@ConfigurationProperties(EurekaTlsProperties.PREFIX) +public class EurekaTlsProperties extends TlsProperties { + + /** + * Prefix for Eureka client TLS properties. + */ + public static final String PREFIX = "eureka.client.tls"; + +} diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/TlsProperties.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/TlsProperties.java deleted file mode 100644 index 9f8958789..000000000 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/TlsProperties.java +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright 2017-2020 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.netflix.eureka.config; - -import java.io.IOException; -import java.io.InputStream; -import java.security.GeneralSecurityException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.UnrecoverableKeyException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.annotation.PostConstruct; -import javax.net.ssl.SSLContext; - -import org.apache.http.ssl.SSLContextBuilder; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.core.io.Resource; - -/** - * Eureka client TLS properties. - */ -@ConfigurationProperties(TlsProperties.PREFIX) -public class TlsProperties { - - /** - * Prefix for Eureka client TLS properties. - */ - public static final String PREFIX = "eureka.client.tls"; - - private static final String DEFAULT_STORE_TYPE = "PKCS12"; - - private static final Map EXTENSION_STORE_TYPES = extTypes(); - - private boolean enabled; - - private Resource keyStore; - - private String keyStoreType; - - private String keyStorePassword = ""; - - private String keyPassword = ""; - - private Resource trustStore; - - private String trustStoreType; - - private String trustStorePassword = ""; - - private static Map extTypes() { - Map result = new HashMap<>(); - - result.put("p12", "PKCS12"); - result.put("pfx", "PKCS12"); - result.put("jks", "JKS"); - - return Collections.unmodifiableMap(result); - } - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - public Resource getKeyStore() { - return keyStore; - } - - public void setKeyStore(Resource keyStore) { - this.keyStore = keyStore; - } - - public String getKeyStoreType() { - return keyStoreType; - } - - public void setKeyStoreType(String keyStoreType) { - this.keyStoreType = keyStoreType; - } - - public String getKeyStorePassword() { - return keyStorePassword; - } - - public void setKeyStorePassword(String keyStorePassword) { - this.keyStorePassword = keyStorePassword; - } - - public char[] keyStorePassword() { - return keyStorePassword.toCharArray(); - } - - public String getKeyPassword() { - return keyPassword; - } - - public void setKeyPassword(String keyPassword) { - this.keyPassword = keyPassword; - } - - public char[] keyPassword() { - return keyPassword.toCharArray(); - } - - public Resource getTrustStore() { - return trustStore; - } - - public void setTrustStore(Resource trustStore) { - this.trustStore = trustStore; - } - - public String getTrustStoreType() { - return trustStoreType; - } - - public void setTrustStoreType(String trustStoreType) { - this.trustStoreType = trustStoreType; - } - - public String getTrustStorePassword() { - return trustStorePassword; - } - - public void setTrustStorePassword(String trustStorePassword) { - this.trustStorePassword = trustStorePassword; - } - - public char[] trustStorePassword() { - return trustStorePassword.toCharArray(); - } - - @PostConstruct - public void postConstruct() { - if (keyStore != null && keyStoreType == null) { - keyStoreType = storeTypeOf(keyStore); - } - if (trustStore != null && trustStoreType == null) { - trustStoreType = storeTypeOf(trustStore); - } - } - - private String storeTypeOf(Resource resource) { - String extension = fileExtensionOf(resource); - String type = EXTENSION_STORE_TYPES.get(extension); - - return (type == null) ? DEFAULT_STORE_TYPE : type; - } - - private String fileExtensionOf(Resource resource) { - String name = resource.getFilename(); - int index = name.lastIndexOf('.'); - - return index < 0 ? "" : name.substring(index + 1).toLowerCase(); - } - - public SSLContext createSSLContext() throws GeneralSecurityException, IOException { - SSLContextBuilder builder = new SSLContextBuilder(); - char[] keyPassword = keyPassword(); - KeyStore keyStore = createKeyStore(); - - try { - builder.loadKeyMaterial(keyStore, keyPassword); - } - catch (UnrecoverableKeyException e) { - if (keyPassword.length == 0) { - // Retry if empty password, see - // https://rt.openssl.org/Ticket/Display.html?id=1497&user=guest&pass=guest - builder.loadKeyMaterial(keyStore, new char[] { '\0' }); - } - else { - throw e; - } - } - - KeyStore trust = createTrustStore(); - if (trust != null) { - builder.loadTrustMaterial(trust, null); - } - - return builder.build(); - } - - private KeyStore createKeyStore() throws GeneralSecurityException, IOException { - if (keyStore == null) { - throw new KeyStoreException("Keystore not specified."); - } - if (!keyStore.exists()) { - throw new KeyStoreException("Keystore not exists: " + keyStore); - } - - KeyStore result = KeyStore.getInstance(keyStoreType); - char[] keyStorePassword = keyStorePassword(); - - try { - loadKeyStore(result, keyStore, keyStorePassword); - } - catch (IOException e) { - // Retry if empty password, see - // https://rt.openssl.org/Ticket/Display.html?id=1497&user=guest&pass=guest - if (keyStorePassword.length == 0) { - loadKeyStore(result, keyStore, new char[] { '\0' }); - } - else { - throw e; - } - } - - return result; - } - - private static void loadKeyStore(KeyStore keyStore, Resource keyStoreResource, - char[] keyStorePassword) throws IOException, GeneralSecurityException { - try (InputStream inputStream = keyStoreResource.getInputStream()) { - keyStore.load(inputStream, keyStorePassword); - } - } - - private KeyStore createTrustStore() throws GeneralSecurityException, IOException { - if (trustStore == null) { - return null; - } - if (!trustStore.exists()) { - throw new KeyStoreException("KeyStore not exists: " + trustStore); - } - - KeyStore result = KeyStore.getInstance(trustStoreType); - try (InputStream input = trustStore.getInputStream()) { - result.load(input, trustStorePassword()); - } - return result; - } - -} From eeaeeb3e6f6553182474520abf5c99a9e0f58ab3 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Mon, 24 Aug 2020 16:11:59 -0400 Subject: [PATCH 9/9] Code review changes --- pom.xml | 13 ------------ .../pom.xml | 3 +++ ...coveryClientOptionalArgsConfiguration.java | 20 ++++++++++--------- .../eureka/config/EurekaTlsProperties.java | 3 +-- 4 files changed, 15 insertions(+), 24 deletions(-) diff --git a/pom.xml b/pom.xml index 02a496fac..afe0c0a1c 100644 --- a/pom.xml +++ b/pom.xml @@ -34,9 +34,6 @@ java 1.19.1 1.4.11.1 - - 1.64 - 2.1 @@ -179,16 +176,6 @@ ${xstream.version} - - org.bouncycastle - bcpkix-jdk15on - ${bouncycastle.version} - - - javax.xml - jaxb-impl - ${jaxb.version} - diff --git a/spring-cloud-netflix-eureka-client-tls-tests/pom.xml b/spring-cloud-netflix-eureka-client-tls-tests/pom.xml index 649b6885d..5dc260500 100644 --- a/spring-cloud-netflix-eureka-client-tls-tests/pom.xml +++ b/spring-cloud-netflix-eureka-client-tls-tests/pom.xml @@ -90,11 +90,14 @@ org.bouncycastle bcpkix-jdk15on + 1.64 test javax.xml jaxb-impl + 2.1 + test diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java index d6ecf832a..7c2d69247 100644 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java @@ -30,7 +30,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.SearchStrategy; -import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.cloud.configuration.SSLContextFactory; import org.springframework.cloud.configuration.TlsProperties; import org.springframework.cloud.netflix.eureka.MutableDiscoveryClientOptionalArgs; @@ -44,14 +44,16 @@ import org.springframework.web.reactive.function.client.WebClient; * @author Daniel Lavoie */ @Configuration(proxyBeanMethods = false) -@EnableConfigurationProperties(EurekaTlsProperties.class) public class DiscoveryClientOptionalArgsConfiguration { protected static final Log logger = LogFactory .getLog(DiscoveryClientOptionalArgsConfiguration.class); - @Autowired - private EurekaTlsProperties tlsProperties; + @Bean + @ConfigurationProperties("eureka.client.tls") + public TlsProperties tlsProperties() { + return new TlsProperties(); + } @Bean @ConditionalOnMissingClass("com.sun.jersey.api.client.filter.ClientFilter") @@ -59,8 +61,8 @@ public class DiscoveryClientOptionalArgsConfiguration { search = SearchStrategy.CURRENT) @ConditionalOnProperty(prefix = "eureka.client", name = "webclient.enabled", matchIfMissing = true, havingValue = "false") - public RestTemplateDiscoveryClientOptionalArgs restTemplateDiscoveryClientOptionalArgs() - throws GeneralSecurityException, IOException { + public RestTemplateDiscoveryClientOptionalArgs restTemplateDiscoveryClientOptionalArgs( + TlsProperties tlsProperties) throws GeneralSecurityException, IOException { logger.info("Eureka HTTP Client uses RestTemplate."); RestTemplateDiscoveryClientOptionalArgs result = new RestTemplateDiscoveryClientOptionalArgs(); setupTLS(result, tlsProperties); @@ -71,8 +73,8 @@ public class DiscoveryClientOptionalArgsConfiguration { @ConditionalOnClass(name = "com.sun.jersey.api.client.filter.ClientFilter") @ConditionalOnMissingBean(value = AbstractDiscoveryClientOptionalArgs.class, search = SearchStrategy.CURRENT) - public MutableDiscoveryClientOptionalArgs discoveryClientOptionalArgs() - throws GeneralSecurityException, IOException { + public MutableDiscoveryClientOptionalArgs discoveryClientOptionalArgs( + TlsProperties tlsProperties) throws GeneralSecurityException, IOException { logger.info("Eureka HTTP Client uses Jersey"); MutableDiscoveryClientOptionalArgs result = new MutableDiscoveryClientOptionalArgs(); setupTLS(result, tlsProperties); @@ -95,7 +97,7 @@ public class DiscoveryClientOptionalArgsConfiguration { protected static class WebClientConfiguration { @Autowired - private EurekaTlsProperties tlsProperties; + private TlsProperties tlsProperties; @Bean @ConditionalOnMissingBean( diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaTlsProperties.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaTlsProperties.java index 441f79a2f..9e9d17a2b 100644 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaTlsProperties.java +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaTlsProperties.java @@ -16,13 +16,12 @@ package org.springframework.cloud.netflix.eureka.config; -import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.cloud.configuration.TlsProperties; /** * Eureka client TLS properties. */ -@ConfigurationProperties(EurekaTlsProperties.PREFIX) + public class EurekaTlsProperties extends TlsProperties { /**