Skip to content

Commit

Permalink
Credhub sync (#82)
Browse files Browse the repository at this point in the history
* fix rabbitmq credhub credentials synchronization

* adding nats_client_ca

* clean tmp files

* bump releases versions and fix credhub sync

* use genesis credhub instead of credhub directly

---------

Co-authored-by: FiveTwenty AWS Bastion <bastion@fivetwenty.io>
  • Loading branch information
haochenhu233 and FiveTwenty AWS Bastion authored Feb 8, 2025
1 parent c051cf7 commit d41286a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
25 changes: 17 additions & 8 deletions hooks/addon
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,30 @@ 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
genesis credhub ${GENESIS_ENVIRONMENT} set \
-t certificate \
-n "/${GENESIS_ENVIRONMENT}-bosh/${GENESIS_ENVIRONMENT}-blacksmith/blacksmith_services_ca" \
-c <(safe get "${_path}:certificate") \
-p <(safe get "${_path}:key")


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

_path_1="${GENESIS_SECRETS_MOUNT}exodus/${GENESIS_ENVIRONMENT}/cf"
_cf_path="${GENESIS_SECRETS_MOUNT}/${GENESIS_VAULT_PREFIX/blacksmith/cf}"

credhub set \
genesis credhub ${GENESIS_ENVIRONMENT} set \
-t certificate \
-n "/${GENESIS_ENVIRONMENT}-bosh/${GENESIS_ENVIRONMENT}-blacksmith/blacksmith_services_ca" \
-c ${PWD}/blacksmith-ca.crt \
-p ${PWD}/blacksmith-ca.key
-n "/${GENESIS_ENVIRONMENT}-bosh/${GENESIS_ENVIRONMENT}-cf/nats_client_cert" \
-c <(safe get "${_path_1}:nats_client_cert") \
-p <(safe get "${_path_1}:nats_client_key") \
-r <(safe get "${_cf_path}/nats_ca:certificate")

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

blacksmith::visit() {
Expand Down
6 changes: 3 additions & 3 deletions manifests/forges/rabbitmq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ meta:

releases:
- name: rabbitmq-forge
version: 1.2.7
url: https://github.com/blacksmith-community/rabbitmq-forge-boshrelease/releases/download/v1.2.7/rabbitmq-forge-1.2.7.tgz
sha1: 845e9930b891098336aa54ceea3044085c8cb008
version: 1.3.0
url: https://github.com/blacksmith-community/rabbitmq-forge-boshrelease/releases/download/v1.3.0/rabbitmq-forge-1.3.0.tgz
sha1: 755c6ecf935da11f685a08d33fabb1e349bf1361

params:
releases:
Expand Down
7 changes: 3 additions & 4 deletions manifests/forges/redis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ meta:
type: standalone-7
vm_type: default


releases:
- name: redis-forge
version: 1.2.0
url: https://github.com/blacksmith-community/redis-forge-boshrelease/releases/download/v1.2.0/redis-forge-1.2.0.tgz
sha1: 6c5bed86ba757aff8e7d8c3fc6b982e69b6932fb
version: 1.2.1
url: https://github.com/blacksmith-community/redis-forge-boshrelease/releases/download/v1.2.1/redis-forge-1.2.1.tgz
sha1: da3d12fd717c80e8d8cf99951edd108a1a9c8d30

params:
releases:
Expand Down
7 changes: 3 additions & 4 deletions manifests/releases/blacksmith.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
releases:
- name: blacksmith
version: "1.8.0"
url: (( concat "https://github.com/blacksmith-community/blacksmith-boshrelease/releases/download/v" releases.blacksmith.version "/blacksmith-" releases.blacksmith.version ".tgz" ))
sha1: f722638c363c0762988c59a38500eb25bddfd94b

version: 1.9.0
url: https://github.com/blacksmith-community/blacksmith-boshrelease/releases/download/v1.9.0/blacksmith-1.9.0.tgz
sha1: 9b86679c60a7651d9e8f6ea306179051491a19b0
- name: bosh
version: "277.3.1"
sha1: 73029034704f1d2e48bf0c312c0576b5fb14387e
Expand Down

0 comments on commit d41286a

Please sign in to comment.