Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALLOW_EMPTY_PASSWORD option is broken due to YAML syntax error #76691

Open
dlenskiSB opened this issue Jan 28, 2025 · 2 comments
Open

ALLOW_EMPTY_PASSWORD option is broken due to YAML syntax error #76691

dlenskiSB opened this issue Jan 28, 2025 · 2 comments
Assignees
Labels
cassandra tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@dlenskiSB
Copy link

Name and Version

bitnami/cassandra:5.0.2-debian-12-r3

What architecture are you using?

amd64

What steps will reproduce the bug?

The documentation for this container says that it's possible to set the environment variable ALLOW_EMPTY_PASSWORD=yes in order to allow connecting to the Cassandra CQL server without any credentials (e.g. cqlsh should work without -u/-p).

However, this option does not work.

Reproducing

$ docker run --name cassandra --env ALLOW_EMPTY_PASSWORD=yes --rm -it bitnami/cassandra:5.0.2-debian-12-r3
(fails after ~10 min)

Finding the root cause

Inspecting the logs in another terminal shows that there are parsing errors in the cassandra.yaml config file:

...
$ docker exec cassandra tail -n80 /opt/bitnami/cassandra/logs/cassandra_first_boot.log
INFO  [main] 2025-01-28 01:22:58,337 YamlConfigurationLoader.java:101 - Configuration location: file:/opt/bitnami/cassandra/conf/cassandra.yaml
Exception (org.apache.cassandra.exceptions.ConfigurationException) encountered during startup: Invalid yaml: file:/opt/bitnami/cassandra/conf/cassandra.yaml
org.apache.cassandra.exceptions.ConfigurationException: Invalid yaml: file:/opt/bitnami/cassandra/conf/cassandra.yaml
        at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:146)
        at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:114)
        at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:396)
        at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:258)
        at org.apache.cassandra.config.DatabaseDescriptor.daemonInitialization(DatabaseDescriptor.java:243)
        at org.apache.cassandra.service.CassandraDaemon.applyConfig(CassandraDaemon.java:780)
        at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:723)
        at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:865)
...

⚠ There's a YAML syntax mistake in the config file: class_name : AllowAllAuthenticator has an extra space in it before the :

$ docker exec -t cassandra grep -C3 AllowAllAuthenticator /opt/bitnami/cassandra/conf.default/cassandra.yaml
...
# - AllowAllAuthenticator performs no checks - set it to disable authentication.
# - PasswordAuthenticator relies on username/password pairs to authenticate
#   users. It keeps usernames and hashed passwords in system_auth.roles table.
#   Please increase system_auth keyspace replication factor if you use this authenticator.
#   If using PasswordAuthenticator, CassandraRoleManager must also be used (see below)
authenticator:
  class_name : AllowAllAuthenticator
# MutualTlsAuthenticator can be configured using the following configuration. One can add their own validator
# which implements MutualTlsCertificateValidator class and provide logic for extracting identity out of certificates
# and validating certificates.
...

In the case where ALLOW_EMPTY_PASSWORD is not specified, this line gets replaced with the correct syntax class_name: PasswordAuthenticator.

What is the expected behavior?

Cassandra container starts up without any required credentials.

What do you see instead?

Cassandra container fails to start and aborts after ~10 minutes.

Additional information

No response

@dlenskiSB dlenskiSB added the tech-issues The user has a technical issue about an application label Jan 28, 2025
@github-actions github-actions bot added the triage Triage is needed label Jan 28, 2025
@dlenskiSB
Copy link
Author

Thankfully, there is a straightforward workaround for this issue, once we understand the root cause:

Use --env CASSANDRA_AUTHORIZER=AllowAllAuthorizer --env CASSANDRA_AUTHENTICATOR=AllowAllAuthenticator instead of ALLOW_EMPTY_PASSWORD=true

(docs)

dlenskiSB added a commit to dlenskiSB/cassandra that referenced this issue Jan 28, 2025
The presence of an extra space the `:` in `key: value` pairs
makes the default `conf/cassandra.yaml` file included in
this repository unparseable and non-functional.

Among other downstream consequences of this bug:

- bitnami/containers#76691
  (where I identify the root cause)
- bitnami/containers#75745
dlenskiSB referenced this issue in apache/cassandra Jan 28, 2025
Patch by Jyothsna Konisa & Dinesh Joshi; reviewed by Yifan Cai, Jon Meredith,
Yuki Morishita & Dinesh Joshi for CASSANDRA-18554

Co-Authored-By: Dinesh Joshi <[email protected]>
@dlenskiSB
Copy link
Author

dlenskiSB commented Jan 28, 2025

I discovered the (upstream) source.

Turns out that this is a syntax mistake in the cassandra.yaml file distributed upstream by apache/cassandra 🤕. This bug
was introduced a year and a half ago in apache/cassandra@f078c02#diff-77707d0908c31940828b6425dcb09a7409827db99b48c371f71c63294dfe1562L153-R154

The fix is here: apache/cassandra#3837

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cassandra tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
Development

No branches or pull requests

2 participants