Mitigation Strategy: Enforce Strong Authentication and Authorization (ACLs) within ZooKeeper
-
Description:
- Enable Authentication (zoo.cfg): Modify the
zoo.cfg
file on all ZooKeeper servers. SetauthProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
(or a similar provider likeDigestAuthenticationProvider
). If using Kerberos, configure Kerberos settings (realm,jaasLoginRenew
, keytab files, etc.) directly withinzoo.cfg
and related JAAS configuration files. If using digest authentication, create users and passwords using thezkCli.sh
tool (addauth digest user:password
). - Configure ACLs (zkCli.sh or API): For each znode (or a parent znode to apply recursively), use the
zkCli.sh
tool or the ZooKeeper API (e.g.,setACL()
method) to set ACLs. Specify the scheme (e.g.,sasl
for Kerberos,digest
for username/password), the identifier (e.g., Kerberos principal, username), and the permissions (read, write, create, delete, admin – represented ascdrwa
). Example (zkCli.sh):setAcl /myznode sasl:myuser:cdrwa,sasl:anotheruser:r
. Example (Java API):zooKeeper.setACL("/myznode", acls, -1);
- Client Authentication (Connection String/API): Configure client applications to authenticate with ZooKeeper. This involves providing credentials (Kerberos ticket, username/password) in the client's connection string or through API calls (e.g.,
zooKeeper.addAuthInfo("digest", "user:password".getBytes());
). The specific method depends on the client library. - Regular ACL Review (zkCli.sh): Periodically (e.g., quarterly) review the ACLs on all znodes using the
getAcl
command inzkCli.sh
to ensure they still adhere to the principle of least privilege. Example:getAcl /myznode
. - Dynamic ACLs (Custom AuthenticationProvider): If access patterns are dynamic, explore using dynamic ACLs. This involves implementing a custom
org.apache.zookeeper.server.auth.AuthenticationProvider
and configuring it inzoo.cfg
. This provider will dynamically determine permissions based on runtime context.
- Enable Authentication (zoo.cfg): Modify the
-
Threats Mitigated:
- Unauthorized Data Access: (Severity: Critical)
- Unauthorized Configuration Modification: (Severity: Critical)
- Unauthorized ZNode Creation/Deletion: (Severity: High)
- Denial of Service (DoS) via Unauthorized Actions: (Severity: High)
- Replay Attacks (with Kerberos): (Severity: High)
-
Impact:
- Unauthorized Data Access: Risk reduced from Critical to Low.
- Unauthorized Configuration Modification: Risk reduced from Critical to Low.
- Unauthorized ZNode Creation/Deletion: Risk reduced from High to Low.
- DoS via Unauthorized Actions: Risk reduced from High to Low.
- Replay Attacks: Risk reduced from High to Low (with Kerberos).
-
Currently Implemented:
- Authentication is enabled using Digest authentication in the
dev
environment (zoo.cfg
). - Basic ACLs are set on a few key znodes in
dev
(usingzkCli.sh
).
- Authentication is enabled using Digest authentication in the
-
Missing Implementation:
- Kerberos authentication is not implemented (
zoo.cfg
and JAAS configuration). - Comprehensive ACLs are missing for many znodes (requires
zkCli.sh
or API calls for each znode). - Dynamic ACLs are not considered (requires custom
AuthenticationProvider
). - Regular ACL reviews are not formally scheduled (
getAcl
viazkCli.sh
).
- Kerberos authentication is not implemented (
Mitigation Strategy: Secure Communication (TLS/SSL) Configuration in ZooKeeper
-
Description:
- Configure ZooKeeper Servers (zoo.cfg): In the
zoo.cfg
file on each server:- Set
secureClientPort
to a port for secure client connections (e.g., 2182). - Set
ssl.keyStore.location
to the path of the server's keystore file. - Set
ssl.keyStore.password
to the password for the keystore. - Set
ssl.keyStore.type
to keystore type (e.g., JKS). - Set
ssl.trustStore.location
to the path of the server's truststore file. - Set
ssl.trustStore.password
to the password for the truststore. - Set
ssl.trustStore.type
to truststore type (e.g., JKS). - Set
ssl.clientAuth=need
to require client authentication (orwant
for optional). - For server-to-server communication, configure similar settings under
sslQuorum.*
(e.g.,sslQuorum.keyStore.location
,sslQuorum.trustStore.location
, etc.).
- Set
- Client Connection (Connection String/API): Configure client applications to connect to the
secureClientPort
and to use TLS/SSL. This involves providing the client's keystore and truststore (if client authentication is enabled) in the connection string or through API calls. The specific method depends on the client library. For example, in the Java API, you might use system properties like-Djavax.net.ssl.keyStore
,-Djavax.net.ssl.trustStore
, etc., or configure anSSLContext
and pass it to the ZooKeeper constructor.
- Configure ZooKeeper Servers (zoo.cfg): In the
-
Threats Mitigated:
- Man-in-the-Middle (MitM) Attacks: (Severity: Critical)
- Eavesdropping: (Severity: Critical)
- Data Tampering in Transit: (Severity: Critical)
-
Impact:
- MitM Attacks: Risk reduced from Critical to Low.
- Eavesdropping: Risk reduced from Critical to Low.
- Data Tampering in Transit: Risk reduced from Critical to Low.
-
Currently Implemented:
- TLS/SSL is enabled for client-server communication in the
dev
environment (zoo.cfg
settings forsecureClientPort
, keystore, and truststore).
- TLS/SSL is enabled for client-server communication in the
-
Missing Implementation:
- TLS/SSL is not enabled for server-to-server communication (
sslQuorum.*
settings inzoo.cfg
). - TLS/SSL is not consistently enforced; unencrypted connections are still possible (requires ensuring all clients use
secureClientPort
).
- TLS/SSL is not enabled for server-to-server communication (
Mitigation Strategy: Limit ZNode Data Size (Server-Side)
-
Description:
- Configure
jute.maxbuffer
(zoo.cfg): In thezoo.cfg
file on all ZooKeeper servers, set thejute.maxbuffer
property to a reasonable value (in bytes) to limit the maximum size of data that can be stored in a single znode. For example,jute.maxbuffer=4194304
sets the limit to 4MB. This is a global setting for the entire ZooKeeper ensemble.
- Configure
-
Threats Mitigated:
- Denial of Service (DoS) via Large ZNodes: (Severity: Medium)
-
Impact:
- DoS via Large ZNodes: Risk reduced from Medium to Low.
-
Currently Implemented:
jute.maxbuffer
is set to a default value inzoo.cfg
.
-
Missing Implementation:
- The default
jute.maxbuffer
value may be too high; it should be reviewed and potentially lowered based on application requirements.
- The default
Mitigation Strategy: Restrict Access to Four Letter Words
-
Description:
- Identify Sensitive Commands: Understand which Four Letter Words (FLWs) expose sensitive information or could be misused.
dump
,conf
, andsrvr
are examples that might need restriction. - Use ACLs (zkCli.sh or API): Use ZooKeeper's ACL mechanism to restrict access to the
/zookeeper/config
znode (and potentially other relevant znodes). By default, this znode is world-readable. Change the ACL to allow only authorized users or roles to read it. Example (zkCli.sh):setAcl /zookeeper/config sasl:zookeeper-admin:cdrwa,world:anyone:
. This restricts access to thezookeeper-admin
user. - Consider
readonlymode.enabled
(zoo.cfg): If you want to completely disable write operations via FLWs, you can setreadonlymode.enabled=true
inzoo.cfg
. This prevents commands likeconf
from modifying the configuration. However, this is a global setting and affects all clients.
- Identify Sensitive Commands: Understand which Four Letter Words (FLWs) expose sensitive information or could be misused.
-
Threats Mitigated:
- Unauthorized Configuration Disclosure: (Severity: Medium) - Prevents unauthorized users from viewing sensitive configuration details.
- Unauthorized Configuration Modification (with
readonlymode.enabled
): (Severity: High) - Prevents unauthorized modification of the configuration via FLWs.
-
Impact:
- Unauthorized Configuration Disclosure: Risk reduced from Medium to Low.
- Unauthorized Configuration Modification: Risk reduced from High to Low (with
readonlymode.enabled
).
-
Currently Implemented:
- None.
-
Missing Implementation:
- ACLs are not set on
/zookeeper/config
(requiressetAcl
viazkCli.sh
or API). readonlymode.enabled
is not set (requires modification ofzoo.cfg
).
- ACLs are not set on
Mitigation Strategy: Connection Limits (Server-Side)
-
Description:
- Configure
maxClientCnxns
(zoo.cfg): In thezoo.cfg
file on all ZooKeeper servers, set themaxClientCnxns
property to a reasonable value to limit the maximum number of concurrent connections from a single IP address. For example,maxClientCnxns=60
. This is a per-IP limit.
- Configure
-
Threats Mitigated:
- Connection Exhaustion (DoS): (Severity: High)
-
Impact:
- Connection Exhaustion: Risk reduced from High to Medium.
-
Currently Implemented:
maxClientCnxns
is set to a default value inzoo.cfg
.
-
Missing Implementation:
- The default
maxClientCnxns
value may not be appropriate; it should be reviewed and potentially adjusted based on the expected number of clients and the capacity of the servers.
- The default
Mitigation Strategy: Configuration Hardening (zoo.cfg)
-
Description:
- Disable Unnecessary Features (zoo.cfg): Review the
zoo.cfg
file and disable any ZooKeeper features that are not required. For example, if you are not using dynamic reconfiguration, ensure it's disabled (check for related settings). If you are not using snapshots, you might adjust snapshot-related settings. - Review Timeouts (zoo.cfg): Set appropriate values for timeouts:
tickTime
: The basic time unit in milliseconds.initLimit
: The time (in ticks) allowed for followers to connect and sync with the leader.syncLimit
: The time (in ticks) allowed for followers to sync with the leader.
- Avoid Default Ports (zoo.cfg): Change the default ZooKeeper ports (2181, 2888, 3888) to non-standard values using
clientPort
and theserver.X
settings. - Configure Logging (zoo.cfg and log4j.properties): Set appropriate log levels (
logLevel
inzoo.cfg
and inlog4j.properties
), configure log rotation, and ensure logs are written to a secure location.
- Disable Unnecessary Features (zoo.cfg): Review the
-
Threats Mitigated:
- Exploitation of Unnecessary Features: (Severity: Medium)
- Misconfiguration Vulnerabilities: (Severity: High)
-
Impact:
- Exploitation of Unnecessary Features: Risk reduced from Medium to Low.
- Misconfiguration Vulnerabilities: Risk reduced from High to Medium.
-
Currently Implemented:
- Basic logging is configured.
-
Missing Implementation:
- A comprehensive review of
zoo.cfg
for unnecessary features and hardening opportunities has not been performed. - Default ports are still used (
clientPort
andserver.X
settings). - Timeout values (
tickTime
,initLimit
,syncLimit
) may not be optimally configured. - Log rotation and secure log storage are not fully addressed.
- A comprehensive review of