A CloudFoundry service broker to ease exposition of static credentials in the CF marketplace, without requiring software development.
This generic service broker is used by service providers to expose one or more services systematically returning static credentials, along with static service catalog. A static-creds-broker instance is usually configured to return distinct catalog and binding credentials per service and per service plan.
Deploying a static-creds-broker instance takes few minutes: configure the static data to be returned, and cf push
the pre-built static-creds-brokers binaries.
When deploying a static-creds-broker instance on cloudfoundry, configure it either through
Notice that the default behavior is to fetch configuration properties from a remote git repo.
To disable the default behavior, please set following env variable : SPRING_PROFILES_ACTIVE: native
Also note that the 2.X static-creds-broker releases are only compatible with Diego backends and do not support DEA backends (more details in issue 27. To use static-creds-brokers with DEA backends, please use the latest 1.X branch release such as https://github.com/orange-cloudfoundry/static-creds-broker/tree/v1.3 and the associated 1.X configuration syntax.
# Download the latest binary release of this broker
LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/orange-cloudfoundry/static-creds-broker/releases/latest | grep browser_download_url | head -n 1 | cut -d '"' -f 4)
echo "Downloading $LATEST_RELEASE_URL"
curl -O -L $LATEST_RELEASE_URL
# Unzip the zip release of this broker. The zip contains binary release and manifest template file.
unzip static-creds-broker.zip
# Configure the broker through environment variables, possibly captured in a CF CLI manifest file
# Example manifest files (manifest.tmpl.yml, manifest.tmpl.yaml-config.yml, manifest.tmpl.remote-config.yml)
# are provided, create a manifest.yml file by adapting it to your environment (in particular set the domain)
# Remember that credentials can be set using env variables (see manifest.tmpl.yml), using local configuration properties
#(see manifest.tmpl.yaml-config.yml) or by referencing external configuration properties backed in a remote git repository
#(see manifest.tmpl.remote-config.yml)
# Note: Be careful that services and plans name should be unique in the scope of your Cloud Foundry platform.
cat <<- EOF > manifest.yml
---
applications:
- name: my-broker
memory: 256M
instances: 1
host: mybroker
domain: my-admin-domain.cf.io
path: static-creds-broker-2.0.jar
env:
SECURITY_USER_PASSWORD: MySecurePwd
SERVICES[ID]_NAME: MyService
SERVICES[ID]_DESCRIPTION: My existing service
SERVICES[ID]_METADATA_LONG_DESCRIPTION: A long description for my service
SERVICES[ID]_CREDENTIALS[URI]: mysql://USERNAME:PASSWORD@HOSTNAME:PORT/NAME
EOF
# deploy the broker
cf push
# Register the broker system-wise (requires cloudcontroller.admin i.e. admin access to the CloudFoundry instance)
# refer to http://docs.cloudfoundry.org/services/managing-service-brokers.html#register-broker
cf create-service-broker mybrokername someuser somethingsecure http://mybroker.example.com/
# Then make individual services visibles in desired orgs or in all orgs,
# see http://docs.cloudfoundry.org/services/access-control.html#enable-access
cf enable-service-access MyService
# Alternatively, register as a private service broker for one space or one org
# get the CF cli 6.16 or the latest edge binaries from https://github.com/cloudfoundry/cli#downloads
# cf create-service-broker SERVICE_BROKER USERNAME PASSWORD URL [--space-scoped]
cf create-service-broker mybrokername user MySecurePwd http://mybroker.my-admin-domain.cf.io --space-scoped
# Check presence of the service in the marketplace, and proper description of its plan
cf m
cf m -s MyService
# Create a service instance and service key to check proper binding of the static credentials
cf cs MyService myplan static-creds-instance
cf create-service-key static-creds-instance static-service-key
cf service-key static-creds-instance static-service-key
This section lists the configuration key/values that this broker supports (passed through env vars or yml config files).
Conventional notation:
Please notice that from 2.X version, there has been a complete refactoring leading to non backward compatible API changes. Thus, to benefit from new 2.X version, you will need to review your exiting configuration to ensure it is compliant with new config reference.
1.x version | 2.X version |
---|---|
SERVICES_{SERVICE_ID}_NAME | SERVICES[{SERVICE_ID}]_NAME |
SERVICES_{SERVICEID}_PLAN\{PLAN_ID}_NAME | SERVICES[{SERVICE_ID}]_PLANS[{PLAN_ID}]_NAME |
SERVICES_{SERVICE_ID}_CREDENTIALS_URI | SERVICES[{SERVICE_ID}]_CREDENTIALS[URI] |
..._METADATA_DISPLAYNAME | _METADATA_DISPLAY_NAME |
..._METADATA_IMAGEURL | _METADATA_IMAGE_URL |
..._METADATA_SUPPORTURL | _METADATA_SUPPORT_URL |
..._METADATA_DOCUMENTATIONURL | _METADATA_DOCUMENTATION_URL |
..._METADATA_PROVIDERDISPLAYNAME | _METADATA_PROVIDER_DISPLAY_NAME |
..._METADATA_LONGDESCRIPTION | METADATA_LONG_DESCRIPTION |
..._CREDENTIALS = {json} | _CREDENTIALS_JSON = {json} |
The catalog exposed by the broker is controlled by environment variables matching the service broker catalog endpoint response.
tag1,tag2,tag3
, default is []
)syslog_drain, volume_mount
, default is []
). A list of permissions that the user would have to give the service, if they provision it. The only permission currently supported is syslog_drain.Multiple plans are supported. Use the following environment variables to configure it, or let the default values apply:
A number of catalog variables are not configureable, the broker always return the following default value:
[]
(empty array){}
(empty)The returned credentials are identical for all bound service instances of a specific plan.
The credentials could be defined for a service, it will be applied for all plans of the service. It is configured by the following environment variables:
SERVICES[{SERVICE_ID}]_CREDENTIALS_ACCESS_KEY: azert
, the returned credentials will
contain a key named "ACCESS_KEY" {..., "ACCESS_KEY":"azert", ...}
'{"username":"admin","password":"pa55woRD"}'
The credentials could also be defined for a particular plan, if it contains conflict credential key between the service credentials and plan credentials, the values of the plan credentials will be taken. It is configured by the following environment variables:
'{"username":"admin","password":"pa55woRD"}'
This is mapped to spring-cloud-cloudfoundry-service-broker
The returned syslog_drain_url is identical for all bound service instances of a specific plan.
The syslog_drain_url could be defined for a service, it will be applied for all plans of the service. It is configured by the following environment variables:
The syslog_drain_url could also be defined for a particular plan, if it contains conflict syslog_drain_url key between the service syslog_drain_url and plan syslog_drain_url, the values of the plan syslog_drain_url will be taken. It is configured by the following environment variables:
If syslog_drain_url has been defined, SERVICES[{SERVICE_ID}]_REQUIRES
property with a value syslog_drain
must be declared in the Catalog endpoint or the service broker would consider the configuration invalid.
The returned volume_mount is identical for all bound service instances of a specific plan.
The volume_mount could be defined for a service, it will be applied for all plans of the service. It is configured by the following environment variables:
"READ_ONLY"
, "READ_WRITE"
)."shared"
).SERVICES[{SERVICE_ID}]\_VOLUME_MOUNT[0]\_DEVICE_MOUNT_CONFIG_[source]: "nfs://..."
The volume_mount could also be defined for a particular plan, if it contains conflict volume_mount key between the service volume_mount and plan volume_mount, the values of the plan volume_mount will be taken. It is configured by the following environment variables:
"READ_ONLY"
, "READ_WRITE"
)."shared"
).SERVICES[{SERVICE_ID}]\_PLANS\[{PLAN_ID}]\_VOLUME_MOUNT[0]\_DEVICE_MOUNT_CONFIG_[source]: "nfs://..."
If volume_mount has been defined, SERVICES[{SERVICE_ID}]_REQUIRES
property with a value volume_mount
must be declared in the Catalog endpoint or the service broker would consider the configuration invalid.
The returned route service url is identical for all bound service instances of a specific plan.
The route service url could be defined for a service, it will be applied for all plans of the service. It is configured by the following environment variables:
The route service url could also be defined for a particular plan, if it contains conflict route service url key between the service route_service_url and plan route_service_url, the values of the plan route_service_url will be taken. It is configured by the following environment variables:
If route_service_url has been defined, SERVICES[{SERVICE_ID}]_REQUIRES
property with a value route_forwarding
must be declared in the Catalog endpoint or the service broker would consider the configuration invalid.
The service broker authenticates calls coming from Cloud Foundry through basic auth (see more context) controlled by the following two environment variables
If the deployment of the broker fails, you could find the error message using cf cli:
$ cf logs <app_name> --recent | findstr Caused
# or more complete error information with:
$ cf logs <app_name> --recent | findstr ERR
Acceptance tests source code is available in the "acceptance" folder. To run it locally, you should:
pip install robotframework
. More details on robotframework installation{ACCEPTANCE_TEST_DIRECTORY}/acceptance.tmpl.env
to {ACCEPTANCE_TEST_DIRECTORY}/acceptance.env
{ACCEPTANCE_TEST_DIRECTORY}/acceptance.env
source {ACCEPTANCE_TEST_DIRECTORY}/acceptance.env
robot --pythonpath {ACCEPTANCE_TEST_DIRECTORY}/classes/ {ACCEPTANCE_TEST_DIRECTORY}
User provided service instances is a syntaxic support in CF targetted at application teams to expose static credentials as a service instance.
Limitations of the UPS approach:
Mature SDKs are available for Java through spring-cloud-cloudfoundry-service-broker or cf-java-component (see associated intro video , ruby, go to ease implementing the service broker REST API. See examples implementation
Proof-of-concept SDK have been contributed for PHP
Some service provider teams (or app teams needing to expose services) might find the static-creds-broker useful because:
See github issues for the list of future features planned, with associated milestones reflecting relative priority (see convenient huboard for contributors to reorder priorities). Comments and refinements are welcomed.
Please suggest more ideas by submitting new issues.