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

fix: add auth for cassandra #2478

Merged
merged 4 commits into from
Jan 25, 2024
Merged

fix: add auth for cassandra #2478

merged 4 commits into from
Jan 25, 2024

Conversation

tychoish
Copy link
Collaborator

@tychoish tychoish commented Jan 22, 2024

someone else should test this more thoroughly.

greyscaled and others added 2 commits January 25, 2024 14:10
## Description

This builds on top of #2478 and shouldn't merge until after that does.

This configures our cassandra test fixture to require auth. It just uses
the default passwordAuthenticator, and only has the default superuser
role (username = cassandra, password = cassandra).

Adding this in means we don't have a test for the "unauthenticated". To
add a test for the "unauthenticated" scenario would be a bit of a pain
given how it's configured through `cassandra.yaml` and requires node
restarts. If we do add in a test for that scenario, I'd suggest creating
a second cassandra container that doesn't mount in our custom
`cassandra.yaml` and running a really basic smoke test, since the only
thing we're testing that alters from the auth tests is that we can
create data sources and use our table func without auth params.

## FAQS

### What are the changes to the script?

At a high level:

0. Build a custom image that mounts in `cassandra.yaml` that requires
user/pass auth
1. Instead of creating a second container to seed data, just mount the
files in the first time and use `docker exec`
2. Additional waits for the authentication role to apply
3. `-u cassandra` and `-p cassandra` to `cqlsh`

### Why do we need a new Dockerfile?

It's very hard to change `YAML` values in a running service (which
requires restarting the service).
One might think "ah ok volume mount", which is the first thing I tried.
Except each time I ran the
script, it would change some networking values. Having the git working
tree dirty after each run
felt odd.

### What's with the `cassandra.yaml` ?

I ran the former script and copied the default config. I changed one
value `authenticator` after following the documentation
https://cassandra.apache.org/doc/stable/cassandra/operating/security.html
and pasted it.

I tried pasting only a subset of it, and the container would fail to
start. Felt it was safest to pass the entire thing in with that one
value changed. This is why the diff is so large :(
@greyscaled greyscaled self-requested a review January 25, 2024 19:13
Copy link
Contributor

@greyscaled greyscaled left a comment

Choose a reason for hiding this comment

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

testing worked for me in my PR, happy with it

@tychoish tychoish merged commit 61e3981 into main Jan 25, 2024
20 checks passed
@tychoish tychoish deleted the tycho/cassandra-auth branch January 25, 2024 19:59
tychoish added a commit that referenced this pull request Feb 1, 2024
Co-authored-by: Grey <grey@glaredb.com>
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.

None yet

2 participants