- installed VirtualBox
- docker & docker-machine binaries
- cfssl & cfssljson binaries
- vault & consul binaries
- curl
- fly
An ideal playground to play with HashiCorp Vault authenticaion methods, secrets backend, etc.
The following advanced topics covered in this repo:
- Docker-Machine & Docker-Containers - how to build and run them
- TLS - how to generate certificates with cfssl and Vault itself, configure TLS communication between components
- Vault Server, Consul Client, Consul Server, OpenLDAP (with phpLDAPadmin & self-service portal), DEX (with static-client & OpenLDAP) configuration
- Concourse CI Server and Workers configuration - its credential manager authenticates in Vault authomatically by using PKI certificate, user will be able to use OIDC or LDAP to authenticate
- OIDC (authenticaion) - using OpenLDAP as a central users directory, roundtrip authentication with OpenLDAP credentials over OIDC
- Identity (both Groups & Entities) - map LDAP groups to Vault identity backend
- LDAP (both authenticaion & secrets) - rotate OpenLDAP secrets and authenticate in Vault or Concourse
- PKI (both authenticaion & secrets) - configure PKI and use it for authentication purposes
- DB (secrets) - rotate database secrets
- KV (secrets) - static secrets
Just follow along from top to bottom:
docker-machine create dex
- create test vm./ca.sh
- generate all required TLS certificates./prep.sh
- prepare all required docker images (build)./run.sh
- run test stack on top of test vmsource ./vault.env
- inject required environment variables (without token)./init.sh
- initialize vault./unseal.sh
- unseal vaultsource ./vault.env
- inject required environment variables (with token)./policy.sh
- write policies./oidc_auth.sh
- configure OIDC authenticaion./entity.sh
- configure identity groups./ldap_auth.sh
- configure LDAP authenticaion./ldap_secrets.sh
- configure LDAP secrets (take a look on dynamically generated credentials for Carl)./kv.sh
- configure KV secrets
./pki_auth.sh
- configure PKI authenticaion & login with cfssl generate certificate./pki_secrets.sh
- configure PKI secrets, generate TLS authenticaion certificate, and login with it (login with Vault generated PKI certificate into Vault)
source ./vault.env
- inject required environment variablesvault login -method=oidc role=oidc-reader
- login with OIDC (and LDAP as identities directory)vault login -method=ldap username=carl
- login with LDAP (by using Carl's dynamically generated credentials)
./run_ci.sh
- start Concourse CI server (login via OpenLDAP, OIDC, or static credentials)./team.sh
- set demo team in Concourse
It will not work without initializing, unsealing and configuring Vault and related authentication services (LDAP, DEX), hence ./run.sh
and all associated scripts must be executed before
./postgres_secrets.sh
- configure database secrets (Postgres)./postgres_roles.sh
- configure database roles (Postgres)
./carl.sh
- an example on how to elevate someone having access to identity backend./uncarl.sh
- take elevated privileges back
source ./consul.env
- inject required environment variablesconsul kv get -keys -recurse vault/core/
- list consul keysconsul kv get vault/core/lock
- read consul key
./dex.sh
- view DEX configuration./login_dex.sh
- retrieve JWT token from DEX./login_dex_public.sh
- retrive JWT token from DEX (if Public Client configured)
./stop.sh
or./stop_ci.sh
- stop test stack./unca.sh
- remove all TLS certificatesdocker-machine rm -f dex
- destroy vm
Please consider reviewing configuration and processes provided in this repository if you are going to use it, e.g. hardcoded secrets, passwords, etc.
Found something interesting and want to reuse it in your own project? Please give proper credits to HashiCorp, Concourse CI, Docker-Containers maintainers, OSS authors, and me Viacheslav :-)
- HashiCorp (Consul & Vault), respective Vault Docker Container and Consul Docker Container
- Concourse CI and respective Concourse CI Container
- DEX and respective Docker Container
- LDAP Self-Service Portal and respective Docker Container
- phpLDAPadmin and respective Docker Container
- OpenLDAP and respective Docker Container
- PostgreSQL and respective Docker Container
- CFSSL