What runs op the director (pcf 1.11):
First create your local BOSH director:
bosh create-env ~/workspace/bosh-deployment/bosh.yml \ --state ./state.json \ -o ~/workspace/bosh-deployment/virtualbox/cpi.yml \ -o outbound-network.yml \ -o ~/workspace/bosh-deployment/bosh-lite.yml \ -o ~/workspace/bosh-deployment/bosh-lite-runc.yml \ -o ~/workspace/bosh-deployment/jumpbox-user.yml \ -o ~/workspace/bosh-deployment/uaa.yml \ -o ~/workspace/bosh-deployment/credhub.yml \ --vars-store ./creds.yml \ -v director_name="Bosh Lite Director" \ -v internal_ip=192.168.50.6 \ -v internal_gw=192.168.50.1 \ -v internal_cidr=192.168.50.0/24 \ -v outbound_network_name=NatNetwork bosh alias-env vbox -e 192.168.50.6 --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca) export BOSH_ENVIRONMENT=vbox export BOSH_CLIENT=admin export BOSH_CLIENT_SECRET=`bosh int ./creds.yml --path /admin_password` echo "updating cloud config..." bosh -n update-cloud-config ~/workspace/bosh-deployment/warden/cloud-config.yml
Mind the uaa.yml and credhub.yml operator files.
When the deployment finishes you will have a creds.yml file that has all k
When you have this up and running, credhub should be running on port 8844 and use the local UAA (on port 8443) as it's authenticator.
Then you set the API to credhub:
metskem@athena-2 ~/workspace/boshlite/deployments/vbox $ credhub api -s https://192.168.50.6:8844 --ca-cert <(bosh int creds.yml --path /credhub_tls/ca) --skip-tls-validation Setting the target url: https://192.168.50.6:8844 Warning: The targeted TLS certificate has not been verified for this connection. Warning: The --skip-tls-validation flag is deprecated. Please use --ca-cert instead.
First some jq magic to get the UAA URL from the credhub /info api:
curl -k --silent https://192.168.50.6:8844/info|jq '.["auth-server"].url' -r https://192.168.50.6:8443
Login to credhub should be done with a UAA user, so login with that first (it took me quite some time to find out which user/password to use for uaa admin):
uaac token client get uaa_admin -s l128pcpdag6olta4ec1x # get this password from creds.yml#uaa_admin_client_secretAfter that you are able to list the contexts and you can see you have scime.write (needed for adding users) and more:
metskem@athena ~/workspace/boshlite/deployments/vbox uaac contexts
[0]*[https://192.168.50.6:8443]
skip_ssl_validation: true
[0] [admin]
client_id: admin
access_token: eyJhbGciOiJSUzI1NiIsImtpZCI6ImxlZ2FjeS10b2tlbi1rZXkiLCJ0eXAiOiJKV1QifQ.eyJqdGkiOiI2MzMyOWY4Y2JmMjI0YzE3OThhYjVlN2I5MTdjY2QzYyIsInN1YiI6ImFkbWluIiwiYXV0aG9yaXRpZXMiOlsiYm9zaC5hZG1pbiJdLCJzY29wZSI6WyJib3NoLmFkbWluIl0sImNsaWVudF9pZCI6ImFkbWluIiwiY2lkIjoiYWRtaW4iLCJhenAiOiJhZG1pbiIsInJldm9jYWJsZSI6dHJ1ZSwiZ3JhbnRfdHlwZSI6ImNsaWVudF9jcmVkZW50aWFscyIsInJldl9zaWciOiI0YmI2OTAwYyIsImlhdCI6MTUzNTk4MDQxNSwiZXhwIjoxNTM2MDIzNjE1LCJpc3MiOiJodHRwczovLzE5Mi4xNjguNTAuNjo4NDQzL29hdXRoL3Rva2VuIiwiemlkIjoidWFhIiwiYXVkIjpbImFkbWluIiwiYm9zaCJdfQ.URHw2xjZrqUFBMFVV4Ap4t4u5QqiMk61krlrIQx4s8klW2PDnEPS0tyl0qwmDOxdU08-C-s-E_GPbgePl8gqFGs6sgXagRmqw2ecnI2LDLu0SvhpKjMPGtCN0Gv38ZhDA_hzbrLouRgZ7SaxctSX4TnQMad_uxG0mq1KgFePy6luVqr32vvepkqMbRDBrNHro30wI_CDjie0vcFNBA9pQF5Z5SmUqzXAUvt2jEzPEc7Hqhwd8gAzOTAzOQYRnDnfMHdf3MP6ZGjPly7xDyRp9Z-QXo6PLItI7KmlO-qluU0JgKFnaznBl5TxTwMMA5o0k7FKXCjewPa--87yO3-A6w
token_type: bearer
expires_in: 43199
scope: bosh.admin
jti: 63329f8cbf224c1798ab5e7b917ccd3c
[1]*[uaa_admin]
client_id: uaa_admin
access_token: eyJhbGciOiJSUzI1NiIsImtpZCI6ImxlZ2FjeS10b2tlbi1rZXkiLCJ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GxeQHTV72gOlDS7fpOH4Y2YgMHeIkLQ
token_type: bearer
expires_in: 43199
scope: clients.read password.write clients.secret clients.write uaa.admin scim.write scim.read
jti: d65941aac917410da1973383e556959b
metskem@athena ~/workspace/boshlite/deployments/vbox
You need the second context (uaa_admin), as you can see it has all the scopes you need (clients.read password.write clients.secret clients.write uaa.admin scim.write scim.read).
Now you can also list the current uaa clients:
metskem@athena ~/workspace/boshlite/deployments/vbox uaac clients
admin
scope: uaa.none
resource_ids: none
authorized_grant_types: client_credentials
autoapprove:
authorities: bosh.admin
lastmodified: 1535891189747
bosh_cli
scope: openid bosh.admin bosh.read bosh.*.admin bosh.*.read bosh.teams.*.admin bosh.teams.*.read
resource_ids: none
authorized_grant_types: password refresh_token
autoapprove:
access_token_validity: 120
refresh_token_validity: 86400
authorities: uaa.none
lastmodified: 1535891189819
credhub-admin
scope: uaa.none
resource_ids: none
authorized_grant_types: client_credentials
autoapprove:
access_token_validity: 3600
authorities: credhub.write credhub.read
lastmodified: 1535891189423
credhub_cli
scope: credhub.read credhub.write
resource_ids: none
authorized_grant_types: password refresh_token
autoapprove:
access_token_validity: 60
refresh_token_validity: 1800
authorities: uaa.none
lastmodified: 1535891189596
director_to_credhub
scope: uaa.none
resource_ids: none
authorized_grant_types: client_credentials
autoapprove:
access_token_validity: 3600
authorities: credhub.write credhub.read
lastmodified: 1535891189890
hm
scope: uaa.none
resource_ids: none
authorized_grant_types: client_credentials
autoapprove:
authorities: bosh.admin
lastmodified: 1535891189671
uaa_admin
scope: uaa.none
resource_ids: none
authorized_grant_types: client_credentials
autoapprove:
authorities: clients.read password.write clients.secret clients.write uaa.admin scim.write scim.read
lastmodified: 1535891189507
metskem@athena ~/workspace/boshlite/deployments/vbox
And you can list current uaa users :
metskem@athena ~/workspace/boshlite/deployments/vbox uaac users
resources:
-
id: 867f25b4-4c92-41a9-b6aa-dba4b6d23cac
meta
version: 0
created: 2018-09-02T12:26:27.295Z
lastmodified: 2018-09-02T12:26:27.295Z
name
familyname:
givenname:
emails:
-
value: admin
primary: false
groups:
-
value: 9c03792f-013d-4cc3-9220-8c688d809f56
display: uaa.offline_token
type: DIRECT
-
value: bdf0bbb0-5047-4705-a3c2-43590babaaec
display: profile
type: DIRECT
-
value: cfba5d5c-fe3d-4948-b2e5-bd33caf914d6
display: user_attributes
type: DIRECT
-
value: 45f765c9-b670-4234-a378-8b2230d6779e
display: cloud_controller.write
type: DIRECT
-
value: 8ae1fd7f-e393-4ca6-a727-e267fb1661da
display: openid
type: DIRECT
-
value: 1994ff63-8eab-40bc-99c6-3c3f117fd8fd
display: notification_preferences.write
type: DIRECT
-
value: bd5c331f-778c-4196-8abf-2d56381c56a5
display: oauth.approvals
type: DIRECT
-
value: 599b2bab-a8d9-4b00-9c69-0082dba892c7
display: bosh.admin
type: DIRECT
-
value: ec253d39-e701-44f8-bd06-7e1a97b449a1
display: password.write
type: DIRECT
-
value: 2da56b99-6188-42a7-be3b-0886741f3a1f
display: cloud_controller_service_permissions.read
type: DIRECT
-
value: 6eded82d-f5dd-48e0-8a60-90763d1773ea
display: scim.me
type: DIRECT
-
value: a0a90654-9f88-4246-b9c5-93cee5f33dfe
display: cloud_controller.read
type: DIRECT
-
value: 24348f57-4ce1-4f76-b5bb-2c716d3bd203
display: roles
type: DIRECT
-
value: cc248fc8-50d6-48a1-a1d4-d7e3dfc65f42
display: approvals.me
type: DIRECT
-
value: db3e1751-bb89-4050-8bce-83e40fcbf86b
display: uaa.user
type: DIRECT
-
value: c7f5cd9b-6f3c-4382-a70a-2ca0b171701f
display: notification_preferences.read
type: DIRECT
approvals:
active: true
verified: true
origin: uaa
schemas: urn:scim:schemas:core:1.0
username: admin
zoneid: uaa
passwordlastmodified: 2018-09-02T12:26:27.000Z
previouslogontime: 1535956808901
lastlogontime: 1535972766877
schemas: urn:scim:schemas:core:1.0
startindex: 1
itemsperpage: 100
totalresults: 1
And there we see the user credhub-admin, that one is what we need for managing credhub. So let's credhub-login with that:
/:~# ps -ef|grep -i credh vcap 35083 1 0 Jan26 ? 00:05:10 java -Dspring.profiles.active=prod -Dspring.config.location=/var/vcap/jobs/credhub/config/application.yml -Dlog4j.configurationFile=/var/vcap/jobs/credhub/config/log4j2.properties -Djava.security.egd=file:/dev/urandom -Djava.io.tmpdir=/var/vcap/jobs/credhub/tmp -ea -jar credhub.jar ....
This listens on port 8844.
There is an interesting config file @ /var/vcap/jobs/credhub/config/application.yml
Logging is @ /var/vcap/sys/log/credhub/credhub.log
metskeh@admin-d01we-cis:~$ ./credhub api --skip-tls-validation --server 10.253.6.11:8844 Warning: The targeted TLS certificate has not been verified for this connection. Warning: The --skip-tls-validation flag is deprecated. Please use --ca-cert instead. Setting the target url: https://10.253.6.11:8844
metskeh@admin-d01we-cis:~$ curl -k --silent https://10.253.6.11:8844/info | jq
{
"auth-server": {
"url": "https://10.253.6.11:8443"
},
"app": {
"name": "CredHub",
"version": "1.0.8"
}
}
metskeh@admin-d01we-cis:~$ curl -k --silent https://10.253.6.11:8844/health | jq
{
"status": "UP"
}