galasa-dev / projectmanagement

Project Management repo for Issues and ZenHub
7 stars 4 forks source link

Ecosystem CREDS to be synchronized with those stored in IBM Cloud Secrets Manager #1796

Open techcobweb opened 6 months ago

techcobweb commented 6 months ago

Story

As an installer of galasa, I want to configure my ecosystem to draw secrets from a remote centralised secrets manager, so that I know the secrets are being stored and organised in a way consistent with my mandated security policies.

Contents

Background

Current solution

Proposed solution

We need to do this:

Image

ie:

Why we chose IBM Cloud secrets manager

How the connector could work

To reset the seed secret

When there is a secrets connector

When there isn't a secrets connector

Reasons why test pods do not get secrets on demand direct from the IBM cloud secret store

The IBM cloud secret store is limited to 20 calls per second. With 100 testcases trying to get 5 secrets each, that could add up to 500 calls to the secret store. The service doesn't have a hard-stop, but delays calls if the call rate is greater than 20. But it would still take 25 seconds for those tests to get all those secrets. There are also limits on the number of concurrent accesses from unique clients. Which itself rules out on-demand access. The docs also state that it is a cold-storage for secrets. See the documentation for more details.

This is exacerbated by the fact that each pod would have to get IBM Cloud IAM credentials by logging in... another process which will take some time.

Conclusion: We need to draw the secrets out of the secret store and cache them, sharing them via etcd, which is built for clustered parallel access.

REST interface

GET /secrets - lists the secrets available GET /secrets?name=xxx - gets the definition of the secret, with the value POST /secrets/name - creates a new secret PUT /secrets/name - updates an existing secret DELETE /secrets/name - deletes a secret

POST /resources - Allows a secret resource to be created/updated/deleted.

A secret looks like this:

apiVersion: galasa-dev/v1alpha1
kind: GalasaSecretToken
metadata:
    name: my.secret.name
    encoding: base64
data:
    token: bXktc2VjcmV0LXZhbHVlLTEyMzQ1 << This is "my-secret-value-12345" but encoded.

or

apiVersion: galasa-dev/v1alpha1
kind: GalasaSecretUserName
metadata:
    name: my.secret.name
    encoding: base64
data:
    username: bXktc2VjcmV0LXZhbHVlLTEyMzQ1 << This is "my-secret-value-12345" but encoded.

or

apiVersion: galasa-dev/v1alpha1
kind: GalasaSecretUserNamePassword
metadata:
    name: my.secret.name
    encoding: base64
data:
    username: bXktc2VjcmV0LXZhbHVlLTEyMzQ1 << This is "my-secret-value-12345" but encoded.
    password: bXktc2VjcmV0LXZhbHVlLTEyMzQ1 << This is "my-secret-value-12345" but encoded.

or

apiVersion: galasa-dev/v1alpha1
kind: GalasaSecretUserNameToken
metadata:
    name: my.secret.name
    encoding: base64
data:
    username: bXktc2VjcmV0LXZhbHVlLTEyMzQ1 << This is "my-secret-value-12345" but encoded.
    token: bXktc2VjcmV0LXZhbHVlLTEyMzQ1 << This is "my-secret-value-12345" but encoded.

Limiting who can get what secret information

We don't have Role-based access implemented yet. When we do we can limit who can see which secrets. ie: The GET data could be refused unless you have secret reading permissions in your role.

So until that point, everyone can see all the secret values.

Observations

Tasks

techcobweb commented 6 months ago

I had a discussion with @Tom-Slattery today, and ran this outline plan past him, to which he said that it fitted well with the direction he was going to have to take with secrets management in the future.

techcobweb commented 5 months ago

secrets.drawio.zip

This is the source for the diagram in the description.

techcobweb commented 5 months ago

https://thenewstack.io/meet-openbao-an-open-source-fork-of-hashicorp-vault/ Is very interesting.

It's a new project based on a 2023 branch of Hashicorp vault. https://github.com/openbao/openbao/tags

If it matures a bit more, we should be using that for secret storage rather than the etcd back-end we currently use.