{"id":2052,"date":"2024-01-21T14:46:16","date_gmt":"2024-01-21T12:46:16","guid":{"rendered":"http:\/\/192.168.1.213:8088\/?p=2052"},"modified":"2024-08-18T17:17:32","modified_gmt":"2024-08-18T15:17:32","slug":"onprem-gitlab-ce-and-hashicorp-vault-pipeline-integration","status":"publish","type":"post","link":"http:\/\/192.168.1.213:8088\/onprem-gitlab-ce-and-hashicorp-vault-pipeline-integration\/","title":{"rendered":"Vault Meets GitLab-CE: A guide for successful pipeline integration"},"content":{"rendered":"\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t

\n\t\t\t\tTable of Contents\t\t\t<\/h4>\n\t\t\t\t\t\t\t
<\/i><\/div>\n\t\t\t\t
<\/i><\/div>\n\t\t\t\t\t<\/div>\n\t\t
\n\t\t\t
\n\t\t\t\t<\/i>\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t
Introduction<\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

Investigating the task of integrating HashiCorp Vault into my existing pipeline, I quickly realized the majority of resources available focused on GitLab-EE<\/strong> and Vault<\/strong> as a SaaS<\/strong> solution. Vault integration with GitLab is a feature that is only available with a premium license. This scenario didn’t align with my specific needs, as I was working with GitLab-CE<\/strong> (Community Edition) on-premises<\/strong>.<\/p>

The journey was not without its challenges. One of the first hurdles was dealing with certificates\u00a0\ud83e\udd2e \u2013 a topic I’ve explained in an article. For those without their own Certificate Authority (CA), I recommend revisiting my previous article<\/a> on using self-signed certificates in GitLab. As we progress, you’ll see why having our own CA file becomes crucial.<\/p>

I won’t describe the installation details of the Vault server on Ubuntu, as HashiCorp’s documentation<\/a> covers this comprehensively. Instead, this blog will focus on the unique challenges and solutions encountered while setting up Vault and seamlessly integrating it with an on-prem GitLab-CE pipeline.<\/p>

The article is based on:
Ubuntu 22.04, Gitlab-CE 16.8.0, Vault 1.15.4<\/strong><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t

\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\"\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t
Setting up Hashicorp Vault<\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

Once you have your Vault server started and set up. Keep in mind to note down your root token and seal token!\u00a0<\/p>

Vault automatically generates self-signed certificates which is not what we want to use. As you create your own certificates, change the certificate path in the vault config file \/etc\/vault.d\/vault.hcl<\/strong><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t

\n\t\t\t\t
\n\t\t\t \n \n \n
# HTTPS listener\nlistener "tcp" {\n  address       = "0.0.0.0:8200"\n  tls_cert_file = "\/opt\/vault\/tls\/198.18.133.99.crt"\n  tls_key_file  = "\/opt\/vault\/tls\/198.18.133.99.key"\n}\n<\/code><\/pre>\n                    <\/div>\n