Skip to content

Conversation

@tiagomlalves
Copy link
Member

@tiagomlalves tiagomlalves commented Feb 18, 2025

What is the issue

Enabling advanced authentication in CC requires a way to configure the auth* classes in cassandra.yaml.
These changes have been implemented in C* 5 tickets CASSANDRA-18554 and CASSANDRA-19946.

What does this PR fix and why was it fixed

Partially back-ports CASSANDRA-18554 introduced initial changes to support auth* classes configuration (ticket originally added mTLS support but those changes are not part of the current PR), and back-ports CASSANDRA-19946.

Triggered ds-cassandra-build #953 shows no test failures.

@github-actions
Copy link

github-actions bot commented Feb 18, 2025

Checklist before you submit for review

  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits

@tiagomlalves tiagomlalves changed the title HCD-82 HCD-82 Enables auth* classes configuration Feb 19, 2025
@tiagomlalves tiagomlalves force-pushed the HCD-82-main branch 2 times, most recently from cf24826 to c11278a Compare February 19, 2025 10:54
@tiagomlalves tiagomlalves marked this pull request as ready for review February 19, 2025 10:54
Copy link

@jacek-lewandowski jacek-lewandowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look at my comments

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this is wrong; should be ok to move forward if there is such constructor. However, if there is one and it failed, we should not silently skip that. This whole loop is for searching rather than falling back to another class if one class fails to get initialized.

We would also leave no trace about this fact with the current impl

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I have experienced this. If there's a constructor throws an exception this is silently catched here and the error provides no help.

Should we fix this here? Or fix it in C* (where this code was implemented) and later backported it here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a proposal to fix this.

Uses ParameterizedClass for all auth-related implementations (i.e.,
IAuthorizer, IAuthenticator, IRoleManager, IInternodeAuthenticator, and
INetworkAuthorizer) to enable their configuration directly from
cassandra.yaml.

This is a partial back-port from CASSANDRA-18554 (which originally
introduced mTLS support but it's not part of the current changes) and
CASSANDRA-19946.
When using PasswordAuthenticator or MutualTlsWithPasswordFallbackAuthenticator
CassandraRoleManager is required due to the implicit dependency on how
passwords are stored.
On the other hand, CassandraRoleManager can be used with any
IAuthenticator implementation.

Improves message to make this dependency more explicit and comtemplate
subclasses of PasswordAuthenticator.
When authorization is enabled, authentication must also be enabled.
This is required because authorization needs a valid role to validate
permissions which is only set when authentication is enabled.
Improves instantiation of ParameterizedClasses by
 * Checking for constructors instead of relying on exceptions to do
   fallback as this hides the real cause of failures
 * Making it explicit when instantiating a class throws an error (e.g.
   due to validation) and reports the error directly.
Use explicit class names when instantiating them via ParameterizedClass
instead of using Strings with the name.
@sonarqubecloud
Copy link

@cassci-bot
Copy link

✔️ Build ds-cassandra-pr-gate/PR-1578 approved by Butler


Approved by Butler
See build details here

@tiagomlalves tiagomlalves merged commit 1a23d8c into main Feb 25, 2025
473 of 477 checks passed
@tiagomlalves tiagomlalves deleted the HCD-82-main branch February 25, 2025 15:55
@JeremiahDJordan
Copy link
Member

This change breaks the CNDB build and there is no PR ready to go for CNDB. This is being reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants