mylamour / blog

Your internal mediocrity is the moment when you lost the faith of being excellent. Just do it.
https://fz.cool
62 stars 14 forks source link

Hashicorp Vault Advanced Tutorial For Enterprise #83

Open mylamour opened 3 years ago

mylamour commented 3 years ago

In this tutorial, I'd like to share something on the principles how to design the architecture for Hashicorp Vault. Not only Infrastructure , but also Crypto and Operation. but I won't show the configuration command. and you can find those in Hashicorp Vault Homepage basically.

Requirements

0x01 Basics

In general, Hashicorp was able to work with API, CLI, and Web UI. I strongly recommend to use CLI for operation, API for application. and web ui has little bugs. you don't want to use that. Basically, we can enable different auth method for each scenario and make sure it has corresponding policy to read/write secret paths. and you can imaging all the resources was a path within Hashicorp Vault.

For Vault enterprise version, you can find the details with this link, and i will have a basic intro.

0x02 Best Practice

Infrastructure

we need to keep the services was supported continuity of business. it most important things for infrastructure part.

As for OS Harden, you can find it in Hashicorp Homepage.

Crypto

First, you need to confirm which algorithms was used. Just kindly reminder, Hashicorp Vault was not support SM algorithms.

Operation

0x03 Scenario

Secret As A Service

As mentioned before, all resources in Hashicorp Vault. you can imagine it is a path. And there was a basic function for different secret engine. in general, KV engine can store any key-value. and it suitable for most scenario.

Service Account Management

It was little bit different with KV Engine. We can use vault to manage IAM Users or Service Account. as you can see in the dashboard, it support to manage the AD Service Account, Azure/Google/Alibaba Cloud IAM users.

Key Management

In fact, we can use KV engine to implement this function, you can keep all credentials or secrets with KV Engine. Besides that, vault provide a Google cloud KMS Engine. also we can use vault as a KMIP Server with KMIP Engine.

Dynamic Secrets

Dynamic secret is necessary for the key point. and I just give two scenario. the first one is to rotate password for all the virtualization host. e.g, we can integrated it with VMware or Other hypervisors. and rotated all the Linux/Windows host password regularly. the second one is to rotate database password. Application can get the temp username and password each time when it try to connect to database. and it will changed automatically after the lease time passed.

Encryption As a Service

Transit engine was included generally , even for open source version. and we can enable different transit engine for different services , also it was able to store & rotate the transit key. and it support version management for the key. in general, application can get the ciphertext after send the plaintext to the transit engine. then can store it to anywhere. here is a simple explanation from Hashicorp learning center.

image

PKI Services

we can use PKI Engine to build a PKI Service simply , and it only have basic function , so I will not intro it here. if you want know to build a Internal CA, you need to use a more professional product, e.g. EJCBA.

0x04 Conclusion

Hashicorp vault is to be satisfied more scenario in most Enterprise. But also it still need to improved in some ways. e.g. Prompt DR Cluster to Primary automatically if the primary cluster was done.

Anyway, It was only some suggestions in architecture design. you need to considered more details to make sure it was tailored. and there would be more difficult in the implement process.

Resources