Add a superuser account
After you enable role-based access control (RBAC), create your own superuser account and disable or drop the default cassandra
account.
Roles that you create with the superuser
option have full access to the database,
and users with the superuser
role can run any Cassandra Query Language shell (cqlsh
) commands on all database resources.
Only provide superuser roles to a limited number of users.
|
DataStax Enterprise (DSE) includes the default role cassandra
with a default password of cassandra
.
The cassandra
role is a superuser login account that has full access to the database.
Requests from the cassandra
account, including login, use a consistency level of QUORUM
.
QUORUM
might cause significant performance degradation in multiple datacenter environments.
Because of these security and performance considerations, DataStax recommends that you use the cassandra
role only once during the initial RBAC setup.
Establish your own root account with superuser privileges, and then disable or drop the cassandra
role.
Requests from all other authenticated accounts have a consistency level of |
Prerequisites
Isolate the DSE cluster and enable RBAC. For more information, see Set up logins and users.
Create and use a superuser account
-
Log in to CQL shell with the
cassandra
user:cqlsh -u cassandra -p cassandra
-
Create a new
superuser
account and password:CREATE ROLE <root_user_name> WITH SUPERUSER = true AND LOGIN = true AND PASSWORD = '<password>';
or create the new
superuser
account with a hashed password:CREATE ROLE <root_user_name> WITH SUPERUSER = true AND LOGIN = true AND HASHED PASSWORD = '<hashed_password>';
-
Exit the CQL shell:
EXIT;
Disable or drop the default cassandra
account
-
To disable or drop the
cassandra
role, log in with the new role created in the Create and use a superuser account step:cqlsh -u <root_user>
Enter the password at the prompt.
-
Use the
LIST ROLES
command to verify that the role hassuperuser
privileges:LIST ROLES;
role | super | login | options ---------------------+-------+-------+--------- root_user | True | True | {} cassandra | True | True | {} (2 rows)
-
Drop or update the
cassandra
account:-
Drop the
cassandra
account:DROP ROLE cassandra;
-
Update the
cassandra
role by disabling thesuperuser
privileges and changing the password:ALTER ROLE cassandra WITH SUPERUSER = false AND LOGIN = false AND PASSWORD='new_secret_pw';
or with a hashed password:
ALTER ROLE cassandra WITH SUPERUSER = false AND LOGIN = false AND HASHED PASSWORD='$2a$10$4N5j5py12OySiSy9L2RHduOjFFetJ1d9hqCoZYtQC3kJOwdg3hbOC';
DataStax recommends that you drop the account to secure the database in production environments. When you use an external authentication method, such as LDAP, you can prevent accidental assignment of unnecessary privileges.
-
-
Verify that you deleted the
cassandra
role:LIST ROLES;
The system no longer lists the
cassandra
role. Only the new root user that you created appears in the output:role | super | login | options ---------------------+-------+-------+--------- root_user | True | True | {} (1 rows)
-
Reopen the firewall to support production CQL traffic.
Next steps
To set up roles that map to the user or group names for the configured authentication schemes, see Add database users.