Apache Lucene open-source search software
SOLR-13798: SSL: Adding Enabling/Disabling client's hostname verification config
Cao Manh Dat7350c5031635
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex d2cdd723a7e..6f76de59733 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -189,6 +189,8 @@ Improvements* SOLR-13784: EmbeddedSolrServer's defaultCore constructor argument is now optional (David Smiley)+* SOLR-13798: SSL: Adding Enabling/Disabling client's hostname verification config (Cao Manh Dat)+Bug Fixes----------------------diff --git a/solr/bin/solr b/solr/bin/solrindex ca1948f7d88..55cb1479a8a 100755--- a/solr/bin/solr+++ b/solr/bin/solr@@ -209,6 +209,11 @@ if [ "$SOLR_SSL_ENABLED" == "true" ]; thenif [ -n "$SOLR_SSL_NEED_CLIENT_AUTH" ]; thenSOLR_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_WANT_CLIENT_AUTH" ]; thenSOLR_SSL_OPTS+=" -Dsolr.jetty.ssl.wantClientAuth=$SOLR_SSL_WANT_CLIENT_AUTH"fidiff --git a/solr/bin/solr.in.cmd b/solr/bin/solr.in.cmdindex a831c55d3a7..e46233672d3 100755--- a/solr/bin/solr.in.cmd+++ b/solr/bin/solr.in.cmd@@ -122,6 +122,8 @@ REM Require clients to authenticateREM set SOLR_SSL_NEED_CLIENT_AUTH=falseREM Enable clients to authenticate (but not require)REM set SOLR_SSL_WANT_CLIENT_AUTH=false+REM Verify client hostname during SSL handshake+REM set SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION=falseREM SSL Certificates contain host/ip "peer name" information that is validated by default. SettingREM this to false can be useful to disable these checks when re-using a certificate on many hostsREM set SOLR_SSL_CHECK_PEER_NAME=truediff --git a/solr/bin/solr.in.sh b/solr/bin/solr.in.shindex 9d1be37d2e3..d4e6b7bb668 100644--- a/solr/bin/solr.in.sh+++ b/solr/bin/solr.in.sh@@ -139,6 +139,8 @@#SOLR_SSL_NEED_CLIENT_AUTH=false# Enable clients to authenticate (but not require)#SOLR_SSL_WANT_CLIENT_AUTH=false+# Verify client's hostname during SSL handshake+#SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION=false# SSL Certificates contain host/ip "peer name" information that is validated by default. Setting# this to false can be useful to disable these checks when re-using a certificate on many hosts#SOLR_SSL_CHECK_PEER_NAME=truediff --git a/solr/server/etc/jetty-ssl.xml b/solr/server/etc/jetty-ssl.xmlindex 9ff5accf402..367064131ba 100644--- a/solr/server/etc/jetty-ssl.xml+++ b/solr/server/etc/jetty-ssl.xml@@ -17,6 +17,7 @@<Set name="TrustStorePassword"><Ref refid="trustStorePassword"/></Set><Set name="NeedClientAuth"><Property name="solr.jetty.ssl.needClientAuth" default="false"/></Set><Set name="WantClientAuth"><Property name="solr.jetty.ssl.wantClientAuth" default="false"/></Set>+ <Set name="EndpointIdentificationAlgorithm"><Property name="solr.jetty.ssl.verifyClientHostName"/></Set><Set name="KeyStoreType"><Property name="solr.jetty.keystore.type" default="JKS"/></Set><Set name="TrustStoreType"><Property name="solr.jetty.truststore.type" default="JKS"/></Set>diff --git a/solr/solr-ref-guide/src/enabling-ssl.adoc b/solr/solr-ref-guide/src/enabling-ssl.adocindex 5edff5c856d..2d9e69c4609 100644--- a/solr/solr-ref-guide/src/enabling-ssl.adoc+++ b/solr/solr-ref-guide/src/enabling-ssl.adoc@@ -90,6 +90,8 @@ SOLR_SSL_TRUST_STORE_PASSWORD=secretSOLR_SSL_NEED_CLIENT_AUTH=false# Enable clients to authenticate (but not require)SOLR_SSL_WANT_CLIENT_AUTH=false+# Verify client's hostname during SSL handshake+SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION=false# SSL Certificates contain host/ip "peer name" information that is validated by default. Setting# this to false can be useful to disable these checks when re-using a certificate on many hostsSOLR_SSL_CHECK_PEER_NAME=true@@ -101,7 +103,7 @@ SOLR_SSL_TRUST_STORE_TYPE=JKSWhen you start Solr, the `bin/solr` script includes the settings in `bin/solr.in.sh` and will pass these SSL-related system properties to the JVM..Client Authentication Settings-WARNING: Enable either SOLR_SSL_NEED_CLIENT_AUTH or SOLR_SSL_WANT_CLIENT_AUTH but not both at the same time. They are mutually exclusive and Jetty will select one of them which may not be what you expect.+WARNING: Enable either SOLR_SSL_NEED_CLIENT_AUTH or SOLR_SSL_WANT_CLIENT_AUTH but not both at the same time. They are mutually exclusive and Jetty will select one of them which may not be what you expect. SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION should be set to true if you only want requests from authenticated host-names to be accepted.Similarly, when you start Solr on Windows, the `bin\solr.cmd` script includes the settings in `bin\solr.in.cmd` - uncomment and update the set of properties beginning with `SOLR_SSL_*` to pass these SSL-related system properties to the JVM:@@ -121,6 +123,8 @@ REM Require clients to authenticateset SOLR_SSL_NEED_CLIENT_AUTH=falseREM Enable clients to authenticate (but not require)set SOLR_SSL_WANT_CLIENT_AUTH=false+REM Verify client hostname during SSL handshake+set SOLR_SSL_CLIENT_HOSTNAME_VERIFICATION=falseREM SSL Certificates contain host/ip "peer name" information that is validated by default. SettingREM this to false can be useful to disable these checks when re-using a certificate on many hostsset SOLR_SSL_CHECK_PEER_NAME=true