rundeck-plugins / vault-storage

Storage plugin for Rundeck for storing data in Vault
http://rundeck.org/plugins/vault/2017/11/25/vault-storage.html
MIT License
18 stars 11 forks source link

Rundeck Vault Storage Plugin

Purpose

This is a Storage Backend plugin for storing Key Store data in Vault.

This plugin is bundled with Rundeck Enterprise. It is also available to Community users following the install steps below.

Community Installation

Configuration

Add the settings to $RDECK_BASE/etc/rundeck-config.properties

rundeck.storage.provider.[index].config.prefix=rundeck

rundeck.storage.provider.[index].config.address=https://vaultURL:8200

rundeck.storage.provider.[index].config.authBackend=authBackend

Default value: token

Allowed values: approle, cert, github, token, userpass

rundeck.storage.provider.[index].config.token=xxxxxx

rundeck.storage.provider.[index].config.username=username
rundeck.storage.provider.[index].config.approleSecretId=approleSecretId
rundeck.storage.provider.[index].config.keyStoreFile=/path/keyfile
rundeck.storage.provider.[index].config.keyStoreFilePassword=/path/keyStoreFilePassword
rundeck.storage.provider.[index].config.pemFile=/path/pemFile
rundeck.storage.provider.[index].config.clientPemFile=/path/clientPemFile
rundeck.storage.provider.[index].config.clientKeyPemFile=/path/clientKeyPemFile

Default value: 5

Default value: 1000

Default value: 5

rundeck.storage.provider.[index].config.readTimeout=20

Default value: 20

rundeck.storage.provider.[index].config.secretBackend=secret

Default value: secret

rundeck.storage.provider.[index].config.engineVersion=1/2

Default value: 1

Configuration Examples

example basic settings

rundeck.storage.provider.1.type=vault-storage
rundeck.storage.provider.1.path=keys
rundeck.storage.provider.1.config.prefix=rundeck
rundeck.storage.provider.1.config.secretBackend=secret
rundeck.storage.provider.1.config.address=$VAULT_URL
rundeck.storage.provider.1.config.token=$VAULT_TOKEN

existing vault storage

For existing vault storage, probably you will need to remove the default keys path added by default for rundeck. You can use these settings for an existing vault storage:

rundeck.storage.provider.1.type=vault-storage
rundeck.storage.provider.1.path=keys
rundeck.storage.provider.1.config.prefix=someprefix
rundeck.storage.provider.1.config.secretBackend=mybackend
rundeck.storage.provider.1.config.address=$VAULT_URL
rundeck.storage.provider.1.config.token=$VAULT_TOKEN
rundeck.storage.provider.1.config.storageBehaviour=vault

Using APPROLE authentication

You can use these settings for an existing vault storage:

rundeck.storage.provider.1.type=vault-storage
rundeck.storage.provider.1.path=keys
rundeck.storage.provider.1.config.prefix=app
rundeck.storage.provider.1.config.secretBackend=secret
rundeck.storage.provider.1.config.address=$VAULT_URL
rundeck.storage.provider.1.config.engineVersion=2
rundeck.storage.provider.1.config.storageBehaviour=vault

#auth
rundeck.storage.provider.1.config.authBackend=approle
rundeck.storage.provider.1.config.approleAuthMount=approle
rundeck.storage.provider.1.config.approleId=$VAULT_APPROLE_ID
rundeck.storage.provider.1.config.approleSecretId=$VAULT_APPROLE_SECRET_ID

#timeouts
rundeck.storage.provider.1.config.maxRetries=500
rundeck.storage.provider.1.config.retryIntervalMilliseconds=2
rundeck.storage.provider.1.config.openTimeout=2500
rundeck.storage.provider.1.config.readTimeout=2500

Enabling APPROLE Vault using API

curl --header "X-Vault-Token: $TOKEN" --request POST --data '{"type": "approle"}' http://localhost:8200/v1/sys/auth/approle
curl --header "X-Vault-Token: $TOKEN" --request POST --data '{"policies": "rundeck", "token_ttl": "2m", "token_max_ttl": "2m"}' http://localhost:8200/v1/auth/approle/role/rundeck
# get $VAULT_APPROLE_ID
curl --header "X-Vault-Token: $TOKEN" http://localhost:8200/v1/auth/approle/role/rundeck/role-id | jq
# get $VAULT_APPROLE_SECRET_ID
curl --header "X-Vault-Token: $TOKEN" --request POST http://localhost:8200/v1/auth/approle/role/rundeck/secret-id | jq

Vault API versions

Since version 1.3.1, this plugin can work with kV Secrets Engine - Version 2. A new config variable was added in order to set the API version that you need to use:

rundeck.storage.provider.1.config.engineVersion=1/2

Example:

rundeck.storage.provider.1.type=vault-storage
rundeck.storage.provider.1.path=keys
rundeck.storage.provider.1.config.prefix=rundeck
rundeck.storage.provider.1.config.secretBackend=secret
rundeck.storage.provider.1.config.address=$VAULT_URL
rundeck.storage.provider.1.config.token=$VAULT_TOKEN
rundeck.storage.provider.1.config.engineVersion=2

By default, the value is set to v1 (1)

Minimal version requirements

Thanks

TODO