<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jake Lundberg on Medium]]></title>
        <description><![CDATA[Stories by Jake Lundberg on Medium]]></description>
        <link>https://medium.com/@grove_mountain?source=rss-3dd808128d1f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pATGiy_3WzdxZiHf9ouiJg.jpeg</url>
            <title>Stories by Jake Lundberg on Medium</title>
            <link>https://medium.com/@grove_mountain?source=rss-3dd808128d1f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 22:07:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@grove_mountain/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Essential Patterns of Vault — Part 2]]></title>
            <link>https://medium.com/hashicorp-engineering/essential-patterns-of-vault-part-2-b4d34976f1dc?source=rss-3dd808128d1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4d34976f1dc</guid>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[vault]]></category>
            <category><![CDATA[hashicorp-vault]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Jake Lundberg]]></dc:creator>
            <pubDate>Sun, 28 Jul 2019 15:15:06 GMT</pubDate>
            <atom:updated>2019-08-04T23:16:00.742Z</atom:updated>
            <content:encoded><![CDATA[<h3>Essential Patterns of Vault — Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4D7fxVyQA7KS3ftbM4VEg.png" /></figure><p>In <a href="https://medium.com/hashicorp-engineering/essential-elements-of-vault-part-1-5a64d3de3be8">Part 1</a> of this series, I laid out the abstract <em>Essential Patterns of Vault</em>. In this part, we’ll dive deep into piloting a Vault solution using those patterns. WARNING: This is a long blog post, I promise it will be worth it.</p><p>All prerequisites and code examples can be found in this repo: <a href="https://github.com/grove-mountain/vault_essential_patterns_blog.git">Code examples used for the Essential Patterns of Vault — Pt 2</a>. All commands used for this blog are done from a checkout of this repo.</p><pre>git clone <a href="https://github.com/grove-mountain/vault_essential_patterns_blog.git">https://github.com/grove-mountain/vault_essential_patterns_blog.git</a></pre><pre>cd vault_essential_patterns_blog/</pre><p>However, not all commands contained in the scripts are displayed here to save space. Reference or run the scripts for more detailed runs.</p><p>For non-Mac users, you can follow along if you install <a href="https://www.vagrantup.com/">Vagrant</a> and a supported Virtual Machine software suite like <a href="https://www.virtualbox.org/">VirtualBox</a> . See the instructions in the repo.</p><p>You can run the entire demo for this blog post using two scripts in two terminal windows.</p><p><strong>Window 1</strong></p><pre>./0_launch_vault.sh</pre><p><strong>Window 2</strong></p><pre>./run_all.sh</pre><p>You need to hit &lt;enter&gt; or &lt;return&gt; after each command to go to the next one.</p><h3><strong>Scenario</strong></h3><p>OurCorp is a business designed by us, for us. Like any business, we have a need to securely store data and prevent unauthorized access to company or customer information. We’ve chosen HashiCorp Vault because it provides the most flexible platform for doing secrets management across operating environments.</p><p>The business units most interested in using Vault are below and listed out some of their basic needs.</p><h4><strong>Engineering</strong></h4><ul><li>Needs to store static passwords for Create application</li><li>Needs SSH access to compute cluster nodes</li><li>Needs to store catalog data in the Mother DB engineering schema</li></ul><p><strong>Finance</strong></p><ul><li>Needs to store passwords for application Fine Nancy</li><li>Needs read/write access to mother DB finance schema</li></ul><p><strong>HR</strong></p><ul><li>Needs to securely store PII data encrypted in hr schema</li><li>Needs read/write access to mother DB hr schema</li></ul><p><strong>IT</strong></p><ul><li>Needs to store systems passwords</li><li>Needs SSH key management</li><li>Needs read/write access to mother it schema</li></ul><p><strong>Security</strong></p><ul><li>Needs to store security passwords</li><li>Needs read access to all databases and schemas to scan for unprotected data</li></ul><p>For this pilot program, we’re going to focus on four objectives for three business units:</p><ul><li>Authenticate all users with LDAP</li><li>Store static passwords for IT Systems in KV V2 Secret Engine</li><li>Provide Dynamic DB credentials for Engineering applications</li><li>Store Encrypted PII data for HR using Dynamic DB credentials and Transit</li></ul><p>Reflecting back to Part 1, we recall the Essential Patterns of Vault, but made specific to this use case:</p><ol><li>Be familiar with the documentation for KV V2, Transit and Dynamic Postgres secret engines as well as LDAP Authentication Methods and basic policy management</li><li>Enable/Configure KV V2, Transit and Dynamic Database Secret Engines</li><li>Enable LDAP Authentication Method</li><li>Define and create policies to access specific paths within each secret engine</li><li>Map policies to LDAP authentication method</li><li>Do positive and negative policy tests</li></ol><h3><strong>Documentation</strong></h3><p>Let’s start by listing out the documentation that can help us here. While this isn’t meant to be exhaustive, it’s a good list of first-level docs we can use to both understand what we’re doing, as well as assist with crafting the commands to implement our solution. Remember, the HTTP API docs have all parameters available per endpoint as well as return values from Vault.</p><p><strong>Vault Dev Server</strong></p><p><a href="https://www.vaultproject.io/docs/concepts/dev-server.html">Dev Server Mode</a></p><p><a href="https://www.vaultproject.io/docs/commands/server.html#dev-options">vault server — Command</a></p><p><strong>KV V2 Secret Engine</strong></p><p><a href="https://learn.hashicorp.com/vault/secrets-management/sm-versioned-kv">Versioned Key/Value Secret Engine — Learn</a></p><p><a href="https://www.vaultproject.io/docs/secrets/kv/kv-v2.html">KV — Secrets Engines</a></p><p><a href="https://www.vaultproject.io/api/secret/kv/kv-v2.html">KV — Secrets Engines — HTTP API</a></p><p><strong>Dynamic Database &amp; Postgres Secret Engine</strong></p><p><a href="https://learn.hashicorp.com/vault/developer/sm-dynamic-secrets">Secrets as a Service: Dynamic Secrets | Learn</a></p><p><a href="https://www.vaultproject.io/docs/secrets/databases/index.html">Database — Secrets Engines</a></p><p><a href="https://www.vaultproject.io/api/secret/databases/index.html">Database — Secrets Engines — HTTP API</a></p><p><a href="https://www.vaultproject.io/docs/secrets/databases/postgresql.html">PostgreSQL — Database — Secrets Engines</a></p><p><a href="https://www.vaultproject.io/api/secret/databases/postgresql.html">PostgreSQL — Database — Secrets Engines — HTTP API</a></p><p><strong>Transit Secret Engine</strong></p><p><a href="https://learn.hashicorp.com/vault/encryption-as-a-service/eaas-transit">Encryption as a Service: Transit Secrets Engine — Learn</a></p><p><a href="https://www.vaultproject.io/docs/secrets/transit/index.html">Transit — Secrets Engines</a></p><p><a href="https://www.vaultproject.io/api/secret/transit/index.html">Transit — Secrets Engines — HTTP API</a></p><p><strong>LDAP Authentication Method</strong></p><p><a href="https://www.vaultproject.io/docs/auth/ldap.html">LDAP — Auth Methods</a></p><p><a href="https://www.vaultproject.io/api/auth/ldap/index.html">LDAP — Auth Methods — HTTP API</a></p><p><strong>Policy Information</strong></p><p><a href="https://learn.hashicorp.com/vault/identity-access-management/iam-policies">Policies | Learn</a></p><p><a href="https://www.vaultproject.io/docs/concepts/policies.html">Policies</a></p><p>Now that we have our docs open or at least ready to be opened, let’s get to work!</p><h3><strong>Local Development Environments</strong></h3><p>As discussed in <a href="https://medium.com/hashicorp-engineering/essential-elements-of-vault-part-1-5a64d3de3be8">Part 1</a>, running local dev environments makes it possible to create throw-away systems to test out new capabilities and to speed up development of automation.</p><p>WARNING: All of the passwords below are very insecure (and published on the internet). Remember DO NOT RUN THIS EXACT DEMO IN PRODUCTION.</p><p>NOTE: I have run into issues on-site with certain customers where ports were blocked due to firewall rules. If you’re having connection issues with one of the tools here, try binding to loopback addresses.</p><p><strong>Demo Magic</strong></p><p>When doing demos for customers, I always use a slightly modified version of <a href="https://github.com/paxtonhare/demo-magic">demo-magic</a> (included in the repo). This allows me to script out runs in a predictable and reproducible manner to help reduce human error around copy pasta or typing and to output the commands being run. All of the commands given below are wrapped into numbered scripts that can be run in order to accomplish all the tasks here.</p><p><strong>Vault</strong></p><p>I’m using a specific IP address to allow communication with other processes that might connect over TCP/IP like Vagrant hosts or non-bridged containers. If you’re only working with Vault, you can probably just use the loopback address. Use the right function for getting your IP_ADDRESS for your system, or just set it manually.</p><pre>export IP_ADDRESS=$(ipconfig getifaddr en0)<br>export VAULT_ADDR=&quot;http://${IP_ADDRESS}:8200&quot;<br>export VAULT_TOKEN=${VAULT_ROOT_TOKEN:-&quot;notsosecure&quot;}</pre><pre># Dev server environment variables<br>export VAULT_DEV_LISTEN_ADDRESS=&quot;${IP_ADDRESS}:8200&quot;<br>export VAULT_DEV_ROOT_TOKEN_ID=${VAULT_TOKEN}</pre><pre>vault server -dev</pre><p>Make sure to carry IP_ADDRESS, VAULT_ADDR and VAULT_TOKEN into any other terminal windows you’re using as you’ll need them for your connections to Vault and other scripts. Sourcing env.sh will set these for you. If you need to start over, just ctrl-c and re-run vault server -dev</p><p>You can also just run</p><pre>./0_launch_vault.sh</pre><p><strong>Postgres Server</strong></p><p>Since we will be working with Dynamic Database credentials, we’ll need a database. I like to use the official <a href="https://hub.docker.com/_/postgres">Docker Hub Postgres Image</a>.</p><pre>./1_launch_db.sh</pre><p><strong>LDAP Server</strong></p><p>This particular LDAP server allows for customization of an LDAP tree (the default will work just fine, however). It comes with MemberOf overlay enabled and the default setup populates these entries in user records.</p><pre>./2_launch_ldap.sh</pre><p>See <a href="https://github.com/grove-mountain/docker-ldap-server">Dockerized OpenLDAP server with quick setup examples</a> for instructions on creating your own customized LDAP trees.</p><h3><strong>Enable and Configure Secret Engines</strong></h3><p>The first step is to enable and configure secret engines. To highlight some features of secret engines, we’ll be using non-standard paths. We’ll also do them one at a time so as not to confuse configuration between sections</p><p><strong>KV V2</strong></p><pre>./3_enable_kv.sh</pre><pre>vault secrets enable -path=kv-blog -version=2 kv</pre><p>KV is pretty simple, so for now, that’s it. We’ll put data in there later.</p><p><strong>Dynamic Database</strong></p><pre>./4_enable_db.sh</pre><p>Dynamic DB is a bit more involved. Enabling is similar:</p><pre>vault secrets enable -path=db-blog database</pre><p>Configuring the database engine requires us to have access as some form of administrator to the database we are going to broker secrets for. Using parameters also allows us to rotate the admin credentials later so only Vault knows them going forward.</p><pre>vault write db-blog/config/mother \<br>  plugin_name=postgresql-database-plugin \<br>  allowed_roles=* \<br>  connection_url=&quot;postgresql://{{username}}:{{password}}@10.0.2.15:5432/mother?sslmode=disable&quot;username=&quot;vault_admin&quot; \<br>password=&quot;notsosecure&quot;</pre><p>Once we’ve configured an admin user, we can now start creating role mappings inside of Vault. In this case, we’re granting full access to the HR schema for 1 minute for anyone that can access the db-blog/roles/mother-hr-full-1m endpoint. We’ll talk about giving access shortly. Notice the placeholder template variables for name, password, and expiration. Vault will fill in these values during run time and return the credentials to you.</p><pre>vault write db-blog/roles/mother-hr-full-1m \<br>db_name=mother \<br>creation_statements=&quot;CREATE ROLE &quot;{{name}}&quot; WITH LOGIN PASSWORD ‘{{password}}’ VALID UNTIL ‘{{expiration}}’; GRANT USAGE ON SCHEMA hr TO &quot;{{name}}&quot;; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA hr TO &quot;{{name}}&quot;;&quot; \<br>default_ttl=1m \<br>max_ttl=24h</pre><p>Here is the root credential rotation command. We won’t be using it during this demo, but it’s handy to know that it’s there. This can give you some peace of mind when having to have a human provide the initial set of credentials to Vault in that once rotated, only Vault knows the credentials.</p><pre># vault write -force db-blog/rotate-root/mother</pre><p><strong>Transit</strong></p><pre>./5_enable_transit.sh</pre><p>Next, we’ll enable Transit which is Vault’s Encryption as a Service engine. We’ll also create a key for the HR team to encrypt/decrypt their data.</p><pre>vault secrets enable -path=transit-blog transit<br>vault write -f transit-blog/keys/hr</pre><h3><strong>Enable Authentication Methods</strong></h3><p><strong>LDAP</strong></p><pre>./6_enable_ldap_auth.sh</pre><p>First, we will enable ldap at two paths. This allows us to customize the group filtering mechanism to return different types of LDAP group lookups. In this case, we’ll look for either “uniqueMember” records or “memberOf” records.</p><p>NOTE: The Distinguished Name (DN) is the unique identifier for LDAP/AD records. Try to use this to link up records as much as possible.</p><p>“uniqueMember” attributes belong to an LDAP class: “groupOfUniqueNames” which in this LDAP directory are mapped under “ou=um_group,dc=ourcorp,dc=com”. We’ll match the DN of the user who is authenticating with Vault to any groups the user belongs to. In large LDAP/AD directories, these searches can be slower than looking up directly in a user’s attributes like with the memberOf overlay.</p><pre>vault auth enable -path=ldap-um ldap</pre><pre>vault write auth/ldap-um/config \<br>  url=&quot;ldap://10.0.2.15&quot; \<br>  binddn=&quot;cn=read-only,dc=ourcorp,dc=com&quot; \<br>  bindpass=”devsecopsFTW” \<br>  userdn=”ou=people,dc=ourcorp,dc=com” \<br>  userattr=”cn” \<br>  groupdn=”ou=um_group,dc=ourcorp,dc=com”<br>  groupfilter=”(&amp;(objectClass=groupOfUniqueNames)(uniqueMember={{.UserDN}}))” \<br>  groupattr=”cn” \<br>  insecure_tls=true</pre><p>“memberOf” is an operational attribute that belongs to the “person” objectClass. The current user will have one memberOf entry for any LDAP attribute whose value is equal to the user’s DN. These lookups are generally much faster.</p><p>e.g.</p><p>Group attribute/Distinguished Name mapping:</p><p>“uniqueMember=cn=alice,ou=people,dc=ourcorp,dc=com” exists in groups</p><ul><li>DN: cn=founders,ou=um_group,dc=ourcorp,dc=com</li><li>DN: cn=finance,ou=um_group,dc=ourcorp,dc=com</li></ul><p>So user record:</p><p>DN: cn=alice,ou=people,dc=ourcorp,dc=com</p><p>Will have the following entries</p><ul><li>memberOf: cn=founders,ou=um_group,dc=ourcorp,dc=com</li><li>memberOf: cn=finance,ou=um_group,dc=ourcorp,dc=com</li></ul><p>Enable and configure LDAP for memberOf support.</p><pre>vault auth enable -path=ldap-mo ldap<br>vault write auth/ldap-mo/config \<br>  url=”ldap://10.0.2.15&quot; \<br>  binddn=”cn=read-only,dc=ourcorp,dc=com” \<br>  bindpass=”devsecopsFTW” \<br>  userdn=”ou=people,dc=ourcorp,dc=com” \<br>  userattr=”cn” \<br>  groupdn=”ou=people,dc=ourcorp,dc=com” \<br>  groupfilter=”(&amp;(objectClass=person)(uid={{.Username}}))” \<br>  groupattr=”memberOf” \<br>  insecure_tls=true</pre><h3><strong>Define and Create Policies</strong></h3><pre>./7_generate_dynamic_policy.sh</pre><pre>./8_create_policies.sh</pre><p>Policies allow access to paths within Vault. By default, a token has no access until granted by some kind of association with a set of policies.</p><p>Some example policies (see the policies/ directory for the complete policies).</p><p>This is a KV V2 policy fragment from policies/kv-it-policy.hcl. It’s giving full rights to the secrets in the kv-blog/it path in Vault. “Data” and “delete” paths here are operation paths for the KV V2 engine and need to be expressed directly. Refer to the KV V2 documentation.</p><pre># Allow full access to the current version of the kv-blog<br>path “kv-blog/data/it” {<br>  capabilities = [“read”, “list”]<br>}</pre><pre>path “kv-blog/data/it/*” {<br>  capabilities = [“create”, “read”, “update”, “delete”, “list”]<br>}</pre><pre># Allow deletion of any kv-blog version<br>path “kv-blog/delete/it/*” {<br>  capabilities = [“update”]<br>}</pre><p>To add this policy with name “kv-it”:</p><pre>vault policy write kv-it policies/kv-it-policy.hcl</pre><p>This is a policy granting access to Transit operations for HR.</p><pre>path &quot;transit-blog/keys/hr&quot; {<br>  capabilities = [ &quot;read&quot; ]<br>}</pre><pre>path &quot;transit-blog/encrypt/hr&quot; {<br>  capabilities = [ &quot;create&quot;, &quot;read&quot;, &quot;update&quot; ]<br>}</pre><pre>path &quot;transit-blog/decrypt/hr&quot; {<br>  capabilities = [ &quot;create&quot;, &quot;read&quot;, &quot;update&quot; ]<br>}</pre><p>To add this policy with name “transit-hr”:</p><pre>vault policy write transit-hr policies/transit-hr-policy.hcl</pre><p><strong>ACL Templated Policies</strong></p><p>ACL templating provides an extremely powerful method of writing one policy and providing least privilege to common path patterns like user name or group name. I won’t spend much time on it in this blog as it’s probably worth a whole post on its own (which I’m likely to do), but it’s worth pointing out, as policy creation/management can be far more cumbersome without it.</p><p>An example policy fragment:</p><pre>path &quot;kv/data/{{identity.entity.aliases.auth_ldap_741c3dba.name}}/*&quot;<br>{<br>  capabilities = [&quot;create&quot;, &quot;read&quot;, &quot;update&quot;, &quot;delete&quot;, &quot;list&quot;]<br>}</pre><p>This particular policy allows any user to manage secrets under kv/data/$(LDAP_USERNAME). Notice the mount accessor identifier in the policy template. This means that when creating ACL templated policies, you have to do so after mounting your Authentication Methods. See 7_generate_dynamic_policy.sh for an example of how to do this.</p><h3><strong>Map policies to Authentication Methods</strong></h3><pre>./9_associate_policies.sh</pre><p>Once policies are written, they can be mapped to as many groups as needed. Authentication Methods usually have a concept of roles or groups to map to policies. For the LDAP Auth Method, you map policies to groups.</p><pre>vault write auth/ldap-um/groups/it policies=kv-it,kv-user-template</pre><pre>vault write auth/ldap-mo/groups/cn=hr,ou=um_group,dc=ourcorp,dc=com policies=db-hr,transit-hr,kv-user-template</pre><p>Notice the difference between the two records? One is a uniqueMember lookup while the other is a memberOf lookup. While memberOf group names are longer, they are also unique because they reference the full DN, not just an alias name.</p><h3><strong>Do Positive and Negative testing</strong></h3><p><strong>IT KV V2 Tests</strong></p><p>The IT group needs to test storing K/V entries for their sensitive data. They will use LDAP UniqueMember groups to assign policies.</p><pre>./test_it.sh</pre><p>First login to Vault after unsetting any previously set VAULT_TOKEN. Notice the policies this user gets.</p><pre>unset VAULT_TOKEN<br>vault login -method=ldap -path=ldap-um \<br>  username=deepak password=thispasswordsucks</pre><pre>Success! You are now authenticated. The token information displayed below<br>is already stored in the token helper. You do NOT need to run &quot;vault login&quot;<br>again. Future Vault requests will automatically use this token.</pre><pre>Key                    Value<br>---                    -----<br>token                  s.ToxyzTBfZIPfhEqZmMlnQQfK<br>token_accessor         yWTwODsTNmla9WDhRL7GNqDy<br>token_duration         768h<br>token_renewable        true<br>token_policies         [&quot;default&quot; &quot;kv-it&quot; &quot;kv-user-template&quot;]<br>identity_policies      []<br>policies               [&quot;default&quot; &quot;kv-it&quot; &quot;kv-user-template&quot;]<br>token_meta_username    deepak</pre><p>Test KV Writes/Reads to allowed paths.</p><pre># Writes<br>vault kv put kv-blog/it/servers/hr/root password=rootntootn</pre><pre>Key              Value<br>---              -----<br>created_time     2019-07-24T06:07:07.567289Z<br>deletion_time    n/a<br>destroyed        false<br>version          1</pre><pre>vault kv put kv-blog/it/routers/snmp/read-write password=snortymcsnortyton</pre><pre>Key              Value<br>---              -----<br>created_time     2019-07-24T06:07:08.008134Z<br>deletion_time    n/a<br>destroyed        false<br>version          1</pre><pre># Reads</pre><pre>vault kv get kv-blog/it/servers/hr/root</pre><pre>====== Metadata ======<br>Key              Value<br>---              -----<br>created_time     2019-07-24T06:07:07.567289Z<br>deletion_time    n/a<br>destroyed        false<br>version          1</pre><pre>====== Data ======<br>Key         Value<br>---         -----<br>password    rootntootn</pre><pre>vault kv get kv-blog/it/routers/snmp/read-write</pre><pre>====== Metadata ======<br>Key              Value<br>---              -----<br>created_time     2019-07-24T06:07:08.008134Z<br>deletion_time    n/a<br>destroyed        false<br>version          1</pre><pre>====== Data ======<br>Key         Value<br>---         -----<br>password    snortymcsnortyton</pre><p>Try KV puts to paths outside the current policy set.</p><pre><br>vault kv put kv-blog/hr/servers/hr/root password=rootntootn</pre><pre>Error writing data to kv-blog/data/hr/servers/hr/root: Error making API request.</pre><pre>URL: PUT <a href="http://10.4.2.120:8200/v1/kv-blog/data/hr/servers/hr/root">http://10.4.2.120:8200/v1/kv-blog/data/hr/servers/hr/root</a><br>Code: 403. Errors:</pre><pre>* 1 error occurred:<br> * permission denied</pre><pre>vault kv put kv-blog/hr/routers/snmp/read-write password=snortymcsnortyton</pre><pre>Error writing data to kv-blog/data/hr/routers/snmp/read-write: Error making API request.</pre><pre>URL: PUT <a href="http://10.4.2.120:8200/v1/kv-blog/data/hr/routers/snmp/read-write">http://10.4.2.120:8200/v1/kv-blog/data/hr/routers/snmp/read-write</a><br>Code: 403. Errors:</pre><pre>* 1 error occurred:<br> * permission denied</pre><pre># Test access to database endpoints</pre><pre>[jake@Joi] vault read db-blog/creds/mother-full-read-1m</pre><pre>Error reading db-blog/creds/mother-full-read-1m: Error making API request.</pre><pre>URL: GET <a href="http://10.4.2.120:8200/v1/db-blog/creds/mother-full-read-1m">http://10.4.2.120:8200/v1/db-blog/creds/mother-full-read-1m</a><br>Code: 403. Errors:</pre><pre>* 1 error occurred:<br> * permission denied</pre><p>The assigned policies only allow access to “kv-blog/it”, not “kv-blog/hr”. Sure, HR probably doesn’t manage SNMP passwords, but it’s worth pointing out fun with copy pasta.</p><p><strong>Engineering Dynamic DB tests</strong></p><p>Then, the engineering group wants to test Dynamic DB credentials to access database tables in their schema. They will use LDAP memberOf records for policy mapping defined above.</p><pre>./test_engineering.sh</pre><p>Login with the LDAP memberOf Auth Method. Notice the policies this user gets.</p><pre>unset VAULT_TOKEN<br>vault login -method=ldap -path=ldap-mo \<br>  username=chun password=thispasswordsucks</pre><pre>Success! You are now authenticated. The token information displayed below<br>is already stored in the token helper. You do NOT need to run &quot;vault login&quot;<br>again. Future Vault requests will automatically use this token.</pre><pre>Key                    Value<br>---                    -----<br>token                  s.ba4u6V6Nouqo30CQruMJIzfU<br>token_accessor         sqrtrXQNLEV8svmuMfkvxkHA<br>token_duration         768h<br>token_renewable        true<br>token_policies         [&quot;db-engineering&quot; &quot;default&quot; &quot;kv-user-template&quot;]<br>identity_policies      []<br>policies               [&quot;db-engineering&quot; &quot;default&quot; &quot;kv-user-template&quot;]<br>token_meta_username    chun</pre><p>Read out the dynamic DB credentials and store them as variables.</p><p>Getting dynamic DB credentials from Vault. There are more elegant ways of doing this, but OSX doesn&#39;t support process substitution in its version of Bash, so working around (e.g. source &lt;(cmd))</p><pre>vault read -format=json db-blog/creds/mother-engineering-full-1h | jq -r &#39;.data | .[&quot;PGUSER&quot;] = .username | .[&quot;PGPASSWORD&quot;] = .password | del(.username, .password) | to_entries | .[] | .key + &quot;=&quot; + .value &#39; &gt; .temp_db_creds</pre><pre>. .temp_db_creds &amp;&amp; rm .temp_db_creds</pre><pre># By setting the postgres environment variables to the dynamic creds, we can run PSQL with those dynamic creds</pre><pre>echo &quot;PGUSER=${PGUSER} PGPASSWORD=${PGPASSWORD}&quot;<br>PGUSER=v-ldap-mo--mother-e-kui61Hgausx3bGfkgmk9-1563953366 PGPASSWORD=A1a-SWC5X7favH4xZs4F</pre><pre><br>QUERY=&#39;select name,description from engineering.catalog;&#39;<br>psql</pre><pre>name               |                description<br>-------------------+-------------------------------------------<br> Thromdibulator    | Complex machine, do not disassemble<br> Visi-Sonor        | Musical instrument with visualizations<br> Deep Thought      | Super Computer<br> Mithril Vest      | Very Good Armor (TM)<br> Blaine the Mono   | Psychopathic train, enjoys proper riddles<br> Millennium Falcon | Fastest Hunk-of-Junk in the Galaxy<br> Sonic Screwdriver | Multi-tool<br>(7 rows)</pre><p><strong>Negative Tests</strong></p><pre># Can these DB credentials query other schema/tables?</pre><pre>QUERY=&#39;select * from hr.people;&#39;<br>psql</pre><pre>ERROR:  permission denied for schema hr<br>LINE 1: select * from hr.people;<br>                      ^</pre><pre># Can the Vault token read from other areas?</pre><pre>vault read db-blog/creds/mother-full-read-1h</pre><pre>Error reading db-blog/creds/mother-full-read-1h: Error making API request.</pre><pre>URL: GET <a href="http://10.4.2.120:8200/v1/db-blog/creds/mother-full-read-1h">http://10.4.2.120:8200/v1/db-blog/creds/mother-full-read-1h</a><br>Code: 403. Errors:</pre><pre>* 1 error occurred:<br> * permission denied</pre><pre>vault kv get kv-blog/it/servers/hr/root</pre><pre>Error reading kv-blog/data/it/servers/hr/root: Error making API request.</pre><pre>URL: GET <a href="http://10.4.2.120:8200/v1/kv-blog/data/it/servers/hr/root">http://10.4.2.120:8200/v1/kv-blog/data/it/servers/hr/root</a><br>Code: 403. Errors:</pre><pre>* 1 error occurred:<br> * permission denied</pre><p><strong>HR Dynamic DB and transit tests</strong></p><pre>./test_hr.sh</pre><p>This section brings up another kind of pattern in Vault, the Dynamic DB/Transit Pattern. Here, a user or application gets short-lived dynamic DB credentials from Vault and then use the Transit Encryption as a Service engine to encrypt plaintext values to store encrypted at rest. They will use LDAP memberOf records for policy mapping defined above.</p><p>Login to Vault as user Frank who belongs to the HR group. Notice the policies assigned.</p><pre>unset VAULT_TOKEN<br>vault login -method=ldap -path=ldap-mo \<br>  username=frank password=thispasswordsucks</pre><pre>Success! You are now authenticated. The token information displayed below<br>is already stored in the token helper. You do NOT need to run &quot;vault login&quot;<br>again. Future Vault requests will automatically use this token.</pre><pre>Key                    Value<br>---                    -----<br>token                  s.hu0rvRRPjzTUtpf1KrhWnhtF<br>token_accessor         Is1vmEgna68eCZO13iWq3mdg<br>token_duration         768h<br>token_renewable        true<br>token_policies         [&quot;db-hr&quot; &quot;default&quot; &quot;kv-user-template&quot; &quot;transit-hr&quot;]<br>identity_policies      []<br>policies               [&quot;db-hr&quot; &quot;default&quot; &quot;kv-user-template&quot; &quot;transit-hr&quot;]<br>token_meta_username    frank</pre><p>Read in a set of Dynamic DB credentials and set them as Postgres environment variables. See disclaimer about technique above.</p><pre>vault read -format=json db-blog/creds/mother-hr-full-1h | jq -r &#39;.data | .[&quot;PGUSER&quot;] = .username | .[&quot;PGPASSWORD&quot;] = .password | del(.username, .password) | to_entries | .[] | .key + &quot;=&quot; + .value &#39; &gt; .temp_db_creds</pre><pre>. .temp_db_creds &amp;&amp; rm .temp_db_creds</pre><pre># By setting the postgres environment variables to the dynamic creds, we can run PSQL with those dynamic creds</pre><pre>echo &quot;PGUSER=${PGUSER} PGPASSWORD=${PGPASSWORD}&quot;</pre><pre>PGUSER=v-ldap-mo--mother-h-Orz3oe2jQLJLn4VbMh3l-1563997339 PGPASSWORD=A1a-34ANtkBsN6CcSHP5</pre><p>Next, we’ll retrieve some un-encrypted values, encrypt them and rewrite them encrypted back into the database.</p><pre>QUERY=&#39;select email,id from hr.people;&#39;<br>psql</pre><pre>email        |         id<br>--------------------+--------------------<br> <a href="/service/mailto:alice@ourcorp.com">alice@ourcorp.com</a>  | 123-45-6789<br> <a href="/service/mailto:bob@ourcorp.com">bob@ourcorp.com</a>    | 234-56-7890<br> <a href="/service/mailto:chun@ourcorp.com">chun@ourcorp.com</a>   | 350322197001015332<br> <a href="/service/mailto:deepak@ourcorp.com">deepak@ourcorp.com</a> | 0123 4567 8901<br> <a href="/service/mailto:eve@ourcorp.com">eve@ourcorp.com</a>    | AB 12 34 56 Z<br> <a href="/service/mailto:frank@ourcorp.com">frank@ourcorp.com</a>  | 678-90-1234<br>(6 rows)</pre><pre>Find an existing user id and encrypt it<br>WARNING!   When doing this in production, it&#39;s best to schedule a maintenance window unless your application logic can consume both encrypted and unencrypted values</pre><pre>QUERY=&quot;select id from hr.people where <a href="/service/mailto:email=&#39;alice@ourcorp.com">email=&#39;alice@ourcorp.com</a>&#39;&quot;<br>user_id=$(psql)</pre><pre># user_id = 123-45-6789</pre><pre>enc_id=$(vault write -field=ciphertext transit-blog/encrypt/hr plaintext=$( base64 &lt;&lt;&lt; ${user_id} ) )<br>QUERY=&quot;UPDATE hr.people SET id=&#39;${enc_id}&#39; WHERE <a href="/service/mailto:email=&#39;alice@ourcorp.com">email=&#39;alice@ourcorp.com</a>&#39;&quot;</pre><pre>psql<br>UPDATE 1</pre><pre>QUERY=&quot;select email,id from hr.people&quot;<br>psql</pre><pre>email        |                                id<br>--------------------+-------------------------------------------------------------------<br> <a href="/service/mailto:bob@ourcorp.com">bob@ourcorp.com</a>    | 234-56-7890<br> <a href="/service/mailto:chun@ourcorp.com">chun@ourcorp.com</a>   | 350322197001015332<br> <a href="/service/mailto:deepak@ourcorp.com">deepak@ourcorp.com</a> | 0123 4567 8901<br> <a href="/service/mailto:eve@ourcorp.com">eve@ourcorp.com</a>    | AB 12 34 56 Z<br> <a href="/service/mailto:frank@ourcorp.com">frank@ourcorp.com</a>  | 678-90-1234<br> <a href="/service/mailto:alice@ourcorp.com">alice@ourcorp.com</a>  | vault:v1:CX2gvluidKHAw3BnfOqauoO7MDdAqR+jwbP7uzoqOdq9J7iXCY3HwlA=<br>(6 rows)</pre><p>Now that we have data encrypted in the database, let’s simulate retrieving from an application. Transit’s “decrypt” operation will be used. You need to base64 decode the value as well.</p><pre>QUERY=&quot;select id from hr.people where <a href="/service/mailto:email=&#39;alice@ourcorp.com">email=&#39;alice@ourcorp.com</a>&#39;&quot;<br>enc_user_id=$(psql)</pre><pre>echo ${enc_user_id}<br>enc_user_id = vault:v1:CX2gvluidKHAw3BnfOqauoO7MDdAqR+jwbP7uzoqOdq9J7iXCY3HwlA=</pre><pre>user_id=$(vault write -field=plaintext transit-blog/decrypt/hr ciphertext=${enc_user_id} | base64 --decode)</pre><pre>echo ${user_id}<br>123-45-6789</pre><p>Notice the values are still encrypted in the DB.</p><pre>QUERY=&quot;select email,id from hr.people&quot;<br>psql</pre><pre>email        |                                id<br>--------------------+-------------------------------------------------------------------<br> <a href="/service/mailto:bob@ourcorp.com">bob@ourcorp.com</a>    | 234-56-7890<br> <a href="/service/mailto:chun@ourcorp.com">chun@ourcorp.com</a>   | 350322197001015332<br> <a href="/service/mailto:deepak@ourcorp.com">deepak@ourcorp.com</a> | 0123 4567 8901<br> <a href="/service/mailto:eve@ourcorp.com">eve@ourcorp.com</a>    | AB 12 34 56 Z<br> <a href="/service/mailto:frank@ourcorp.com">frank@ourcorp.com</a>  | 678-90-1234<br> <a href="/service/mailto:alice@ourcorp.com">alice@ourcorp.com</a>  | vault:v1:CX2gvluidKHAw3BnfOqauoO7MDdAqR+jwbP7uzoqOdq9J7iXCY3HwlA=<br>(6 rows)</pre><p><strong>Negative Tests</strong></p><pre># Try to query the engineering schema with these credentials</pre><pre>QUERY=&quot;select * from engineering.catalog&quot;<br>psql</pre><pre>ERROR:  permission denied for schema engineering<br>LINE 1: select * from engineering.catalog<br>                      ^</pre><pre># Can the Vault token read from other areas in Vault?</pre><pre>vault read db-blog/creds/mother-full-read-1h</pre><pre>Error reading db-blog/creds/mother-full-read-1h: Error making API request.</pre><pre>URL: GET <a href="http://10.4.2.120:8200/v1/db-blog/creds/mother-full-read-1h">http://10.4.2.120:8200/v1/db-blog/creds/mother-full-read-1h</a><br>Code: 403. Errors:</pre><pre>* 1 error occurred:<br> * permission denied</pre><pre>vault kv get kv-blog/it/servers/hr/root</pre><pre>Error reading kv-blog/data/it/servers/hr/root: Error making API request.</pre><pre>URL: GET <a href="http://10.4.2.120:8200/v1/kv-blog/data/it/servers/hr/root">http://10.4.2.120:8200/v1/kv-blog/data/it/servers/hr/root</a><br>Code: 403. Errors:</pre><pre>* 1 error occurred:<br> * permission denied</pre><h3>Cleanup</h3><p>To stop all the things:</p><pre>docker kill postgres openldap<br>kill $(ps | grep &quot;vault server -dev&quot; | grep -v grep | awk &#39;{print $1}&#39;)</pre><h3>Summary</h3><p>In the last blog post, I summarized the Essential Patterns of Vault:</p><ol><li>Be familiar with the documentation</li><li>Enable and configure Secret Engines</li><li>Enable and configure Authentication Methods</li><li>Define and create policies</li><li>Authorize by tying policies for accessing secret engines to authentication methods.</li><li>Do positive and negative tests to prove your configurations allow access to the needed secrets as well as disallow access to unneeded secrets.</li></ol><p>This post dove deeper into showing how to implement those Patterns based on a theoretical solution for the company, OurCorp. We also briefly touched on some advanced topics like <a href="https://www.vaultproject.io/docs/secrets/identity/index.html">Identity</a> and <a href="https://learn.hashicorp.com/vault/identity-access-management/policy-templating">ACL Templating</a> to help streamline your automation processes. If you’re able to consume and understand this information, you’re one step closer to becoming a Vault expert.</p><p>Nice Work!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4d34976f1dc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashicorp-engineering/essential-patterns-of-vault-part-2-b4d34976f1dc">Essential Patterns of Vault — Part 2</a> was originally published in <a href="https://medium.com/hashicorp-engineering">HashiCorp Solutions Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Essential Patterns of Vault — Part 1]]></title>
            <link>https://medium.com/hashicorp-engineering/essential-elements-of-vault-part-1-5a64d3de3be8?source=rss-3dd808128d1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a64d3de3be8</guid>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[cloud-native]]></category>
            <category><![CDATA[vault]]></category>
            <category><![CDATA[hashicorp-vault]]></category>
            <dc:creator><![CDATA[Jake Lundberg]]></dc:creator>
            <pubDate>Mon, 24 Jun 2019 06:57:55 GMT</pubDate>
            <atom:updated>2019-07-30T02:46:38.311Z</atom:updated>
            <content:encoded><![CDATA[<h3>Essential Patterns of Vault — Part 1</h3><p>Learning HashiCorp Vault can be a daunting task when approached for the first time. While Vault can seem quite difficult on the outside, there are some distinct and repeatable patterns that are simple to learn and which can greatly accelerate adoption. This is a two part blog post. Part 1 will focus on the high level explanation of the Essential Patterns. Part 2 will take these patterns and apply them with code examples and detailed explanations.</p><p>When describing Vault to my customers, I usually start the conversation with the Vault Triangle. This triangle contains a snapshot of Vault’s current set of operations in one place and is a great visual representation for the typical flow of information. While Secret Engines and Authentication Methods will increase over time, the discipline for using them will remain fairly similar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T4D7fxVyQA7KS3ftbM4VEg.png" /></figure><p>In its simplest form, the process of using Vault is:</p><ol><li>Be familiar with the documentation</li><li>Enable and configure Secret Engines</li><li>Enable and configure Authentication Methods</li><li>Define and create policies</li><li>Authorize by tying policies for accessing secret engines to authentication methods.</li><li>Do positive and negative tests to prove your configurations allow access to the needed secrets as well as disallow access to unneeded secrets.</li></ol><p>In a nutshell, that’s it.</p><p><strong>Docs and Learn</strong></p><p>This shouldn’t be a surprise to anyone, but the first discipline of Vault (or any other tool for that matter) is knowing where to find information on your own. While community information like <a href="https://discuss.hashicorp.com/">HashiCorp Discuss</a>, StackExchange or Reddit, as well as Slack channels like Hangops or SweetOps, are great for asking people online, our first stop should always be the <a href="https://www.vaultproject.io/docs/">Vault Documentation</a> and <a href="https://learn.hashicorp.com/vault/">Vault Learn</a>.</p><p>Vault Docs are as you’d expect, the documentation for the product. Inside each section, you will find an introduction to each subject as well as very detailed API documentation (usually linked at the bottom of the intro section). Usually when I’m working on a particular solution, I’ll have both open for giving examples as well as digging deep into any special parameters or outputs given from the API.</p><p>Learn has a fantastic amount of curated material to walk any new (or old) users of Vault through all subjects it covers.</p><p>Now that you’re familiar with the docs, let’s talk about the reason everyone uses Vault: secrets.</p><p><strong>Secrets</strong></p><p>First and foremost, Vault is a secrets management solution. One of the main objectives is to reduce secrets sprawl. Defining this is outside the scope of this blog, but I did a blog with Microsoft on the subject: <a href="https://cloudblogs.microsoft.com/opensource/2019/04/04/tutorial-identify-eliminate-secrets-sprawl-hashicorp-vault-azure/">How to identify and eliminate secrets sprawl on Azure with HashiCorp Vault — Open Source blog</a>.</p><p>So naturally, the first task we need to do is define what kinds of secrets we want to manage and then enable them.</p><p>Vault allows you to manage:</p><ul><li>Key Values (simple or complex)</li><li>Dynamic database/datastore credentials</li><li>Dynamic cloud credentials</li><li>PKI Certificates</li><li>SSH CA Certificates</li><li>Encryption as a Service</li><li>Consul and Nomad ACL tokens</li><li>Custom Plugins</li></ul><p>Most people will start off with Key Values first, but the rest of the engines are widely used as well. Dynamic secrets are amazing because they allow you to use Vault as a Secret Broker to other technologies that normally have static secrets. Vault will both create and remove credentials based on any number of rules you set. Time and usage count-based bounds are very popular.</p><p>Once you’ve enabled the secrets for your organization, the next task is to figure out how you are going to allow humans and machines to access those secrets.</p><p><strong>Authentication</strong></p><p>Before you can access anything in Vault, you need a special access key called a Token. In order to get that token, you have to authenticate to Vault. You could distribute tokens directly, but creating, storing, and distributing them securely can be non-trivial. Authentication methods then, are convenience methods for retrieving tokens.</p><p>Vault has a wide array of Authentication Methods to include (but not limited to):</p><ul><li>LDAP/AD</li><li>Okta</li><li>Kubernetes</li><li>AWS IAM</li><li>GCP IAM</li><li>Azure MSI</li><li>GitHub</li><li>Generic JWT and OIDC methods</li><li>PKI Certificates</li><li>Username and Password</li><li>AppRole</li></ul><p>You can easily enable as many authentication methods as you need; Vault is very flexible.</p><p>Just authenticating with Vault is not enough however; you also need to let Vault know what the entity accessing it should be allowed to interact with. Think of it like the Token you are given is blank with no permission to do anything, it needs to get permissions on what it can access.</p><p><strong>Authorization</strong></p><p>The way you get the permissions for the Token is through Policies.</p><p>Everything you access in Vault is done at a path. Under the hood, Vault uses radix trees for its data storage. This allows us to quickly map policy definitions to secrets and administrative functions at scale and with many concurrent requests.</p><p>Policies are the way of defining which paths in Vault can be accessed. You can create as many policies as you want with as many path combinations as necessary.</p><p>Example Policy:</p><pre># KV V1 Examples<br>path “secret/db1/finance/*” {<br>  capabilities = [“create”, “read”, “update”, “delete”, “list”]<br>}</pre><pre>path “secret/it/*” {<br>  capabilities = [“read”, “list”]<br>}</pre><pre>path &quot;secret/it/supersecret/*&quot; {<br>  capabilities = [ &quot;deny&quot; ]<br>}</pre><p>Once created, the next step is to tie a policy or set of policies to the authentication methods enabled on the system. Generally speaking, most authentication methods have a concept of roles and those roles are what policies are tied to. API documentation is rich, so any deviation to this naming convention is easy to catch.</p><p>One extremely powerful concept is that policies can use <a href="https://www.vaultproject.io/docs/concepts/policies.html#templated-policies">Policy Templates</a>. Templates allow us to accelerate policy distribution by using variables instead of hard-coded paths. This allows us to use common classification patterns, like LDAP groups or Kubernetes namespaces, to define access versus explicitly writing paths. Using templates does require some understanding of <a href="https://www.vaultproject.io/docs/secrets/identity/index.html">Vault Identity</a>, but in our examples, I’ll show some ways to accelerate how to learn this arcane subject.</p><p><strong>Administration</strong></p><p>This section doesn’t describe administration functions, but more points out that admin endpoints are also just paths within Vault. To allow admin access is to just allow access to the proper paths. For example, all root protected paths that require sudo access can be found at <a href="https://learn.hashicorp.com/vault/identity-access-management/iam-policies#root-protected-api-endpoints">Root Protected API Endpoints</a>.</p><p><strong>Tests</strong></p><p>Once you have everything setup, it’s a good idea to test your setup to ensure authentication and authorization both give access to needed secrets as well as deny access to unneeded secrets. We’ll go more in depth on this in Part 2.</p><p><strong>Putting it All Together</strong></p><p>A basic instruction set for implementing a Vault solution might be:</p><ul><li>Enable K/V and Dynamic Database Secret Engines</li><li>Enable LDAP Auth Method</li><li>Define and create policies to access specific paths within each secret engine</li><li>Map policies to authentication methods</li><li>Do positive and negative policy tests</li></ul><p><strong>Additional food for thought</strong></p><p>While the information I’ve given so far encompasses the main patterns we need to understand to be successful with Vault, there are a few other things worth pointing out that I find key to using Vault over time:</p><ul><li>Running local Vault instances in <a href="https://www.vaultproject.io/docs/concepts/dev-server.html">Dev Server Mode</a></li><li>Using <a href="https://www.vaultproject.io/docs/agent/">Vault Agent</a></li><li><a href="https://github.com/hashicorp/consul-template">Consul-template</a> and <a href="https://github.com/hashicorp/envconsul">envconsul</a></li></ul><p><strong>Running Vault in Dev Mode</strong></p><p>It’s very easy to experiment with Vault when it comes to learning just about anything about it. Dev mode is in memory, doesn’t require unsealing, and allows for configurable root tokens, which eliminates the need to create hacky workarounds for unsealing and parsing out root tokens when doing development. The beauty here is that you can quickly iterate on automating processes as you can start with a clean slate as often as you like. In fact, when creating automation, this is by far the best technique to ensure your automation is complete as you always start with a fresh slate and don’t accidentally leave any configurations behind.</p><p>Though this should be obvious: DO NOT RUN THIS IN PRODUCTION!</p><p><strong>Vault Agent</strong></p><p>Vault also has an agent which can be used to simplify client-side operations such as:</p><ul><li>Authenticating with certain auto-auth functions like AWS, Azure, or Kubernetes</li><li>Maintaining lifecycle of Vault tokens</li><li>Agent will both introduce as well as renew tokens</li><li>Caching leased secrets like dynamic DB credentials and PKI certificates</li></ul><p>Before Vault Agent, it was up to the user to come up with a solution to do the stuff above. You’re still welcome to write your own tools of course, but Vault Agent can save you some effort.</p><p><strong>Consul Template and Envconsul</strong></p><p>Though both of these tools currently still have Consul in the name, they also work quite well with Vault. It’s possible the names will change in the future.</p><p>Consul Template can be used to read both Consul K/V values as well as Vault secrets. These values can then be used to fill in templated files to be used for application configuration. This can help accelerate Vault adoption as any application that reads a config file can be Vault enabled with little effort. Consul template is aware of secret leases as well and can renew secrets automatically when run as a daemon.</p><p>Much like Consul Template, envconsul reads from both Consul and Vault and creates environment variables that can be used for injecting into applications at start time, or possibly being re-read during run time for applications that can do this. For people focused on creating twelve-factor apps, this could be the tool for you.</p><p><strong>Don’t touch that dial!</strong></p><p>Now that we’ve gone over the core patterns for Vault adoption, I’ll punt until the next blog post, <a href="https://medium.com/hashicorp-engineering/essential-patterns-of-vault-part-2-b4d34976f1dc">The Essential Patterns of HashiCorp Vault — Part 2</a>, to give a detailed example of the Putting It Together section above.</p><p>Lastly, let me know if you ever actually used a dial to change TV channels.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a64d3de3be8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hashicorp-engineering/essential-elements-of-vault-part-1-5a64d3de3be8">Essential Patterns of Vault — Part 1</a> was originally published in <a href="https://medium.com/hashicorp-engineering">HashiCorp Solutions Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>