Giter Site home page Giter Site logo

bank-vaults.dev's Introduction

Bank-Vaults logo

Bank-Vaults

Bank-Vaults is now a CNCF Sandbox project.

Open in Gitpod
GitHub Workflow Status OpenSSF Scorecard OpenSSF Best Practices

Bank Vaults is a thick, tricky, shifty right with a fast and intense tube for experienced surfers only, located on Mentawai. Think heavy steel doors, secret unlocking combinations and burly guards with smack-down attitude. Watch out for clean-up sets.


Bank-Vaults is an umbrella project which provides various tools for Cloud Native secret management, including:

  • Bank-Vaults CLI to make configuring Hashicorp Vault easier
  • Vault Operator to make operating Hashicorp Vault on top of Kubernetes easier
  • Secrets Webhook to inject secrets directly into Kubernetes pods
  • Vault SDK to make working with Vault easier in Go
  • and others

Usage

Some of the usage patterns are highlighted through these blog posts:

Documentation

The official documentation is available at https://bank-vaults.dev.

Development

For an optimal developer experience, it is recommended to install Nix and direnv.

Alternatively, install Go on your computer then run make deps to install the rest of the dependencies.

Make sure Docker is installed with Compose and Buildx.

Fetch required tools:

make deps

Run project dependencies:

make up

Run the test suite:

make test
make test-integration

Run linters:

make lint # pass -j option to run them in parallel

Some linter violations can automatically be fixed:

make fmt

Build artifacts locally:

make artifacts

Once you are done either stop or tear down dependencies:

make stop

# OR

make down

Credits

Kudos to HashiCorp for open sourcing Vault and making secret management easier and more secure.

License

The project is licensed under the Apache 2.0 License.

bank-vaults.dev's People

Contributors

ahma avatar akijakya avatar asdwsda avatar bonifaido avatar csatib02 avatar dependabot[bot] avatar dzirg44 avatar fekete-robert avatar hacktron95 avatar jujugrrr avatar jurgenweber avatar kealanm avatar kschu91 avatar laci21 avatar matyix avatar mightyscollins avatar mrprofessor avatar patoarvizu avatar pbalogh-sa avatar primeroz avatar ramizpolic avatar rasek91 avatar sagikazarmark avatar slumbi avatar step-security-bot avatar stephenmuss avatar tanmay-pnaik avatar timbuchwaldt avatar yvonne2017 avatar ziyuguo716 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

bank-vaults.dev's Issues

Upgrade guide for the Vault operator

We need a place in the documentation for the vault operator at this time, but we will probably need it for other components as well.

  • Propose a structure for upgrade guides in the documentation @fekete-robert
  • Review docs PR @ramizpolic
  • Test and document upgrading the vault operator from 1.19 to 1.20 @akijakya
  • Update Vault Operator upgrade guide in the docs page

Annotations doc is outdated

Is your feature request related to a problem? Please describe.

The Annotations doc only listed a subset of the actual supported annotations

Also, the annotations table should contain a support version information. For example, we were using an old version which didn't support vault-namespace. And we had to realize it in a hard way.

It will be convenient if people can see the info like vault-namespace is supported since version 1.xx.yy, so they know whether they need a new version or not.

Describe the solution you'd like to see

Update annotations.md to add new annotations that are supported.

Bonus: add a version info to each entry.

Update documentation for the `mutating webhook` and `Secret Init`

Preflight Checklist

  • I have searched the issue tracker for an issue that matches the one I want to file, without success.
  • I agree to follow the Code of Conduct.

Problem Description

The Secrets Webhook project was created along with Secret Init. Their predecessor Vault Secrets Webhook and Vault Env will be deprecated, so the current documentation will be outdated.

Proposed Solution

Revisit the docs of the Mutating Webhhok and rewrite parts that was affected by the creation of the new projects.

Alternatives Considered

No response

Additional Information

No response

Improve Secrets Webhook Metrics documentation

Preflight Checklist

  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Problem Description

Missing clear description/list of possible or enabled metrics after metrics and service monitor is enabled.

Due to to changes thru out the years, documentation no longer reflects and or lists of what can be expected when metrics endpoint is enabled.

Proposed Solution

  • Create a list of metrics labels that will be enabled by default and possible ones that can be enabled.

  • Update documentation with metrics endpoint readability, that service that has been created does not show metrics but you have to port-forward each pod and access their /metrics endpoint

Alternatives Considered

No response

Additional Information

No response

[webhook] Simplify docs for Vault monitoring with Prometheus

I noticed that the docs for Vault monitoring with Prometheus can be simplified. Instead of using two Vault tokens and explicitly mounting vault-tls in the prometheusSpec, one could just use consul-template functionality. Something in the lines of:

log_level = "info"
vault {
  vault_agent_token_file = "/vault/.vault-token"
  renew_token = true
  ssl {
    ca_cert = "/vault/tls/ca.crt"
  }
  retry {
    backoff = "1s"
    max_backoff = "600s"
  }
}
wait {
  min = "10s"
  max = "600s"
}
template {
  # Copy the periodic Vault token used by consul-template into a file
  left_delimiter  = "[["
  right_delimiter = "]]"
  error_on_missing_key = true
  contents = <<EOT
[[- with secret "auth/token/lookup-self" ]]
[[- .Data.id ]]
[[- end ]]
EOT
  destination = "/vault/secrets/.vault-token"
  command     = "/bin/sh -c '/usr/bin/curl -s -X POST http://127.0.0.1:9090/-/reload'"
}
template {
  # Copy the Vault CA certificate into a file
  left_delimiter  = "[["
  right_delimiter = "]]"
  error_on_missing_key = true
  contents = <<EOT
[[ file "/vault/tls/ca.crt" ]]
EOT
  destination = "/vault/secrets/ca.crt"
  command     = "/bin/sh -c '/usr/bin/curl -s -X POST http://127.0.0.1:9090/-/reload'"
}

