Skip to content

Commit a7fe813

Browse files
authored
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
1 parent 3fc7ccc commit a7fe813

File tree

3 files changed

+532
-2
lines changed

3 files changed

+532
-2
lines changed

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
@@ -89,6 +89,7 @@ public X509AuthenticationProvider() throws X509Exception {
8989
boolean crlEnabled = config.getBoolean(x509Util.getSslCrlEnabledProperty(), Boolean.getBoolean("com.sun.net.ssl.checkRevocation"));
9090
boolean ocspEnabled = config.getBoolean(x509Util.getSslOcspEnabledProperty(), Boolean.parseBoolean(Security.getProperty("ocsp.enable")));
9191
boolean hostnameVerificationEnabled = Boolean.parseBoolean(config.getProperty(x509Util.getSslHostnameVerificationEnabledProperty()));
92+
boolean clientHostnameVerificationEnabled = x509Util.isClientHostnameVerificationEnabled(config);
9293
boolean allowReverseDnsLookup = Boolean.parseBoolean(config.getProperty(x509Util.getSslAllowReverseDnsLookupProperty()));
9394

9495
X509KeyManager km = null;
@@ -121,7 +122,7 @@ public X509AuthenticationProvider() throws X509Exception {
121122
crlEnabled,
122123
ocspEnabled,
123124
hostnameVerificationEnabled,
124-
false,
125+
clientHostnameVerificationEnabled,
125126
allowReverseDnsLookup,
126127
fipsMode);
127128
} catch (TrustManagerException e) {

0 commit comments

Comments
 (0)