Skip to content

Conversation

mariadb-stefangenov
Copy link
Collaborator

No description provided.

For the plugins specifically, Have not listed the old `.2` version
as that does not include the full suite of plugins (missing hashicorp)
Copy link
Member

@mariadb-mmontes mariadb-mmontes left a comment

Choose a reason for hiding this comment

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

This is looking good! Left some comments.


plugin_load_add = hashicorp_key_management
hashicorp-key-management-vault-url=http://vault-0.vault-internal.vault.svc.cluster.local:8200/v1/mariadb # Change to your Vault URL.
hashicorp-key-management-token=EXAMPLE_TOKEN # This needs to be changed to your token
Copy link
Member

Choose a reason for hiding this comment

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

⚠️ We cannot seed a Vault token in a ConfigMap, specially if it has elevated permissions

Alternatively, we can supply the HashiCorp configuration in a Secret, and use the volumes and volumeMounts to mount it under /etc/mysql/mariadb.conf.d/

Copy link
Member

Choose a reason for hiding this comment

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

We could explore extending the operator to support myCnfSecretKeyRef in further iterations, to achieve this in a more native way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, tunnel visioned here. I was literally working with Secret Mounts for ldap, yet forgot I can use them for this too. Thanks, that is perfect

max_allowed_packet=256M

plugin_load_add = hashicorp_key_management
hashicorp-key-management-vault-url=http://vault-0.vault-internal.vault.svc.cluster.local:8200/v1/mariadb # Change to your Vault URL.
Copy link
Member

Choose a reason for hiding this comment

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

3. **(Optional) Create An Authentication Token.**
This step can be skipped if you want to use your own token. Consult with a Vault administrator regarding this. If you want to create a new one:
```sh
vault token create
Copy link
Member

@mariadb-mmontes mariadb-mmontes Sep 17, 2025

Choose a reason for hiding this comment

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

Although the plugin documentation says:

Authentication is done using the Hashicorp Vault's token authentication method

This will be a static token, something not desirable by any security team. We could stick to this instructions, but additionally refer to the other available Vault authentication methods, which allow you to generate a short-lived Vault token. For example, the approle one can generate a Vault token based on a acces id and secret key:
https://developer.hashicorp.com/vault/docs/auth/approle

So the user could authenticate with any of the supported methods by Vault, and obtain a Vault token, rather than creating a static token.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Technically, yes. But regarding short-lived tokens, that is impossible without interruption... I do have a better approach tho, will update

Choose a reason for hiding this comment

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

approle will be a problem too, unless it has 0 ttl, which wouldn't really be any different from tokens I believe.

token_accessor 9sHvwKiddpCT2PaplcHHRAnv
token_duration ∞
token_renewable false
token_policies ["root"]
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, we should have a custom policy that allows all operations under the /mariadb/* keys, rather than in the entire Vault.

Copy link
Member

Choose a reason for hiding this comment

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

I know this is done like this in the blog, but it is far from ideal.

Besides, the plugin is not configuring any authentication method nor anything global in vault, it just reads keys under a kv path, so their permissions should be scoped to /mariadb/*.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, the dev server didn't care for policies 😄 But now since we want a TLS example I had to spin up a standalone instance and a custom policy was a must.

```
If you check the encrpytion status again:
```sql
SELECT * from information_schema.INNODB_TABLESPACES_ENCRYPTION;
Copy link
Member

@mariadb-mmontes mariadb-mmontes Sep 17, 2025

Choose a reason for hiding this comment

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

Could we share the output of this query?

Additionally, as described in this blog, we can show that the /var/lib/mysql/*/*.ibd is actually encrypted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Regarding the blog, I couldn't reproduce that... something must have changed.

```sql
SELECT * from information_schema.INNODB_TABLESPACES_ENCRYPTION;
```
You should see `CURRENT_KEY_VERSION` column start getting updated to point to the new key version.
Copy link
Member

Choose a reason for hiding this comment

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

Show an example output of this CURRENT_KEY_VERSION


## Day-2 Ops

### Rotating Secrets.
Copy link
Member

Choose a reason for hiding this comment

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

This is way better than what the file encryption plugin:
https://mariadb.com/resources/blog/mariadb-encryption-tde-using-mariadbs-file-key-management-encryption-plugin/

Do you see any benefit of supporting the file encryption plugin at this point?

Copy link
Collaborator Author

@mariadb-stefangenov mariadb-stefangenov Sep 17, 2025

Choose a reason for hiding this comment

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

I feel like we are lacking in options. The file key management plugin is not production ready, while vault is great, but it's the only option right now.

At the same time, for some customers that file key management plugin could be a good option.

This commit is a work in progress, just pushing some changes while @ KCD
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.

3 participants