Add warning to sign-off commits to project descriptions and PR templates

For some contributors it is not automatic to sign-off their commits which then gets caught by the DCO check which is required and then we need to ask them to do this - maybe we could be more clear about our guidelines about commits e.g. sign-off your commits (git commit -s), please use the conventional commits style etc.

Mutating Webhook: Multiple inline mutation does not work into `stringData` secret

Describe the bug

Using the vault-secrets mutating webhook, I'm unable to replace multiple secrets inside the same key, or replace secrets inside a larger string of text.

I understood the feature has been implemented via:

But I can't mutate my secret.

Steps to reproduce the issue:

I want to specify, the creation of a simple secret with the same Vault path is well mutating:

# This is working
apiVersion: v1
kind: Secret
metadata:
  name: rabbitmq-ha-test
  namespace: "rabbitmq"
  labels:
    vault.security.banzaicloud.io/vault-namespace: rabbitmq
    vault.security.banzaicloud.io/vault-role: rabbitmq-ha
    vault.security.banzaicloud.io/vault-serviceaccount: rabbitmq-ha
type: Opaque
data:
  ## "vault:secret/data/bot/service/shared/testyli#aaa" accessible for everyone
  rabbitmq-password: "JHt2YXVsdDpzZWNyZXQvZGF0YS9ib3Qvc2VydmljZS9zaGFyZWQvdGVzdHlsaSNhYWF9"

But when I want to use multiple inline mutations:

# Not working
apiVersion: v1
kind: Secret
metadata:
  name: rabbitmq-ha-load-definition-test
  namespace: "rabbitmq"
  annotations:
    vault.security.banzaicloud.io/vault-namespace: rabbitmq
    vault.security.banzaicloud.io/vault-role: rabbitmq-ha
    vault.security.banzaicloud.io/vault-serviceaccount: rabbitmq-ha
type: Opaque
stringData:
  load_definition.json: |
      "users": [
        {
          "name": "admin",
          "password": "${vault:secret/data/bot/service/shared/testyli#aaa}"
        }
      ]

Using this deployment for test:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-vault
  namespace: rabbitmq
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: test-vault
  template:
    metadata:
      annotations:
        vault.security.banzaicloud.io/vault-namespace: rabbitmq
        vault.security.banzaicloud.io/vault-role: rabbitmq-ha
        vault.security.banzaicloud.io/vault-serviceaccount: rabbitmq-ha
      labels:
        app.kubernetes.io/name: test-vault
      name: test-vault
      namespace: rabbitmq
    spec:
      containers:
        - command:
            - sh
            - -c
            - echo $RABBITMQ_PASSWORD && echo going to sleep... && sleep infinity
          env:
          - name: RABBITMQ_PASSWORD
            valueFrom:
              secretKeyRef:
                key: rabbitmq-password
                name: rabbitmq-ha-test
          image: alpine
          imagePullPolicy: Always
          name: alpine
          volumeMounts:
          - mountPath: /app
            name: load-definition-volume
            readOnly: true
      restartPolicy: Always
      serviceAccount: rabbitmq-ha
      serviceAccountName: rabbitmq-ha
      volumes:
      - name: load-definition-volume
        secret:
          defaultMode: 420

Taking a look:

# Simple secret via environment variable reference is well mutated
k -n rabbitmq logs test-vault-5b77546544-ljjx4
Defaulted container "alpine" out of: alpine, copy-vault-env (init)
bbb
going to sleep...

# File mount is not mutated
k -n rabbitmq exec -ti test-vault-5b77546544-ljjx4 -- cat /app/load_definition.json 
Defaulted container "alpine" out of: alpine, copy-vault-env (init)
"users": [
  {
    "name": "admin",
    "password": "${vault:secret/data/bot/service/shared/testyli#aaa}"
  }
]

Expected behavior
Secrets with multiple inline mutation vault secrets are working.
Old documentation seems to say that it was needed to set the environment variable INLINE_MUTATION: true on the webhook but seems to be the default today.

Fix Install guide and related resources

Install guide on Docsite is completely unusable.
For example it has this code kubectl apply -f https://raw.githubusercontent.com/banzaicloud/bank-vaults/master/operator/deploy/rbac.yaml which returns 404.
Links to helm and operator repo also return 404.

If I try to install operator helm chart directly from repo and then try to run

kubectl apply -f ./deploy/examples/cr.yaml

Error from server (BadRequest): error when creating "./deploy/examples/cr.yaml": 
Vault in version "v1alpha1" cannot be handled as a Vault: strict decoding error: 
unknown field "spec.unsealConfig.options.secretShares", 
unknown field "spec.unsealConfig.options.secretThreshold"

If these fields are fixed the PVC is stuck in creation forever.

I think functioning examples for install guide is a must.

Vault operator upgrade guide

  • Test and document upgrading the vault operator from 1.19 to 1.20
  • Validate upgrading from 1.20 to latest version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.