Kerberos Authenticator for Apache Cassandra
Kerberos Authenticator for Apache Cassandra
Explore the Kerberos authenticator for Apache Cassandra.
Join the DZone community and get the full member experience.Join For Free
Coming right on the heels of announcing an open source LDAP authenticator for Apache Cassandra, we’re proud to now release an open source Kerberos authenticator. The new project makes Kerberos’ celebrated single sign-on and secure authentication capabilities available to all Apache Cassandra users.
For developers with an existing Kerberos environment, it’ll be pretty darn simple to configure a cluster to use the Kerberos authenticator. But you’ll first need to have a DNS server and a working Kerberos Key Distribution Center (KDC), and to issue each Cassandra node a Kerberos service principal, forward DNS record, and reverse DNS record.
Every Cassandra node and client application must have the ability to reach the DNS server in order to resolve both forward and reverse DNS records. The GSS-API/Kerberos5 SASL mechanism necessitates this by requiring SASL servers (the Cassandra nodes) to include a fully-qualified hostname in their configurations.
Cassandra bases node discovery on the broadcast_rpc_address, making reverse-DNS entries a requirement so that Cassandra nodes and clients can use these IP addresses to establish the fully-qualified hostname of each node. These reverse-DNS entries should have the same value as the broadcast_rpc_address. Because broadcast_rpc_address defaults to the rpc_address if not set, rpc_address should be set to something other than localhost.
After meeting these configuration pre-requisites, installing the Kerberos authenticator is simple: detailed instructions for installing and configuring the authenticator are available on GitHub.
Kerberos Authenticator Plugin for the Cassandra Java Driver
We’ve also published an open-source Kerberos authenticator plugin for the Cassandra Java driver. This plugin supports multiple Kerberos quality-of-protection (QOP) levels, which users can specify in the authenticator’s configuration. The QOP level of the driver and the server authenticator configuration must match, and will only be used during the authentication exchange. Where traffic between the client and Cassandra requires confidentiality and/or integrity protection, devs should rely on Cassandra’s built-in SSL/TLS (when enabled, TLS protects the Kerberos authentication exchange as well).
The Java driver also optionally supports an SASL authorization ID. When used, the Cassandra role specified by this ID will be assumed after the Kerberos client principal is authenticated (as long as the user has permission for that role). Use the GRANT ROLE CQL statement to grant access to other roles.
If no authorization ID is provided, the user will assume the client principal’s Cassandra user or role. Where no Cassandra user or role matches the client principal – and authorization ID when provided – access will not be granted.
This Java driver plugin allows for flexible configuration of the GSS-API mechanism via JAAS. Users can specify the mechanism for providing client credentials to the driver plugin separately from the implementation. Therefore, the client principal’s authentication material can be sourced from a keytab or a valid TGT in the local Kerberos ticket cache, in accordance with the JAAS configuration file contents.
Migrate With Zero Downtime
By using a rolling restart once the configuration is complete, devs can migrate existing clusters from other authentication mechanisms to the Kerberos authenticator without Cassandra experiencing downtime. Importantly, client applications need to be updated to make sure they’re properly configured to use the Kerberos authenticator. Also, to migrate with zero downtime, applications must support Cassandra authentication via both mechanisms. Applications can be modified to attempt to authenticate using the Kerberos authenticator when authentication via the original mechanism fails, thus achieving a zero-downtime transition.
The Cassandra authenticator and Java driver plugin are both available on GitHub and completely free to use under the Apache License v2. The Kerberos authenticator currently supports Cassandra 3.0.x and 3.11.x branches. We welcome improvements and feedback: feel free to open a pull request or an issue ticket on GitHub to report any bugs or suggest features you would like to see included.
Justin Cameron is a Senior Software Engineer at Instaclustr, which provides a managed service platform of open source technologies such as Apache Cassandra, Apache Spark, Elasticsearch and Apache Kafka.
Opinions expressed by DZone contributors are their own.