Implement a Logging Solution for HashiCorp Vault

1 hour
  • 3 Learning Objectives

About this Hands-on Lab

As part of this hands-on lab, you will be required to configure HashiCorp logging, and set up log file syncing with a remote server.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Enable HashiCorp Vault Logs
  1. In the Vault Server, retrieve the vault keys.
  2. Unseal the vaults.
  3. Log in with the Initial Root Token.
  4. Enable logs.
  5. Access the logs.
Enable Key-Based SSH Authentication to a Backup Server
  1. In the Vault Server, generate a new key.
  2. Copy the new ssh-rsa key.
  3. In the Client Server, add the key to the authorized_keys file.
  4. Save the file.
  5. Open the sshd_config file.
  6. Enable key-based authentication by uncommenting the PubKeyAuthentication Yes line.
  7. Save the file.
  8. Apply the changes.
Use Rsync to Create Log Backups on the Vault Server
  1. In the Vault Server, make a new directory.

  2. Create a test file in the directory.

  3. Populate the file with generic data.

  4. Using rsync, sync the test file between the two servers.

  5. In the Vault Server, configure a trigger for file sync.

  6. Add the cloud_user to the incron.allow file.

  7. Save the file.

  8. Create a directory on the Client server to hold the logs.

  9. In the Vault Server, update the log permissions.

  10. In the Vault Server, create a new job.

  11. In the new file, paste the following.

  12. In the Vault Server, enable a kv secrets engine.

  13. In the Client server, run the command to test the setup.

    Note: You can find the Vault Server domain by running cat Domain.

  14. Generate a GET request and check if the logs have been synced.

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
  2. Vault keys and root token are located at:
    /home/cloud_user/Keys

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.

Sign In
Welcome Back!

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

Get Started
Who’s going to be learning?