From f446a6c9ecd8405433d2c4d06d7d9a4e36489dc6 Mon Sep 17 00:00:00 2001 From: Sean Brandt Date: Sun, 14 Jul 2019 10:33:44 -0400 Subject: [PATCH] Add support for vault kv v2 api, key off of VAULT_KV_V2 env var --- deploy/vault_cli.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/deploy/vault_cli.sh b/deploy/vault_cli.sh index b93fdd51..65572e54 100644 --- a/deploy/vault_cli.sh +++ b/deploy/vault_cli.sh @@ -2,10 +2,10 @@ # Here is a script to deploy cert to hashicorp vault # (https://www.vaultproject.io/) -# +# # it requires the vault binary to be available in PATH, and the following # environment variables: -# +# # VAULT_PREFIX - this contains the prefix path in vault # VAULT_ADDR - vault requires this to find your vault server # @@ -51,6 +51,11 @@ vault_cli_deploy() { if [ -n "$FABIO" ]; then $VAULT_CMD write "${VAULT_PREFIX}/${_cdomain}" cert=@"$_cfullchain" key=@"$_ckey" || return 1 + elif [ -n "$VAULT_KV_V2" ]; then + $VAULT_CMD kv put "${VAULT_PREFIX}/${_cdomain}" cert=@"$_ccert" \ + key=@"$_ckey" \ + chain=@"$_cca" \ + fullchain=@"$_cfullchain" || return 1 else $VAULT_CMD write "${VAULT_PREFIX}/${_cdomain}/cert.pem" value=@"$_ccert" || return 1 $VAULT_CMD write "${VAULT_PREFIX}/${_cdomain}/cert.key" value=@"$_ckey" || return 1