Managing Jenkins X secrets

3 minute read

In traditional computing infrastructures, all of the resources and components (hardware, networking, availability, security and deployment) as well as associated labor costs are locally managed. Third-party computing environments such as cloud service providers and Git hosts offer decentralized solutions with distinct advantages in service reliability and costs over the traditional solutions.

However, one issue with using cloud services, distributed storage, and remote repositories is the lack of trusted networks, vetted hardware, and other closely observed security measures practiced in locally-hosted infrastructure. For the sake of convenience, users often store sensitive information like authentication credentials in open, public repositories, exposed to potential malicious activity.

Hashicorp Vault is one tool that centralizes the management of secrets: resources that provide authentication to your computing environment such as tokens, keys, passwords, and certificates.

CloudBees Jenkins X Distribution handles security and authentication resources through the integration of Vault. Users can deploy Vault to securely store and manage all aspects of their development platform.

CloudBees Jenkins X Distribution installs and configures Vault for your Google Kubernetes Engine (GKE) cluster by default through the cluster creation process. Refer to Creating a Jenkins X cluster on GKE for more information.

On Elastic Kubernetes Service (EKS) clusters, there are additional Identity Access Management (IAM) settings to configure before creating the cluster. Refer to Configuing Vault for EKSfor more information.

Vault features

Vault is a tool for accessing and storing user secrets. It manages the complexity of secure resource access:

  • Storing secrets - Vault places secrets in an encrypted format in a remote storage bucket.

  • Secret creation and deletion - Vault creates secrets for dynamic access to storage buckets, ephemeral access that are created/destroyed as needed for temporary data access, and generating keys for database authentication.

  • Encrypting data - Vault stores secrets in a remote storage bucket in secure directories using strong encryption.

Using Vault with CloudBees Jenkins X Distribution

CloudBees Jenkins X Distribution interacts with Vault via the jx command line program. There are commands for creating, deleting, and managing secrets and vaults.

CloudBees Jenkins X Distribution uses Vault to store all Jenkins X secrets, such as the GitHub personal access token generated for the pipeline bot when creating a Jenkins X cluster. It also stores any GitOps secrets, such as passwords for storage buckets, and keys for secure server access.

Secrets can be retrieved by the pipeline or via command-line if logged into the account associated with the kubernetes service as well as any secrets stored in the jx namespace for the pipeline.

Vaults are provisioned in kubernetes using vault-operator, an open-source Kubernetes controller installed when Vault is configured during cluster creation and Jenkins X installation on the cluster.

Configuring DNS and TLS settings for Vault

For a secure CloudBees Jenkins X Distribution installation, you must enable TLS when interacting with the vault service. To configure TLS, you must first configure Zone DNS settings within Google Cloud Platform, and then configure external DNS settings for Ingress and TLS in the jx-requirements.yaml configuration file. Refer to the Configuring DNS and TLS for GKE and Configuring DNS and TLS for EKS respectively for more information.

Retrieving Vault secrets

If you need to recall your secrets (such as a password, keypair, or token) you can run the jx get command to find the Vault Address to open in your browser and the Vault Token for logging into the Vault.

jx get vault-config

The output is in the form of export statements. For example:

export VAULT_ADDR=
export VAULT_TOKEN=t.lBNBWR9JIMwwH9AXD95grlwmn

These export statements can be used to run Vault’s own client command-line tools, or they can be copied from the command-line and pasted in a web browser to retrieve stored secrets.

Deleting a Vault

If you need to delete your vault due to misconfiguration or changes in the authentication protocols of 3rd party resources, you can delete a Vault using the jx delete command and the name of the Vault to remove all associated secrets stored in the Vault.

jx delete vault acmevault

If you have any questions or feedback on the CloudBees Jenkins X Distribution documentation, send them to