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