> For the complete documentation index, see [llms.txt](https://newdocs.keeper.io/kcm-linux-rpm-method/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://newdocs.keeper.io/kcm-linux-rpm-method/vault-integration/dynamic-tokens.md).

# Dynamic Tokens

<figure><img src="/files/kVeDIeB03GCYAvbT1OxX" alt=""><figcaption></figcaption></figure>

## Dynamic Tokens

When using the vault integration, specific tokens are replaced by the corresponding value from a Keeper record.

There are dynamic and static tokens. **Dynamic tokens** will search the Keeper vault for a matching hostname to extract the necessary fields. **Static tokens** can be created that explicitly reference a particular Keeper record and field.

### Hostname Matching

Keeper Records can be assigned to connections by the "Hostname" field in the connection and the "Hostname or IP Address" field in the vault record.

If these two values match, Connection Manager will fetch and replace tokens in other connection fields with values from the record, such as Username, Password, Domain, etc...

![Example of Linux Connection Matching](/files/Jpnp6llzdkG5lGxcCL6x)

![SSH Connection with Secrets Manager Integration](/files/Y93dlMId8Idt4m7VBFZl)

<figure><img src="/files/ZEGpirjTfwS88DiaXDzL" alt=""><figcaption><p>Example of Windows Login</p></figcaption></figure>

### **User Matching**

Keeper Records can be assigned to connections by the "Username" field in the connection and the "Login" field in the vault record.

If these two values match, Connection Manager will fetch and replace tokens in other connection fields with values from the record.

As one example, this is useful for mapping a single SSH key to multiple servers. This way, you don't need to store one record per host in the vault. A single Keeper vault record can be used to authenticate any number of connections. Below is a Connection that is set up to match on Username.

![Example Connection with User Matching](/files/pAXAhtTf4RDdpYBNJhFh)

The corresponding vault record is seen below. No hostname is specified in the vault record, so the match will occur based on the login field.

![Vault Record match on User](/files/6SLzGqmLoDNBU2At9Q01)

{% hint style="info" %}
For user-based matching, ensure that the Keeper record does not have a Hostname/Port.  It should simply contain the username and password (or private key).
{% endhint %}

### **Available Tokens**

The built-in tokens each correspond to a record field. The table below lists each token and its corresponding record field. These tokens are applicable to all connection types.

**Standard Tokens**

#### Domain and Username Splitting

| **Parameter Token**           | **Description**                                                                                                                                                                                                                               |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `${KEEPER_SERVER_USERNAME}`   | <p><strong>Retrieves:</strong> “Login” field of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “hostname” connection parameter.</p>                                        |
| `${KEEPER_SERVER_KEY}`        | <p><strong>Retrieves:</strong> “Private Key” field (or single .pem file attachment) of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “hostname” connection parameter.</p> |
| `${KEEPER_SERVER_PASSPHRASE}` | <p><strong>Retrieves:</strong> “Passphrase” field (or “password” if no passphrase) of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “hostname” connection parameter.</p>  |
| `${KEEPER_SERVER_PASSWORD}`   | <p><strong>Retrieves:</strong> “Password” field of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “hostname” connection parameter.</p>                                     |
| `${KEEPER_SERVER_DOMAIN}`     | <p><strong>Retrieves:</strong> “Domain” custom field of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “hostname” connection parameter.</p>                                |
| `${KEEPER_USER_KEY}`          | <p><strong>Retrieves:</strong> “Private Key” field (or single .pem file attachment) of single matched record</p><p><strong>Matches:</strong> Record with login matching the “username” connection parameter.</p>                              |
| `${KEEPER_USER_PASSPHRASE}`   | <p><strong>Retrieves:</strong> “Passphrase” field (or “password” if no passphrase) of single matched record</p><p><strong>Matches:</strong> Record with login matching the “username” connection parameter</p>                                |
| `${KEEPER_USER_PASSWORD}`     | <p><strong>Retrieves:</strong> “Password” field of single matched record</p><p><strong>Matches:</strong> Record with login matching the “username” connection parameter</p>                                                                   |
| `${KEEPER_USER_DOMAIN}`       | <p><strong>Retrieves:</strong> “Domain” custom field of single matched record</p><p><strong>Matches:</strong> Record with login matching the “username” connection parameter</p>                                                              |

Some username fields are of the format: `Domain\Username` or `Username@Domain` but the connection details need only the domain or username.  Use these tokens to automatically split these fields and use the corresponding field:

| Parameter Token        | Description                                                                                                                                                                                                                   |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `${KEEPER_*_DOMAIN}`   | <p><strong>Retrieves:</strong> “Domain” part of the "Login" field of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “hostname” connection parameter.</p>   |
| `${KEEPER_*_USERNAME}` | <p><strong>Retrieves:</strong> “Username” part of the "Login" field of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “hostname” connection parameter.</p> |

Alternatively you can set `KSM_STRIP_WINDOWS_DOMAINS` to `true` in guacamole.properties to automatically strip all login fields into separate 'USERNAME' and 'DOMAIN' fields accessible by tokens

#### Gateway Tokens <a href="#gateway-based-dynamic-secrets" id="gateway-based-dynamic-secrets"></a>

The tokens below are applicable only to connection types that have gateway support (RDP).

| **Parameter Token**                 | **Description**                                                                                                                                                                                                                                       |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `${KEEPER_GATEWAY_USERNAME}`        | <p><strong>Retrieves:</strong> “Login” field of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “gateway-hostname” connection parameter.</p>                                        |
| `${KEEPER_GATEWAY_KEY}`             | <p><strong>Retrieves:</strong> “Private Key” field (or single .pem file attachment) of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “gateway-hostname” connection parameter.</p> |
| `${KEEPER_GATEWAY_PASSPHRASE}`      | <p><strong>Retrieves:</strong> “Passphrase” field (or “password” if no passphrase) of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “gateway-hostname” connection parameter.</p>  |
| `${KEEPER_GATEWAY_PASSWORD}`        | <p><strong>Retrieves:</strong> “Password” field of single matched record</p><p><strong>Matches:</strong> Record with hostname / IP address matching the value of the “gateway-hostname” connection parameter.</p>                                     |
| `${KEEPER_GATEWAY_USER_KEY}`        | <p><strong>Retrieves:</strong> “Private Key” field (or single .pem file attachment) of single matched record</p><p><strong>Matches:</strong> Record with login matching the “gateway-username” connection parameter.</p>                              |
| `${KEEPER_GATEWAY_USER_PASSPHRASE}` | <p><strong>Retrieves:</strong> “Passphrase” field (or “password” if no passphrase) of single matched record</p><p><strong>Matches:</strong> Record with login matching the “gateway-username” connection parameter</p>                                |
| `${KEEPER_GATEWAY_USER_PASSWORD}`   | <p><strong>Retrieves:</strong> “Password” field of single matched record</p><p><strong>Matches:</strong> Record with login matching the “gateway-username” connection parameter</p>                                                                   |

### Windows Username/Domain Parsing

KCM will identify the Domain, Username and Password fields from the Keeper Vault record, as long as there is a field with the corresponding name.  For example:

<figure><img src="/files/uFtcAqn3ru3ohwx6BULP" alt=""><figcaption><p>Domain Matching on Custom Field</p></figcaption></figure>

### Automatic Parsing of Domain from Login Field

The Windows "Domain" and "Username" field can be parsed if the Login value in the Keeper Vault is supplied in the format of `DOMAIN\Username` or `Domain@Username`.

To activate automatic parsing, the environmental variable `KSM_STRIP_WINDOWS_DOMAINS` must be added to the Docker Config file.

For example:

{% code title="docker-compose.yml" %}

```
            ....
            MYSQL_DATABASE: "guacamole_db"
            MYSQL_USERNAME: "guacamole_user"
            KSM_CONFIG: "XXX"
            ....
            ....
            KSM_STRIP_WINDOWS_DOMAINS: "true"
            ....

```

{% endcode %}

In the record, the Login field can then contain&#x20;

<figure><img src="/files/XBWg9Epg2OlqveuAAjR6" alt=""><figcaption><p>Automatic Parsing of Domain from Login Field</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://newdocs.keeper.io/kcm-linux-rpm-method/vault-integration/dynamic-tokens.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
