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

Vault support #11

Open
gberche-orange opened this issue Mar 2, 2016 · 1 comment
Open

Vault support #11

gberche-orange opened this issue Mar 2, 2016 · 1 comment
Milestone

Comments

@gberche-orange
Copy link
Member

gberche-orange commented Mar 2, 2016

Consider a refinement of #10 through hashicorp Vault integration

Why

Hashicorp vault integration would provide the following features:

  • secret revocation/rotation
  • secret access loggin & audit
  • per app execution transient credentials (such as a DB access credentials, a CF CC API transient revocable token)

Programming model

A service instance provides access to vault API by providing in binding credentials:

  • Vault CLI-compatible environment variables
    • VAULT_ADDR: the HTTP endpoint to connect to vault
    • VAULT_TOKEN: a token used by the application to access secret. This authenticates the applications and is attached authorization (a policy).
  • Base-path: the base vault path from which secrets/credentials would be fetched

Native app usage of REST API

The application is then free to use the vault REST API, or one of the SDKs to natively use vault such as dynamically fetch secrets.

One notable library is https://github.com/spring-cloud-incubator/spring-cloud-vault-config and its associated documentation

Refinement with app-id auth backend

If an app were to directly use the appi-id backend, then the app-id backend replaces an injected token with more fine grain accesses through a:

  • app-id: found in the VCAP_SERVICES
  • user-id: typically the CF app-guid found in VCAP_APPLICATION

The static-creds-broker typically handles the VAULT-TOKEN generation from the vault appid (that identifies the application) and the user id (the CF app GUID). This enables operator to scope authentication to a given CF app GUID (or a set pf appguid, e.g. one per site)

Buildpack integration

For simple applications that don't need to be dependent on vault, and prefer consumming credentials through a standard VCAP_SERVICES environment variables, the buildpack takes the responsibility of invoking vault, fetching secrets, and enriching the VCAP_SERVICES environment variable with them.

Native buildpacks

In this approach, each buildpacks (java, php, ...) adds an option to fetch secret as a pre-start command. This requires to maintain forks of official buildpacks.

Vault-buildpack

In this approach, the pre-start command is factored out in a vault-buildpack that is composeable with other buildpacks to avoid forking each of them. This is a transient solution until CF natively support composeable buildpacks.

The current heroku-buildpack-multi only starts the start cmd from the last buildpack as shown in https://github.com/ddollar/heroku-buildpack-multi/blob/master/bin/release#L3-L4 and make explicit in recent heroku 1st class support for multi-buildpacks https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app#viewing-buildpacks

The last buildpack in the list will be used to determine the process types for the application.
Any process types defined from earlier buildpacks will be ignored.

It is however worth fetching secrets at runtime instead of staging time.

Instead the vault buildpack could itself play the role of the heroku-buildpack-multi, and fetching other buildpacks from http.

Vault decorator producing a runtime hook

The https://github.com/cf-platform-eng/meta-buildpack can be used to invoke a vault decorator which would in turn produce a .profile hook that would be executed at runtime.

See https://github.com/cf-platform-eng/spring-config-decorator/blob/master/bin/compile as a similar example.

Buildpack hooks

The buildpack hooks (currently at the proposal status) enables each application to embed hooks executed at runtime to modify the start command and invoke the vault cli.

This is a light alternative to a php buildpack python extension, and possibly language independent.

This is however duplicated in apps teams, and not centralized within the platform.

Binary service broker

The binary service broker (currently at the proposal status) might distribute the vault CLI binaries within all "binary-service-broker-compatible" buildpacks without forking them.

@gberche-orange
Copy link
Member Author

gberche-orange commented May 4, 2016

Great to see https://github.com/cloudfoundry-community/vault-broker being to pretty close to ideas collected here.

@gberche-orange gberche-orange added this to the Later milestone Nov 3, 2016
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

1 participant