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

Cassandra DB plugin: Allow special chars in usernames #11262

Merged
merged 2 commits into from
Apr 16, 2021

Conversation

pcman312
Copy link
Contributor

@pcman312 pcman312 commented Apr 1, 2021

Allows special characters in usernames by updating the default change-password statement to include quotes around the username.

In the meantime, this can be worked around by specifying the root_rotation_statements field on the database config:

$ vault write database/config/cassandra \
    plugin_name=cassandra-database-plugin \
    hosts=127.0.0.1 \
    protocol_version=3 \
    username="vault-admin" \
    password="myreallysecurepassword" \
    allowed_roles="*" \
    root_rotation_statements="ALTER USER '{{username}}' WITH PASSWORD '{{password}}'"

Testing

Running this with an automated test is a bit tricky and the change is small enough I'm comfortable with some manual testing:

Before fix:

$ vault write database/config/cassandra \
    plugin_name=cassandra-database-plugin \
    hosts=127.0.0.1 \
    protocol_version=3 \
    username="vault-admin" \
    password="myreallysecurepassword"

$ vault write -force database/rotate-root/cassandra
Error writing data to database/rotate-root/cassandra: Error making API request.

URL: PUT http://127.0.0.1:8200/v1/database/rotate-root/cassandra
Code: 500. Errors:

* 1 error occurred:
	* failed to update user: 1 error occurred:
	* line 1:16 mismatched input '-' expecting EOF (ALTER USER vault[-]...)

After fix:

$ vault write database/config/cassandra \
    plugin_name=cassandra-database-plugin \
    hosts=127.0.0.1 \
    protocol_version=3 \
    username="vault-admin" \
    password="myreallysecurepassword" \
    allowed_roles="*"

$ vault write -force database/rotate-root/cassandra
Success! Data written to: database/rotate-root/cassandra

Copy link

@Valarissa Valarissa left a comment

Choose a reason for hiding this comment

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

Should we include a docs change to address the workaround for root credential rotation?

@calvn
Copy link
Contributor

calvn commented Apr 2, 2021

Can you add a changelog for this and milestone it under the appropriate release? Should this be a backport for 1.7.1?

@vercel vercel bot temporarily deployed to Preview – vault-storybook April 6, 2021 20:30 Inactive
@pcman312 pcman312 added this to the 1.7.1 milestone Apr 6, 2021
@pcman312 pcman312 added secret/database/cassandra bug Used to indicate a potential bug labels Apr 6, 2021
@pcman312
Copy link
Contributor Author

pcman312 commented Apr 6, 2021

@calvn Done.

@pcman312
Copy link
Contributor Author

@Valarissa re: docs: #11378

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug secret/database/cassandra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants