From 49a06a1a14bec5913a0bc876014c03764ad30ed9 Mon Sep 17 00:00:00 2001 From: Kevin Risden Date: Fri, 3 Jan 2020 15:34:55 -0500 Subject: [PATCH] SOLR-14163: SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION needs to work with Jetty server/client SSL contexts Closes #1147 Signed-off-by: Kevin Risden --- solr/CHANGES.txt | 2 ++ solr/bin/solr | 7 +++--- solr/bin/solr.cmd | 4 ++++ solr/server/etc/jetty-ssl.xml | 1 - solr/solr-ref-guide/src/enabling-ssl.adoc | 10 +++------ .../solr/client/solrj/embedded/SSLConfig.java | 22 ++++++++++++++++++- .../client/solrj/impl/Http2SolrClient.java | 5 ++++- .../solrj/impl/Http2SolrClientTest.java | 11 ++++++++++ 8 files changed, 48 insertions(+), 14 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 25b14939a3d..a1102b602f4 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -132,6 +132,8 @@ Bug Fixes * SOLR-13089: Fix lsof edge cases in the solr CLI script (Martijn Koster via janhoy) +* SOLR-14163: SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION needs to work with Jetty server/client SSL contexts (Kevin Risden) + Other Changes --------------------- diff --git a/solr/bin/solr b/solr/bin/solr index 869a9ff6be1..4faf61b772b 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -206,14 +206,13 @@ if [ "$SOLR_SSL_ENABLED" == "true" ]; then SOLR_SSL_OPTS+=" -Dsolr.jetty.truststore.type=$SOLR_SSL_TRUST_STORE_TYPE" fi - if [ -n "$SOLR_SSL_NEED_CLIENT_AUTH" ]; then - SOLR_SSL_OPTS+=" -Dsolr.jetty.ssl.needClientAuth=$SOLR_SSL_NEED_CLIENT_AUTH" - fi - if [ -z "$SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION" ] ; then SOLR_SSL_OPTS+=" -Dsolr.jetty.ssl.verifyClientHostName=HTTPS" fi + if [ -n "$SOLR_SSL_NEED_CLIENT_AUTH" ]; then + SOLR_SSL_OPTS+=" -Dsolr.jetty.ssl.needClientAuth=$SOLR_SSL_NEED_CLIENT_AUTH" + fi if [ -n "$SOLR_SSL_WANT_CLIENT_AUTH" ]; then SOLR_SSL_OPTS+=" -Dsolr.jetty.ssl.wantClientAuth=$SOLR_SSL_WANT_CLIENT_AUTH" fi diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd index fe816947ba1..05a7472c6c3 100755 --- a/solr/bin/solr.cmd +++ b/solr/bin/solr.cmd @@ -82,6 +82,10 @@ IF "%SOLR_SSL_ENABLED%"=="true" ( set "SOLR_SSL_OPTS=!SOLR_SSL_OPTS! -Dsolr.jetty.truststore.type=%SOLR_SSL_TRUST_STORE_TYPE%" ) + IF NOT DEFINED SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION ( + set "SOLR_SSL_OPTS=!SOLR_SSL_OPTS! -Dsolr.jetty.ssl.verifyClientHostName=HTTPS" + ) + IF DEFINED SOLR_SSL_NEED_CLIENT_AUTH ( set "SOLR_SSL_OPTS=!SOLR_SSL_OPTS! -Dsolr.jetty.ssl.needClientAuth=%SOLR_SSL_NEED_CLIENT_AUTH%" ) diff --git a/solr/server/etc/jetty-ssl.xml b/solr/server/etc/jetty-ssl.xml index 3688c4c7159..53e0ec1109b 100644 --- a/solr/server/etc/jetty-ssl.xml +++ b/solr/server/etc/jetty-ssl.xml @@ -17,7 +17,6 @@ - diff --git a/solr/solr-ref-guide/src/enabling-ssl.adoc b/solr/solr-ref-guide/src/enabling-ssl.adoc index ccfbf008d20..5840e3f35e0 100644 --- a/solr/solr-ref-guide/src/enabling-ssl.adoc +++ b/solr/solr-ref-guide/src/enabling-ssl.adoc @@ -66,7 +66,7 @@ NOTE: If you setup Solr as a service on Linux using the steps outlined in <