Using mTLS with Docker Swarm for External Databases
This section provides guidance for configuring mTLS (mutual Transport Layer Security) with PostgreSQL in a Docker Swarm environment.
Configure PostgreSQL
Customers are responsible for configuring PostgreSQL to use mTLS. Follow these steps to ensure proper setup:
Database Setup and configuration:
-
Set up the database following the guidelines outlined in the Black Duck Documentation Portal.
-
Update
hub-webserver.env:Configure the
PUBLIC_HUB_WEBSERVER_HOSTvariable in thehub-webserver.envfile as documented in other sections. -
Update
hub-postgres.env:Modify the
hub-postgres.envfile with the following values:HUB_POSTGRES_ENABLE_SSL- Set totrueHUB_POSTGRES_ENABLE_SSL_CERT_AUTH- Set totrueHUB_POSTGRES_HOST- Enter your PostgreSQL host.HUB_POSTGRES_PORT- Enter your PostgreSQL port.HUB_POSTGRES_USER- If not using the default, specify the non-admin PostgreSQL user for Black Duck.HUB_POSTGRES_ADMIN- If not using the default, specify the admin PostgreSQL user for Black Duck.
Certificates and Keys
To utilize mTLS, you must have the following certificates and keys:
-
Certificates Required:
You need either:
- A root certificate, or
- A client certificate and key, or
- An admin certificate and key, or a combination of these.
Note: If using a client certificate, the client key is also required. The same applies for the admin certificate. If either the certificate or key is missing, the startup script will not function properly. The root certificate is standalone and does not require a key. -
File Ownership and Permissions:
All certificates and keys must be stored in the same directory, which should be owned by root and have permissions set to 755. The following naming and permission conventions must be followed:
HUB_POSTGRES_CA(Root Certificate): Owned by root, permissions 644.HUB_POSTGRES_CRT(Client Certificate): Owned by root, permissions 644.HUB_POSTGRES_KEY(Client Key): Owned by root, permissions 640. Must be in PKCS#8 format.HUB_ADMIN_POSTGRES_CRT(Admin Certificate): Owned by root, permissions 644.HUB_ADMIN_POSTGRES_KEY(Admin Key): Owned by root, permissions 640. Must be in PKCS#8 format.
Volume Mount
A new YAML file has been introduced specifically for using mTLS with an external
database: docker-compose.externaldb-cert-volume.yml.
Incorporating this YAML into your deployment will enable mTLS and create a
volume mount for the certificates and keys.
Required Edits to YAML File:
-
HUB_POSTGRES_SSL_MODE:
This setting configures the
sslmodefor authenticating with PostgreSQL. Supported modes areverify-ca(default) andverify-full. Using any other setting will disable mTLS authentication. -
Integrations Container:
If deploying with the integrations container, uncomment the relevant lines that are currently commented out, starting with
#integration:. -
Volume Path:
Set the path for
volumes►hub-certificates►driver_opts►deviceto the absolute path of the directory containing the certificates and keys.
Starting Black Duck
When starting Black Duck, ensure to include
docker-compose.externaldb-cert-volume.yml in your command to
enable mTLS functionality.
