- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud

Integrating HashiCorp Vault Authentication to a Website
In this lab, we will need to set up a web application and configure it to use HashiCorp vault for authentication, without storing user credentials to a local database.

Lab Info
Table of Contents
-
Challenge
Unseal the Vault and Login with the Root Token
- In the Vault Server, retrieve the vault keys.
- Unseal the vault.
- Log in with the
Initial Root Token
.
-
Challenge
Enable Kv Secrets Engine and Create a Token with a Policy That Allows Access to It
- Enable
kv
secrets engine. - Start
python3.6
. - In the Python Interactive Console, create a hash.
- Copy the hash.
- Write a key-value secret using the email and hash.
- Create a
policy
file namedweb-policy.hcl
, and give itread
permissions. - Write the
policy
. - Create a
token
with the newpolicy
. - Copy the
client_token
- Test out the token.
- Enable
-
Challenge
Install `pip for python3`, the `Django` framework, and Allow the Web Server to Access the App
- Clone the Git repository.
- Install
python3-pip
. - Using
pip3
, install theDjango
framework. - Open the
settings.py
file. - Add the
Web Server
public IP address to theALLOWED_HOSTS
. - Save the file.
- Open the
views.py
file. - In the
get_hashed_vault_creds()
function, change theurl
andhdr
. - Save the file.
- Change to the
HashiCorp-Vault/
directory. - Run the django app.
- Open a web browser, go to 0.0.0.0:8080, and test the login.
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.