Commit 4dd22005 authored by Ian Douglas's avatar Ian Douglas
Browse files

add script to for target provision-ca-roles (wip)

parent 637d85e8
Loading
Loading
Loading
Loading

provision-ca-roles.sh

0 → 100755
+26 −0
Original line number Diff line number Diff line
#!/bin/bash

# Sets CA roles for certificate issuance

THIS_DIR=$(dirname $0)
source $THIS_DIR/utils/provision-func.sh

bash_defaults

data_dir=$1

# if VAULT_TOKEN is not set, use user token (we set since we use curl, not vault CLI)
if ! is_set VAULT_TOKEN; then
  if [ -f ~/.vault-token ]; then
    export VAULT_TOKEN=$(cat ~/.vault-token)
  else
    >&2 echo 'ERROR: either VAULT_TOKEN must be set or ~/.vault-token must exist'
    >&2 echo 'on your local machine you can do `vault login -method ldap`'
    false
  fi
fi

# Provision ca roles. We are not changing to $data_dir, so we need to give approle api path.
echo "provision pki/roles/*.json"

provision -p pki/roles $data_dir/pki/roles/*.json