Docker – CassandraRoleManager doesn’t support PASSWORD
I encountered the following error when I was trying to create a new user with password in Cassandra running in a Docker container built from official Cassandra Dockerfile:
org.apache.cassandra.auth.CassandraRoleManager doesn't support PASSWORD
It is happening because the default authorizer is set to AllowAllAuthorizer, what in fact means that the authorization is disabled. To be able to secure access to the db you need to switch to a different authorizer, e.g. PasswordAuthenticator. To do that you have to change authorizer option in /etc/cassandra/cassandra.yaml configuration file.
It can be done in several ways. Manually, after mounting file/directory using volumes. Or you can put to a container a properly configured file using COPY instruction. In my situation, as that’s the only option I need to adjust (running this system only in dev env), I wanted a simple but automated solution, so decided for modifying the file directly in the container with sed:
FROM cassandra:3.11 RUN sed -i 's/^authenticator.\+$/authenticator: PasswordAuthenticator/g' /etc/cassandra/cassandra.yaml
And that’s all.