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

Support TLS Certificates Auth Method in HashiCorp Vault Provider #52

Closed
ryysud opened this issue Aug 22, 2019 · 2 comments
Closed

Support TLS Certificates Auth Method in HashiCorp Vault Provider #52

ryysud opened this issue Aug 22, 2019 · 2 comments

Comments

@ryysud
Copy link
Contributor

ryysud commented Aug 22, 2019

Currently, Only Kubernetes Auth Method is supported as a method to authenticate to Vault from HashiCorp Vault Provider, but what do you think about supporting TLS Certificates Auth Method in addition?

I think that it is good specification ( I am currently investigating how to implement it and whether it is a possible specification... Please let me know if there is other good spec... ) to pass a TLS certificate from the Pod Spec's volume to Secrets Store CSI Driver running as a Node Plugin and use it to authenticate to Vault. The authentication method is specified with a parameter such as authMethod (default: k8s), and the file to be used in the Volume is specified with a parameter such as cert.

example1. Pass tls cert using config map

kind: Pod
apiVersion: v1
metadata:
  name: nginx-secrets-store-inline
spec:
  containers:
  - image: nginx
    name: nginx
    volumeMounts:
    - name: secrets-store-inline
      mountPath: "/mnt/secrets-store"
      readOnly: true
  volumes:
    - name: secrets-store-inline
      csi:
        driver: secrets-store.csi.k8s.com
        readOnly: true
        volumeAttributes:
          providerName: "vault"
          authMethod: "cert" # New param (default: k8s)
          cert: cert.pem # New param
          roleName: "example-role"
          vaultAddress: "http://vault:8200"
          vaultSkipTLSVerify: "true"
          objects:  |
            array:
              - |
                objectPath: "/foo"
                objectName: "bar"
                objectVersion: ""
    - name: certs
      configMap:
        name: certs

example2. Pass tls cert using share volume

kind: Pod
apiVersion: v1
metadata:
  name: nginx-secrets-store-inline
spec:
  initContainers:
    - name: tls-certs-fetcher
      image: tls-certs-fetcher
      command:
        - tls-certs-fetch
      args:
        - -write
        - /certs
      volumeMounts:
        - name: certs-dir
          mountPath: /certs
  containers:
  - image: nginx
    name: nginx
    volumeMounts:
    - name: secrets-store-inline
      mountPath: "/mnt/secrets-store"
      readOnly: true
  volumes:
    - name: secrets-store-inline
      csi:
        driver: secrets-store.csi.k8s.com
        readOnly: true
        volumeAttributes:
          providerName: "vault"
          authMethod: "cert" # New param (default: k8s)
          cert: cert.pem # New param
          roleName: "example-role"
          vaultAddress: "http://vault:8200"
          vaultSkipTLSVerify: "true"
          objects:  |
            array:
              - |
                objectPath: "/foo"
                objectName: "bar"
                objectVersion: ""
    - name: certs-dir
      emptyDir: {}
@ryysud
Copy link
Contributor Author

ryysud commented Sep 4, 2019

@anubhavmishra After adding a parameter such as vaultCertPath, Secrets Store CSI Driver authenticates to Vault with TLS Cert Auth Method using the certificate (mounted in the container) specified by that parameter. How about this specification? If you think that looks good, I’ll create a PR.

kind: Pod
apiVersion: v1
metadata:
  name: nginx-secrets-store-inline
spec:
  containers:
  - image: nginx
    name: nginx
    volumeMounts:
    - name: secrets-store-inline
      mountPath: "/mnt/secrets-store"
      readOnly: true
    - name: certs
      mountPath: "/certs"
      readOnly: true
  volumes:
    - name: secrets-store-inline
      csi:
        driver: secrets-store.csi.k8s.com
        readOnly: true
        volumeAttributes:
          providerName: "vault"
          authMethod: "cert" # New param (default: k8s)
          roleName: "example-role"
          vaultAddress: "http://vault:8200"
          vaultCertPath: "/certs/cert.pem" # New param
          vaultSkipTLSVerify: "true"
          objects:  |
            array:
              - |
                objectPath: "/foo"
                objectName: "bar"
                objectVersion: ""
    - name: certs
      configMap:
        name: certs

@ritazh
Copy link
Member

ritazh commented Nov 27, 2019

Closing in favor of hashicorp/vault-csi-provider#15

@ritazh ritazh closed this as completed Nov 27, 2019
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

No branches or pull requests

2 participants