How to Integrate HashiCorp Vault with Jenkins Pipeline on Ubuntu 24.04 ?
What is HashiCorp Vault?
HashiCorp Vault is a secrets-management platform used to securely store and control access to sensitive information such as:
- Passwords
- API tokens
- Database credentials
- Cloud credentials
- GitHub tokens
- Nexus/Artifactory credentials
- Deployment credentials
Instead of storing application secrets directly inside Jenkins, Jenkins can authenticate to Vault and retrieve only the secrets required by a pipeline.
Prerequisites
- Jenkins up and running
- New EC2 instance for Vault with port no 22 and 8200 opened
Install HashiCorp Vault on Ubuntu 24.04
Install required packages:
sudo apt update sudo apt install wget gpg -yAdd the HashiCorp GPG key:
Install Vaultwget -O - https://apt.releases.hashicorp.com/gpg | \ sudo gpg --dearmor \ -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
Add the HashiCorp repository:
echo "deb [arch=$(dpkg --print-architecture) \ signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ https://apt.releases.hashicorp.com \ $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release) main" | \ sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update sudo apt install vault -y
Verify Vault version
vault version
Start Vault for the LabYou'll see something similar to:vault server -dev -dev-listen-address="0.0.0.0:8200"Save the Root Token.Root Token: hvs.xxxxxxxxxxxxx
Note:
Vault development mode should be used only for learning/testing. Do not use dev mode in production.
No comments:
Post a Comment