Coder Social home page Coder Social logo

renovate-bot / thatsk-_-springboot-vault-examples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thatsk/springboot-vault-examples

0.0 0.0 0.0 255 KB

The goal of this project is play with Vault. For it, we will implement some applications that rely on Vault to store/retrieve secrets. The credentials to access databases are generated dynamically by Vault that uses Consul as backend. AppRole is the Vault authentication method used.

Shell 25.24% Java 74.20% HCL 0.25% Dockerfile 0.31%

thatsk-_-springboot-vault-examples's Introduction

springboot-vault-examples

The goal of this project is play with Vault. For it, we will implement some applications that rely on Vault to store/retrieve secrets. The credentials to access databases are generated dynamically by Vault that uses Consul as backend.

Lease Rotation

One of the problems faced by many people when using Vault is about rotating the lease obtained for some backend databases. When a Spring Boot application requests a lease from Vault using, for instance, the library Spring Cloud Vault, the library itself is able to automatically renew the lease from time to time (default_lease_ttl).

However, when the maximum expiration time of a lease is reached (max_lease_ttl), it means that the lease cannot be renewed anymore, and a new lease is required. In this situation, Spring Cloud Vault library cannot rotate it, leaving the application without connection to database.

In order to solve this problem, I have implemented some solutions for applications that use Spring Cloud Vault or Spring Vault. Please, have a look at the examples below.

Examples

Prerequisites

Start Environment

  • Open one terminal and inside springboot-vault-examples root folder run

    docker-compose up -d
    
  • Wait for Docker containers to be up and running. To check it, run

    docker-compose ps
    
  • Once all containers are up and running, run the script below to unseal Vault and enable AppRole

    ./unseal-vault-enable-approle-databases.sh
    
  • At the end of the script execution, the VAULT_ROOT_TOKEN value will be shown. Export it into every terminal it's needed

    export VAULT_ROOT_TOKEN=...
    

Shutdown

To stop and remove docker-compose containers, network and volumes, go to a terminal and, inside springboot-vault-examples root folder, run the command below

docker-compose down -v

Cleanup

To remove the Docker images created by this project, go to a terminal and, inside springboot-vault-examples root folder, run the following script

./remove-docker-images.sh

References

thatsk-_-springboot-vault-examples's People

Contributors

thatsk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.