Implement HashiCorp Vault Authentication to MariaDB

1 hour
  • 5 Learning Objectives

About this Hands-on Lab

As part of this hands-on lab, we will need to set up and configure a MariaDB server, and create a database. Then, we will need to enable a vault to generate credentials, which will allow a user to access the newly created database.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Unseal the Vault and Log in with the Root Token
  1. Retrieve the vault keys.
  2. Unseal the vault.
  3. Log in with the Initial Root Token.
Install a MariaDB Server and Configure Remote Access
  1. In the Database Server, install mariadb-server and mariadb-client.
    1. Start and enable mariadb.service.
    2. Secure the server.
    3. Test Local Access to the MariaDB server.
    4. Exit the server.
    5. In the Database Server, open the 50-server.cnf file.
    6. Configure remote access.
    7. Restart mariadb.service.
    8. Install net-tools.
    9. Verify the changes.
Create `my_database` and Configure a User for Access
  1. In the Database Server, log in to the database.
  2. Create a new database named, my_database.
  3. Create a table named test_table, and populate it with generic content.
  4. Verify that the table was created successfully.
  5. Create a second table named, another_table.
Grant Vault Access to the Database and Create a User with Access to the `test_table`
  1. In the Vault Server, enable a database secrets engine.
  2. In the Vault Server, grant access to the database.
  3. Create a user with access to the test_table.
  4. Create a policy file with read-only access to the database.
  5. Write the policy.
  6. Create a token with the policy.
  7. Save the token for later use.
Get the Credentials and Test it Out
  1. In the Vault Server, retrieve the Domain name.
  2. In the Client server, install jq.
  3. Install mariadb-client.
  4. Request the credentials and copy the password and username.
  5. From the Client server attempt to authenticate against the database with the newly created credentials.
  6. Access the database.
  7. Fetch the data from test_table.
  8. Attempt to select data from another_table.

Additional Resources

  1. Use dig to get the domain name of the server or open the Domain file:
    dig -x <SERVER PUBLIC IP>
    cat /home/cloud_user/Domain
    1. Vault keys and root token are located at:
      /home/cloud_user/Keys
    2. Git repository:
      https://github.com/ErminLA/HashiCorp-Vault.git

What are Hands-on Labs

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.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!