Skip to content
This repository was archived by the owner on Mar 18, 2021. It is now read-only.
This repository was archived by the owner on Mar 18, 2021. It is now read-only.

Limited Ability to use Vault Secrets. #60

@ryanmickler

Description

@ryanmickler

I've been trying to integrate openfaas-nomad into our stack, but a lot of our functions require access to various AWS S3 buckets to read/write data. The problem is that the openfaas-nomad vault integration only can access secrets at secrets/${secrets_dir}/${secret_name}. However, for our AWS secrets, we'd need to read secrets at aws/creds/${secrets_name}. Can i propose that we include the ability to customize this vault policy, instead of VaultDefaultPolicy: "openfaas"

Secondly, it would also be required to be able to specify the template that is rendered, as each read of the aws secrets generates a new set of two keys that need to be rendered simultaneously. The default template format
{{with secret "secret/${vault_prefix}/${secret_name}"}}{{.Data.${name}}}{{end}}
isn't suitable for this purpose.

So i propose that we also provide the ability to specify the policy and pass in a template block

functions:
  facedetect:
    lang: go-opencv
    handler: ./facedetect
    image: nicholasjackson/func_facedetect
    secrets:
      - mysecret 
        vault_policy: my_s3_secret_vault_policy
        template: |
[default] {{with secret "aws/creds/my_s3_secret"}}
aws_access_key_id={{.Data.access_key}}
aws_secret_access_key={{.Data.secret_key}}{{end}}

the vault policy my_s3_secret_vault_policy would just allow read access to aws/creds/my_s3_secret.

This example would generate a suitable AWS_CREDENTIALS_FILE at /etc/openfaas/secrets/mysecret that could be used to provide AWS api access.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions