Skip to content

Commit 1dd84c3

Browse files
author
thibaud.coueffe
committed
SASL Digest-MD5 for the ZK Quorum
1 parent 7b4443b commit 1dd84c3

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

manifests/init.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@
136136
Boolean $use_ticket_cache = $zookeeper::params::use_ticket_cache,
137137
Boolean $remove_host_principal = $zookeeper::params::remove_host_principal,
138138
Boolean $remove_realm_principal = $zookeeper::params::remove_realm_principal,
139+
# Quorum SASL /!\ Only works with ZK 3.4.10 or more recent; disabled by default /!\
140+
Boolean $quorum_auth_enable_sasl = $zookeeper::quorum_auth_enable_sasl,
141+
Boolean $quorum_auth_learner_require_sasl = $zookeeper::quorum_auth_learner_require_sasl,
142+
Boolean $quorum_auth_server_require_sasl = $zookeeper::quorum_auth_server_require_sasl,
143+
String $quorum_sasl_user = $zookeeper::quorum_sasl_user,
144+
String $quorum_sasl_password = $zookeeper::quorum_sasl_password,
139145
# four letter words whitelist
140146
Array[String] $whitelist_4lw = $zookeeper::params::whitelist_4lw,
141147
# Metrics Providers

manifests/params.pp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@
210210
# whitelist of Four Letter Words commands, see https://zookeeper.apache.org/doc/r3.4.12/zookeeperAdmin.html#sc_zkCommands
211211
$whitelist_4lw = []
212212

213+
# quorum SASL
214+
$quorum_auth_enable_sasl = false
215+
$quorum_auth_learner_require_sasl = false
216+
$quorum_auth_server_require_sasl = false
217+
$quorum_sasl_user = undef
218+
$quorum_sasl_password = undef
219+
213220
# Metrics Providers
214221
$metrics_provider_classname = undef
215222
$metrics_provider_http_port = 7000

templates/conf/jaas.conf.erb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,17 @@ Server {
1313
<% end %>;
1414
<% end -%>
1515
};
16+
17+
<% if scope.lookupvar("zookeeper::quorum_auth_enable_sasl") -%>
18+
<%# Only tested with Digest-MD5 authentication scheme but it can also work with Kerberos -%>
19+
QuorumServer {
20+
org.apache.zookeeper.server.auth.DigestLoginModule required
21+
user_<%= scope.lookupvar("zookeeper::quorum_sasl_user") %>="<%= scope.lookupvar("zookeeper::quorum_sasl_password") %>";
22+
};
23+
24+
QuorumLearner {
25+
org.apache.zookeeper.server.auth.DigestLoginModule required
26+
username="<%= scope.lookupvar("zookeeper::quorum_sasl_user") %>"
27+
password="<%= scope.lookupvar("zookeeper::quorum_sasl_password") %>";
28+
};
29+
<% end -%>

templates/conf/zoo.cfg.erb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ kerberos.removeRealmFromPrincipal=true
142142
<% end -%>
143143
<% end -%>
144144

145+
<% if scope.lookupvar("zookeeper::quorum_auth_enable_sasl") -%>
146+
quorum.auth.enableSasl=true
147+
<% end -%>
148+
<% if scope.lookupvar("zookeeper::quorum_auth_learner_require_sasl") -%>
149+
quorum.auth.learnerRequireSasl=true
150+
<% end -%>
151+
<% if scope.lookupvar("zookeeper::quorum_auth_server_require_sasl") -%>
152+
quorum.auth.serverRequireSasl=true
153+
<% end -%>
154+
145155
<% if scope.lookupvar("zookeeper::ssl") -%>
146156
# Supported since 3.5.1
147157
<% if ! [nil, :undefined, :undef].include?(scope.lookupvar("zookeeper::secure_client_port")) -%>

0 commit comments

Comments
 (0)