Skip to content

caProvider sample #59

Description

@ctr49

Describe the bug
caProvider is a supported option besides caBundle to establish the trust between ESO and bitwarden-sdk-server. However, all examples (in the Readme and hack) only use the caBundle.

There has been some discussion in #9 and since then cert-manager also provides a trust-manager to get around some issues.

However the usage of caProvider in this context is not clear to me and trying to use it I receive the following error message from an ExternalSecret CR:

Get "https://bitwarden-sdk-server.external-secrets.svc.cluster.local:9998/rest/api/1/secrets": tls: failed to verify certificate: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "cert-manager-bitwarden-tls")

Manifests:
bitwarden-bootstrap-issuer

apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: bitwarden-bootstrap-issuer
spec:
  selfSigned: {}

bitwarden-certificate-issuer

apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: bitwarden-certificate-issuer
spec:
  ca:
    secretName: bitwarden-tls-certs

bitwarden-tls-certs

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: bitwarden-tls-certs
  namespace: external-secrets
spec:
  dnsNames:
    - bitwarden-sdk-server.external-secrets.svc.cluster.local
    - external-secrets-bitwarden-sdk-server.external-secrets.svc.cluster.local
    - localhost
  ipAddresses:
    - 127.0.0.1
    - '::1'
  issuerRef:
    group: cert-manager.io
    kind: ClusterIssuer
    name: bitwarden-certificate-issuer
  privateKey:
    algorithm: RSA
    encoding: PKCS8
    size: 2048
  secretName: bitwarden-tls-certs

Then I'm using trust-manager to create a caBundle secret (called ca-bundle-crt) and reflector to copy it into the external-secrets namespace and the following SecretStore:

apiVersion: external-secrets.io/v1
kind: SecretStore
metadata:
  name: bw-secret-store
  namespace: external-secrets
spec:
  provider:
    bitwardensecretsmanager:
      apiURL: 'https://api.bitwarden.eu'
      identityURL: 'https://identity.bitwarden.eu'
      auth:
        secretRef:
          credentials:
            key: token
            name: secret-manager-access-token
      bitwardenServerSDKURL: 'https://bitwarden-sdk-server.external-secrets.svc.cluster.local:9998'
      caProvider:
        type: ConfigMap
        name: bw-issuer-public
        namespace: external-secrets
        key: ca-bundle.crt
      organizationID: 'my-org-uuid'
      projectID: 'my-project-uuid'
  1. provide the Kubernetes and ESO version
    Kubernetes 1.34
    ESO 1.1.0

Expected behavior
I'd expect ESO to get the Secret from the caProvider and be able to establish a TLS connection to the bitwarden-sdk-server

Btw, if that works (with trust-manager creating a public bundle from the bitwarden-cert-issuer and making that available to ESO) I wouldn't even call it "hack" anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions