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

Credhub sync #82

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions hooks/addon
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,38 @@ blacksmith::register() {
blacksmith::ca::sync() {
# TODO: future we can use `credhub:` similar to `exodus:` in manifest instead of this
describe "Fetching Blacksmith CA certificate details..."

describe "Setting values in credhub for blacksmith_services_ca..."

_path="${GENESIS_SECRETS_MOUNT}/${GENESIS_VAULT_PREFIX}/broker/ca"

safe get "${_path}:certificate" > ${PWD}/blacksmith-ca.crt
safe get "${_path}:key" > ${PWD}/blacksmith-ca.key

describe "Setting values in credhub (you did login to credhub first, right?...)"

credhub set \
-t certificate \
-n "/${GENESIS_ENVIRONMENT}-bosh/${GENESIS_ENVIRONMENT}-blacksmith/blacksmith_services_ca" \
-c ${PWD}/blacksmith-ca.crt \
-p ${PWD}/blacksmith-ca.key

rm -f blacksmith-ca.crt blacksmith-ca.key

describe "Setting values in credhub for nats_client_cert..."

_path_1="${GENESIS_SECRETS_MOUNT}exodus/${GENESIS_ENVIRONMENT}/cf"

safe get "${_path_1}:nats_client_cert" > ${PWD}/nats_client_cert.crt
safe get "${_path_1}:nats_client_key" > ${PWD}/nats_client_key.key
credhub get -n "/${GENESIS_ENVIRONMENT}-bosh/${GENESIS_ENVIRONMENT}-cf/nats_client_cert" -k ca > ${PWD}/nats_client_ca.crt

credhub set \
-t certificate \
-n "/${GENESIS_ENVIRONMENT}-bosh/${GENESIS_ENVIRONMENT}-cf/nats_client_cert" \
-c ${PWD}/nats_client_cert.crt \
-p ${PWD}/nats_client_key.key \
-r ${PWD}/nats_client_ca.crt

rm -f nats_client_cert.crt nats_client_key.key nats_client_ca.crt
}

blacksmith::visit() {
Expand Down