Skip to content

Commit 927c097

Browse files
committed
ZOOKEEPER-4958: Fix client hostname verification ignored in server if ssl.authProvider configured
Reviewers: anmolnar Author: kezhuw Closes #2303 from kezhuw/ZOOKEEPER-4958-client-server-hostname-verification (cherry picked from commit a7fe813) Signed-off-by: Kezhu Wang <kezhuw@apache.org>
1 parent 3b6bbfa commit 927c097

3 files changed

Lines changed: 532 additions & 2 deletions

File tree

zookeeper-server/src/main/java/org/apache/zookeeper/server/auth/KeyAuthenticationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* See the "Pluggable ZooKeeper authentication" section of the
3838
* "Zookeeper Programmer's Guide" for general details of implementing an
3939
* authentication plugin. e.g.
40-
* http://zookeeper.apache.org/doc/trunk/zookeeperProgrammers.html#sc_ZooKeeperPluggableAuthentication
40+
* http://zookeeper.apache.org/doc/current/zookeeperProgrammers.html#sc_ZooKeeperPluggableAuthentication
4141
*
4242
* This class looks for a numeric "key" under the /key node.
4343
* Authorization is granted if the user passes in as authorization a number

zookeeper-server/src/main/java/org/apache/zookeeper/server/auth/X509AuthenticationProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public X509AuthenticationProvider() throws X509Exception {
8888
boolean crlEnabled = Boolean.parseBoolean(config.getProperty(x509Util.getSslCrlEnabledProperty()));
8989
boolean ocspEnabled = Boolean.parseBoolean(config.getProperty(x509Util.getSslOcspEnabledProperty()));
9090
boolean hostnameVerificationEnabled = Boolean.parseBoolean(config.getProperty(x509Util.getSslHostnameVerificationEnabledProperty()));
91+
boolean clientHostnameVerificationEnabled = x509Util.isClientHostnameVerificationEnabled(config);
9192
boolean allowReverseDnsLookup = Boolean.parseBoolean(config.getProperty(x509Util.getSslAllowReverseDnsLookupProperty()));
9293

9394
X509KeyManager km = null;
@@ -120,7 +121,7 @@ public X509AuthenticationProvider() throws X509Exception {
120121
crlEnabled,
121122
ocspEnabled,
122123
hostnameVerificationEnabled,
123-
false,
124+
clientHostnameVerificationEnabled,
124125
allowReverseDnsLookup,
125126
fipsMode);
126127
} catch (TrustManagerException e) {

0 commit comments

Comments
 (0)