$ whoamimichael.herman
$ whoamimichael.herman
Software Engineer at ClickFox.
By the end of this talk, you should be able to...
By the end of this talk, you should be able to...
By the end of this talk, you should be able to...
Explain what Vault is and why you may want to use it
Describe the basic Vault architecture along with dynamic and static secrets, the various backends (storage, secret, auth, audit), and how Vault can be used as an "encryption as a service"
By the end of this talk, you should be able to...
Explain what Vault is and why you may want to use it
Describe the basic Vault architecture along with dynamic and static secrets, the various backends (storage, secret, auth, audit), and how Vault can be used as an "encryption as a service"
Spin up Vault with the Filesystem backend
By the end of this talk, you should be able to...
Explain what Vault is and why you may want to use it
Describe the basic Vault architecture along with dynamic and static secrets, the various backends (storage, secret, auth, audit), and how Vault can be used as an "encryption as a service"
Spin up Vault with the Filesystem backend
Init and unseal Vault
By the end of this talk, you should be able to...
Explain what Vault is and why you may want to use it
Describe the basic Vault architecture along with dynamic and static secrets, the various backends (storage, secret, auth, audit), and how Vault can be used as an "encryption as a service"
Spin up Vault with the Filesystem backend
Init and unseal Vault
Authenticate against Vault
By the end of this talk, you should be able to...
Explain what Vault is and why you may want to use it
Describe the basic Vault architecture along with dynamic and static secrets, the various backends (storage, secret, auth, audit), and how Vault can be used as an "encryption as a service"
Spin up Vault with the Filesystem backend
Init and unseal Vault
Authenticate against Vault
Configure an Audit backend
By the end of this talk, you should be able to...
Explain what Vault is and why you may want to use it
Describe the basic Vault architecture along with dynamic and static secrets, the various backends (storage, secret, auth, audit), and how Vault can be used as an "encryption as a service"
Spin up Vault with the Filesystem backend
Init and unseal Vault
Authenticate against Vault
Configure an Audit backend
Work with static and dynamic secrets
By the end of this talk, you should be able to...
Explain what Vault is and why you may want to use it
Describe the basic Vault architecture along with dynamic and static secrets, the various backends (storage, secret, auth, audit), and how Vault can be used as an "encryption as a service"
Spin up Vault with the Filesystem backend
Init and unseal Vault
Authenticate against Vault
Configure an Audit backend
Work with static and dynamic secrets
Use the Transit backend as an "encryption as a service"
Vault is an open-source tool used for securely storing and managing secrets.
Vault is an open-source tool used for securely storing and managing secrets.
Secrets are securely-sensitive or personally identifiable info like database credentials, SSH keys, usernames/passwords, AWS IAM credentials, API tokens, SSNs, credit card numbers.
Vault is an open-source tool used for securely storing and managing secrets.
Secrets are securely-sensitive or personally identifiable info like database credentials, SSH keys, usernames/passwords, AWS IAM credentials, API tokens, SSNs, credit card numbers.
Vault provides answers to the questions on the previous slide and helps to solve the following problems with secret management:
Current problems | Vault's Goals |
---|---|
Secrets are everywhere. | Vault is the single source of truth for all secrets. |
They are generally unencrypted. | Vault manages encryption (during transit and at rest) out of the box. |
It's difficult to dynamically generate them. | Secrets can be dynamically generated. |
It's even more difficult to lease and revoke them. | Secrets can be leased and revoked. |
There's no audit trail. | There's an audit trail for generating and using secrets. |
https://www.vaultproject.io/intro/index.html
Vault has two types of secrets:
Static secrets (think encrypted Redis or Memcached) have refresh intervals but they do not expire unless explicitly revoked. They are defined ahead of time and then shared.
Dynamic secrets have enforced leases and generally expire after a short period of time. Since they don’t exist until they are accessed, there’s less exposure - so dynamic secrets are much more secure.
Vault has two types of secrets:
Static secrets (think encrypted Redis or Memcached) have refresh intervals but they do not expire unless explicitly revoked. They are defined ahead of time and then shared.
Dynamic secrets have enforced leases and generally expire after a short period of time. Since they don’t exist until they are accessed, there’s less exposure - so dynamic secrets are much more secure.
The Transit backend can be used as an "encryption as a service":
Backends are everywhere!
Backend | Use | Examples |
---|---|---|
Storage | Where secrets are stored | Consul, Filesystem* , In-Memory, PostgreSQL, S3 |
Secret | Handles static or dynamic secrets | AWS* , Databases, Key/Value* , RabbitMQ, SSH |
Auth | Handles authentication and authorization | AWS, Azure, Google Cloud, GitHub, Tokens* , Username & Password |
Audit | Logs all requests and responses | File* , Syslog, Socket |
*
used in this presentation
Backends are everywhere!
Backend | Use | Examples |
---|---|---|
Storage | Where secrets are stored | Consul, Filesystem* , In-Memory, PostgreSQL, S3 |
Secret | Handles static or dynamic secrets | AWS* , Databases, Key/Value* , RabbitMQ, SSH |
Auth | Handles authentication and authorization | AWS, Azure, Google Cloud, GitHub, Tokens* , Username & Password |
Audit | Logs all requests and responses | File* , Syslog, Socket |
*
used in this presentation
https://www.vaultproject.io/docs/internals/architecture.html
https://github.com/testdrivenio/vault-consul-docker
├── docker-compose.yml└─ vault ├── Dockerfile ├── config │ └── vault-config.json ├── data ├── logs └── policies └── app-policy.json
https://github.com/testdrivenio/vault-consul-docker
├── docker-compose.yml└─ vault ├── Dockerfile ├── config │ └── vault-config.json ├── data ├── logs └── policies └── app-policy.json
Build the image and run the container:
$ docker-compose up -d --build
https://github.com/testdrivenio/vault-consul-docker
├── docker-compose.yml└─ vault ├── Dockerfile ├── config │ └── vault-config.json ├── data ├── logs └── policies └── app-policy.json
Build the image and run the container:
$ docker-compose up -d --build
Start a bash session within the running container:
$ docker-compose exec vault bash
Vault works with a number of storage backends that are used for storing the secrets - in-memory, files, various SQL and NoSQL databases, Consul, S3, etc.
https://www.vaultproject.io/docs/configuration/storage/index.html
Vault works with a number of storage backends that are used for storing the secrets - in-memory, files, various SQL and NoSQL databases, Consul, S3, etc.
https://www.vaultproject.io/docs/configuration/storage/index.html
To keep things simple, the examples in this presentation use the Filesystem backend:
{ "backend": { "file": { "path": "vault/data" } }, "listener": { "tcp":{ "address": "0.0.0.0:8200", "tls_disable": 1 } }, "ui": true}
Initialize Vault:
$ vault operator init
Take note of the unseal keys and the initial root token. You will need to provide 3 of the unseal keys every time the Vault server is re-sealed.
(Why 3 keys? https://en.wikipedia.org/wiki/Shamir's_Secret_Sharing)
Initialize Vault:
$ vault operator init
Take note of the unseal keys and the initial root token. You will need to provide 3 of the unseal keys every time the Vault server is re-sealed.
(Why 3 keys? https://en.wikipedia.org/wiki/Shamir's_Secret_Sharing)
Now you can unseal the Vault using 3 of the keys:
$ vault operator unseal
Authenticate:
$ vault loginToken (will be hidden):
This uses the root policy. In production you'll want to set up policies with different levels of access.
https://www.vaultproject.io/docs/concepts/policies.html
Before we test out the functionality, let’s enable an Audit Device:
$ vault audit enable file file_path=/vault/logs/audit.logSuccess! Enabled the file audit device at: file/
Before we test out the functionality, let’s enable an Audit Device:
$ vault audit enable file file_path=/vault/logs/audit.logSuccess! Enabled the file audit device at: file/
To test, run the following command to view all enabled Audit Devices:
$ vault audit listPath Type Description---- ---- -----------file/ file n/a
This request should be logged in vault/logs/audit.log.
Vault can be managed through the CLI, HTTP API, or UI.
https://www.vaultproject.io/docs/secrets/kv/index.html
Create:
$ vault kv put secret/foo bar=preciousSuccess! Data written to: secret/foo
Read:
$ vault kv get secret/foo
Delete:
$ vault kv delete secret/foo
Vault can be managed through the CLI, HTTP API, or UI.
https://www.vaultproject.io/docs/secrets/kv/index.html
Create:
$ vault kv put secret/foo bar=preciousSuccess! Data written to: secret/foo
Read:
$ vault kv get secret/foo
Delete:
$ vault kv delete secret/foo
Take note of the audit log. Each of the above requests were logged!
Vault supports a number of dynamic secret backends for generating secrets dynamically when needed.
For example, with the AWS and Google Cloud backends, you can create access credentials based on IAM policies. The databases backend, meanwhile, generates database credentials based on configured roles.
Vault supports a number of dynamic secret backends for generating secrets dynamically when needed.
For example, with the AWS and Google Cloud backends, you can create access credentials based on IAM policies. The databases backend, meanwhile, generates database credentials based on configured roles.
Dynamic Secrets:
Enable:
$ vault secrets enable -path=aws awsSuccess! Enabled the aws secrets engine at: aws/
Authenticate:
$ vault write aws/config/root access_key=foo secret_key=barSuccess! Data written to: aws/config/root
Create role and credentials:
$ vault write aws/roles/ec2-read \ arn=arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess$ vault read aws/creds/ec2-read
Enable:
$ vault secrets enable -path=aws awsSuccess! Enabled the aws secrets engine at: aws/
Authenticate:
$ vault write aws/config/root access_key=foo secret_key=barSuccess! Data written to: aws/config/root
Create role and credentials:
$ vault write aws/roles/ec2-read \ arn=arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess$ vault read aws/creds/ec2-read
Secrets are generated when they are requested (i.e., a web app requests access to S3). They are not available in the store before this.
https://www.vaultproject.io/intro/getting-started/dynamic-secrets.html
Enable transit:
$ vault secrets enable transitSuccess! Enabled the transit secrets engine at: transit/
Enable transit:
$ vault secrets enable transitSuccess! Enabled the transit secrets engine at: transit/
Configure named encryption key:
$ vault write -f transit/keys/fooSuccess! Data written to: transit/keys/foo
Enable transit:
$ vault secrets enable transitSuccess! Enabled the transit secrets engine at: transit/
Configure named encryption key:
$ vault write -f transit/keys/fooSuccess! Data written to: transit/keys/foo
Encrypt and decrypt:
$ vault write transit/encrypt/foo plaintext=$(base64 <<< "my precious")Key Value--- -----ciphertext vault:v1:/Tun95IT+dVTvDfYiCHdI5rGPSAxgvPcFaDDtneRorQCyBOgv9mPKw==$ vault write transit/decrypt/foo ciphertext=vault:v1:/Tun95IT+dVTvDfYiCHdI5rGPSAxgvPcFaDDtneRorQCyBOgv9mPKw==Key Value--- -----plaintext bXkgcHJlY2lvdXMK$ base64 -d <<< "bXkgcHJlY2lvdXMK"my precious
What's next?
What's next?
What's next?
What's next?
✌️
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |