Created
August 13, 2019 13:30
-
-
Save ob1-sc/54b18ded75886341af2500dfad1309fc to your computer and use it in GitHub Desktop.
bosh socks proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export OM_KEY=om.pem | |
terraform output ops_manager_ssh_private_key > $OM_KEY | |
chmod 0600 $OM_KEY | |
CREDS=$(om -t $OM_TARGET --skip-ssl-validation curl --silent \ | |
-p /api/v0/deployed/director/credentials/bosh_commandline_credentials | \ | |
jq -r .credential | sed 's/bosh //g') | |
# this will set BOSH_CLIENT, BOSH_ENVIRONMENT, BOSH_CLIENT_SECRET, and BOSH_CA_CERT | |
# however, BOSH_CA_CERT will be a path that is only valid on the OM VM | |
array=($CREDS) | |
for VAR in ${array[@]}; do | |
export $VAR | |
done | |
export BOSH_CA_CERT="$(om -t $OM_TARGET --skip-ssl-validation certificate-authorities -f json | \ | |
jq -r '.[] | select(.active==true) | .cert_pem')" | |
export BOSH_ALL_PROXY="ssh+socks5://ubuntu@$OM_TARGET:22?private-key=$OM_KEY" | |
export CREDHUB_PROXY=$BOSH_ALL_PROXY | |
export CREDHUB_CLIENT=$BOSH_CLIENT | |
export CREDHUB_SECRET=$BOSH_CLIENT_SECRET | |
export CREDHUB_CA_CERT=$BOSH_CA_CERT | |
export CREDHUB_SERVER="https://$BOSH_ENVIRONMENT:8844" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment