3. STORE A SECRET IN CONJUR

4 min.

In this unit you will learn how to store your first secret in Conjur.

Prerequisite

You have completed the following units:

Log in as Dave, the human user. When prompted for a password, copy and paste Dave’s API key stored in the my_app_data file:

docker-compose exec client conjur login -i Dave@BotApp

Verification

To verify that you logged in successfully, run:

docker-compose exec client conjur whoami

The terminal returns:

{"account":"myConjurAccount","username":"Dave@BotApp"}

Generate a value for your application’s secret:

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

This generates a 12-hex-character value.

Store the generated value in Conjur:

docker-compose exec client conjur variable set -i BotApp/secretVar -v ${secretVal}

A policy predefined variable named BotApp/secretVar is set with a random generated secret.

Verification

The terminal returns a message:

Value added.