DevOps

Install CyberArk Conjur Open Source Secrets Management

A look at CyberArk Conjur which is an open-source secrets management tool for DevOps to store secrets across tools, apps, and clouds.

Managing secrets is an extremely important part of DevOps and keeping things secure, whether you are housing secrets for your infrastructure as code, or other tasks. I have been a fan for quite a while of Hashicorp Vault. There are other solutions available however. CyberArk Conjur is an open-source solution that you can freely download to manage secrets.

What is CyberArk Conjur?

CyberArk Conjur is a free and open-source tool that you can download here: Secrets Management | Conjur. With it, you can manage secrets across tools, apps, and clouds. It can authenticate containers, isolate secrets from applications, and can be used for privileged access management to control access for non-human identities. It allows securely storing and retrieval of credentials, API keys, and other secrets.

Cyberark conjur open source secrets management
Cyberark conjur open source secrets management

CyberArk Conjur features

Note the following features of Conjur:

Integration with DevOps Tools

Like other secrets management tools, Conjur integrates well with DevOps tools, including CI/CD pipelines. This DevOps integration makes sure your secrets are secured through the development and deployment pipelines and tasks.

Support for Non-Human Identities

This is a big one. Non-human identities are often neglected when it comes to proper security. These non-human identities include things like service accounts and applications, or also machine identity. Conjur is a good tool in this area. You can use it to provide secure secrets management for non-human identities like service accounts and other non human identities.

It supports cloud

Conjur supports all the major cloud environments and cloud providers, including AWS, Azure, and Google Cloud. It securely stores secrets for cloud environments and makes these only accessible to authorized cloud services and users configured.

It can also complement cloud secrets services like AWS Secrets Manager. You can use it with AWS Secrets Manager to provide an additional layer of security and management capabilities when you fetch secrets.

Helps secure Containerized Environments

In containerized environments, managing secrets can be difficult. CyberArk Conjur provides a solution that integrates well with container orchestration tools like Kubernetes.

Conjur allows containers to securely authenticate and read secrets without exposing them. Even in dynamic containerized environments it helps to make sure these are secured properly.

Install CyberArk Conjur Open Source

CyberArk provides a Quickstart guide to show you how to get up and running with CyberArk Conjur and start storing secrets. You can look at that documentation here: Install Conjur OpenSource Using Docker | Open Source OSS Environment. Below, we will follow these steps to setup the demo environment.

First we need to clone down the repo for Conjur to our Docker host:

git clone https://github.com/cyberark/conjur-quickstart.git
Clone down the git repo with cyberark conjur
Clone down the git repo with cyberark conjur

After cloning down the repository you will see the conjur-quickstart folder. Here I have changed into the directory and listing out the contents.

Viewing the conjur quickstark project folder
Viewing the conjur quickstark project folder

Just a quick look at the Docker-compose file, you will see the services defined.

Looking at the cyberark conjur docker compose file services
Looking at the cyberark conjur docker compose file services

Next, we will pull the container images of services defined in the Docker Compose file:

docker-compose pull
Bringing up the cyberark conjur docker compose services
Bringing up the cyberark conjur docker compose services

Now we use the following command to create the master key that will be used to encrypt the database:

docker-compose run --no-deps --rm conjur data-key generate > data_key
Creating the cyberark conjur master key
Creating the cyberark conjur master key

Next, we load the master key as an environment variable:

export CONJUR_DATA_KEY="$(< data_key)"

Then bring up the Docker Compose stack with the command:

docker-compose up -d
Starting the docker compose containers for cyberark conjur
Starting the docker compose containers for cyberark conjur

Now, we create the admin account with the command:

docker-compose exec conjur conjurctl account create myConjurAccount > admin_data

An account named myConjurAccount is created and the admin user is initialized, following keys are created and stored at admin_data file:

  • admin user API key. Later on, we will use this key to log in to Conjur.
  • myConjurAccount Conjur account public key.
Creating keys for cyberark conjur
Creating keys for cyberark conjur

Finally, we connect the client container with the server container. Their documentation mentions this is a one-time action. This will remain connected for the duration of the container’s life or until a different initcommand is issued. You will be prompted to trust the TLS certificate of the Conjur server:

Trust the certificate when connecting client to server for conjur
Trust the certificate when connecting client to server for conjur

Setup and define your policy

Policies define Conjur entities and the relationships between these. Entities in the Conjur world are anything from a policy, host, user, layer, group, or variable. The git project we downloaded contains a sample application policy called BotApp.yml.

First we will login as admin. You will need the API key found in the admin_data file.

docker-compose exec client conjur login -i admin
Logging into cyberark conjur as admin
Logging into cyberark conjur as admin

Now we can load the policy and then log back out:

docker-compose exec client conjur policy load -b root -f policy/BotApp.yml > my_app_data
docker-compose exec client conjur logout

Store the secret

Now that we have the policy loaded, let’s store a secret. You will need the API key in the my_app_data file.

docker-compose exec client conjur login -i Dave@BotApp
Logging in as the botapp
Logging in as the botapp

To verify you are logged in correctly, use the following command:

docker-compose exec client conjur whoami
Verifying your login identity in conjur
Verifying your login identity in conjur

Now we generate a secret value:

secretVal=$(openssl rand -hex 12 | tr -d '\r\n')

Finally, let’s store the secret:

docker-compose exec client conjur variable set -i BotApp/secretVar -v ${secretVal}
Generating and storing a secret
Generating and storing a secret

Run the CyberArk Conjur demo app

Now we need to start a Bash session, generate a Conjur token and then fetch the secret. First login to a Bash session:

docker exec -it bot_app bash

Next, generate a Conjur token. You will need to look at your my_app_data file and get your BotApp API token.

curl -d "<BotApp API Key>" -k https://proxy/authn/myConjurAccount/host%2FBotApp%2FmyDemoApp/authenticate > /tmp/conjur_token

Finally, fetch the secret:

/tmp/program.sh
Generating a token and fetching the secret
Generating a token and fetching the secret

Conjur Server and Conjur Secrets Manager Enterprise

There is also an enterprise version of CyberArk Conjur. The enterprise version provides more features, such as enhanced support and scalability. It also has more integration capabilities. Larger organizations with complex secrets management needs will likely benefit from the additional features found in the paid solution.

Learn more about the paid solution here: Identity Security and Access Management Leader | CyberArk.

Wrapping up

As we have seen in the walkthrough, the CyberArk Conjur open source secrets management solution is easy to get up and running with and can start storing your secrets without much effort. For most basic tasks and use cases, the open source solution will likely provide what is needed for most organizations or if you are looking for a secrets management platform for your home lab. Have you tried CyberArk Conjur open source as of yet? What secrets management solution are you using in your environment?

Subscribe to VirtualizationHowto via Email ๐Ÿ””

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com and has over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, He has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family. Also, he goes through the effort of testing and troubleshooting issues, so you don't have to.

Related Articles

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.