# HashiCorp Vault

HashiCorp Vault is a secrets management solution that provides secure storage, dynamic credentials, and cryptographic key management for your applications and infrastructure.

Through this integration, Apono helps you discover Vault secrets and keys, and securely manage just-in-time (JIT) access to them:

* Securely broker access to secrets through access flows
* Ensure sensitive information is only accessible to authorized users when it’s needed
* Prevent exposure of static credentials or reliance on manual sharing

{% hint style="info" %}
This integration has the following limitations:

* If you request permissions for a specific key or secret, other items may still appear in the Vault UI but **without granted permissions**.
* Only 10,000 secrets and keys are supported.
  {% endhint %}

{% hint style="success" %}
If you prefer to use HashiCorp secrets as a backend credential store for configuring other Apono integrations, see the [Apono Integration Secret](https://docs.apono.io/docs/connectors-and-secrets/apono-integration-secret) article.
{% endhint %}

***

### Prerequisites

<table><thead><tr><th width="215.11328125">Item</th><th>Description</th></tr></thead><tbody><tr><td><strong>Apono connector</strong></td><td><p>On-prem connection serving as a bridge between a HashiCorp instance and Apono:</p><ul><li><a href="../../aws-environment/apono-connector-for-aws">AWS</a></li><li><a href="../../azure-environment/apono-connector-for-azure">Azure</a></li><li><a href="../../gcp-environment/apono-connector-for-gcp">GCP</a></li><li><a href="../../kubernetes-environment/apono-connector-for-kubernetes">Kubernetes</a></li></ul></td></tr><tr><td><strong>HashiCorp Vault admin privileges</strong></td><td>Admin access on Vault OSS, running in Kubernetes or a virtual machine</td></tr><tr><td><strong>Vault CLI</strong></td><td><a href="https://developer.hashicorp.com/vault/install">Command-line interface</a> used to interact with and manage HashiCorp Vault</td></tr><tr><td><strong>Vault address</strong></td><td>Production URL address of your Vault server</td></tr></tbody></table>

***

### Set up Apono in HashiCorp Vault

Follow these steps to set up Apono access in HashiCorp Vault:

1. At the shell prompt, enable the `AppRole` and `userpass` authentication methods.

{% hint style="info" %}
Apono uses `AppRole` for its own service access and `userpass` for just-in-time user accounts.
{% endhint %}

```sh
vault auth enable approle
vault auth enable userpass
```

2. Enable the KV v2 and Transit secrets engines.

{% hint style="info" %}
The KV v2 secrets engine allows Apono to manage stored secrets. The Transit secrets engine lets Apono list and manage cryptographic keys.
{% endhint %}

```sh
vault secrets enable -path=kv kv-v2
vault secrets enable -path=transit transit
```

3. Create a management policy for Apono.

{% hint style="info" %}
This policy allows the Apono plugin to create users, attach policies, and list secrets.
{% endhint %}

{% code overflow="wrap" %}

```sh
vault policy write apono-management - <<EOF
# Basic system privileges
path "sys/health"             { capabilities = ["read"] }
path "sys/mounts"             { capabilities = ["read"] }
path "sys/capabilities-self"  { capabilities = ["update"] }

# Manage user creation
path "auth/userpass/users"       { capabilities = ["list"] }
path "auth/userpass/users/*"     { capabilities = ["create","update","read","delete"] }

# ACL-policies apono-* management
path "sys/policies/acl/apono-*"  { capabilities = ["create","update","read","delete","list"] }

# KV v2 (for listing resources)
path "kv/metadata/*"             { capabilities = ["read","list"] }

# Transit (for listing resources)
path "transit/keys"              { capabilities = ["list"] }
EOF

```

{% endcode %}

4. Create an `AppRole` that allows the Apono plugin to log in.

```sh
vault write auth/approle/role/apono-plugin \
  token_policies="apono-management" \
  token_ttl=60m \
  token_max_ttl=4h

```

5. Fetch and save the `role_id` value.

```sh
vault read auth/approle/role/apono-plugin/role-id
```

6. Fetch and save the `secret_id` value.

```sh
vault write -f auth/approle/role/apono-plugin/secret-id
```

7. [Create a secret](https://docs.apono.io/docs/connectors-and-secrets/apono-integration-secret) with the credentials from steps **5-6**. Use the following key-value pair structure when generating the secret. Be sure to replace `#ROLE_ID` and `#SECRET_ID` with the actual values.

```
"role_id":"#ROLE_ID",
"secret_id":"#SECRET_ID"
```

{% hint style="success" %}
You can also input the user credentials directly into the Apono UI during the integration process.
{% endhint %}

You can now [integrate Hashicorp Vault](https://docs.google.com/document/d/1e6Pnky-9gJo1XZpnYCtBjzttgfWYkQ2HfzTfX_rUdrQ/edit?tab=t.0#heading=h.bjur81xhnsrm).

***

### Integrate HashiCorp Vault

<figure><img src="https://1094436629-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fv6MBfUGvblSdAz31yJXm%2Fuploads%2Fgit-blob-5c567e06dcb94f3c510ca82bcc35566f90db1b92%2Fintegrate-hashicorp-vault.png?alt=media" alt="" width="563"><figcaption><p>HashiCorp Vault tile</p></figcaption></figure>

{% hint style="success" %}
You can also use the steps below to integrate with Apono using Terraform.

In step **11**, instead of clicking **Confirm**, follow the **Are you integrating with Apono using Terraform?** guidance.
{% endhint %}

Follow these steps to complete the integration:

1. On the [**Catalog**](https://app.apono.io/catalog?search=1password) tab, click **HashiCorp Vault**. The **Connect Integration** page appears.
2. Under **Discovery**, click one or more resource types to sync with Apono.

{% hint style="info" %}
Apono automatically discovers and syncs all the instances in the environment. After syncing, you can manage Access Flows to these resources.
{% endhint %}

3. Click **Next**. The **Apono connector** section expands.
4. From the dropdown menu, select a connector. Choosing a connector links Apono to all the services available on the account where the connector is located.

{% hint style="info" %}
If the desired connector is not listed, click **+ Add new connector** and follow the instructions for creating a connector ([AWS](https://docs.apono.io/docs/aws-environment/apono-connector-for-aws), [Azure](https://docs.apono.io/docs/azure-environment/apono-connector-for-azure), [GCP](https://docs.apono.io/docs/gcp-environment/apono-connector-for-gcp), [Kubernetes](https://docs.apono.io/docs/kubernetes-environment/apono-connector-for-kubernetes)).
{% endhint %}

5. Click **Next**. The **Integration Config** page expands.
6. Define the **Integration Config** settings.

   <table><thead><tr><th width="229">Setting</th><th>Description</th></tr></thead><tbody><tr><td><strong>Integration Name</strong></td><td>Unique, alphanumeric, user-friendly name used to identify this integration when constructing an access flow</td></tr><tr><td><strong>Vault URL</strong></td><td><p>Production URL address of your Vault server</p><p><strong>Example</strong>: <em>https://vault.company-name.com</em></p></td></tr></tbody></table>
7. Click **Next**. The **Secret Store** section expands.
8. [Associate the secret or credentials](https://docs.apono.io/docs/connectors-and-secrets/apono-integration-secret).

{% hint style="info" %}
If you select the **Apono** secret manager, enter the following values:

* **Vault Role ID**: Enter the `role_id` value from step **5** of the [previous section](#set-up-apono-in-hashicorp-vault).
* **Vault Secret ID**: Enter the `secret_id` value from step **6** of the [previous section](#set-up-apono-in-hashicorp-vault).
  {% endhint %}

9. Click **Next**. The **Get more with Apono** section expands.
10. Define the **Get more with Apono** settings.

<table><thead><tr><th width="242">Setting</th><th>Description</th></tr></thead><tbody><tr><td><strong>Custom Access Details</strong></td><td>(Optional) Instructions explaining how to access this integration's resources<br><br>Upon accessing an integration, a message with these instructions will be displayed to end users in the User Portal. The message may include up to <strong>400 characters</strong>.<br><br>To view the message as it appears to end users, click <strong>Preview</strong>.</td></tr><tr><td><strong>Integration Owner</strong></td><td><p>(Optional) Fallback approver if no <a href="../../access-flows/dynamic-access-management/resource-and-integration-owners">resource owner</a> is found<br><br>Follow these steps to define one or several integration owners:</p><ol><li>From the <strong>Attribute</strong> dropdown menu, select <strong>User</strong> or <strong>Group</strong> under the relevant identity provider (IdP) platform.</li><li>From the <strong>Value</strong> dropdown menu, select one or multiple users or groups.</li></ol><p><br><strong>NOTE</strong>: When <strong>Resource Owner</strong> is defined, an <strong>Integration Owner</strong> must be defined.</p></td></tr><tr><td><strong>Resource Owner</strong></td><td><p>(Optional) Group or role responsible for managing access approvals or rejections for the resource<br><br>Follow these steps to define one or several <a href="../../access-flows/dynamic-access-management/resource-and-integration-owners">resource owners</a>:</p><ol><li>Enter a <strong>Key name</strong>. This value is the name of the tag created in your cloud environment.</li><li>From the <strong>Attribute</strong> dropdown menu, select an attribute under the IdP platform to which the key name is associated.<br><br>Apono will use the value associated with the key (tag) to identify the resource owner. When you update the membership of the group or role in your IdP platform, this change is also reflected in Apono.</li></ol><p><br><strong>NOTE</strong>: When this setting is defined, an <strong>Integration Owner</strong> must also be defined.</p></td></tr></tbody></table>

11. Click **Confirm**.

<details>

<summary>💡Are you integrating with Apono using Terraform?</summary>

If you want to integrate with Apono using Terraform, follow these steps instead of clicking **Confirm**:

1. At the top of the screen, click **View as Code**. A modal appears with the completed Terraform configuration code.
2. Click to copy the code.
3. Make any additional edits.
4. Deploy the code in your Terraform.

Refer to [Integration Config Metadata](https://docs.apono.io/metadata-for-integration-config/integration-metadata/hashicorp-vault) for more details about the schema definition.

</details>

Now that you have completed this integration, you can [create access flows](https://docs.apono.io/docs/access-flows/access-flows) that grant permission to your HashiCorp Vault secrets and keys.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.apono.io/docs/additional-integrations/secret-management/hashicorp-vault.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
