> For the complete documentation index, see [llms.txt](https://docs.p0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.p0.dev/integrations/resource-integrations/tailscale/requesting-access.md).

# Requesting Tailscale access

How to request just-in-time network access on a tailnet via P0

{% hint style="info" %}
The Tailscale integration is in beta. Functionality and configuration may change.
{% endhint %}

You request a P0 posture on one of your devices. While you have it, your device reaches whatever your tailnet's policy file grants to devices with that posture. P0 sets it for the approved duration, then takes it away.

{% hint style="info" %}
P0 finds you in the tailnet by the email you sign in to P0 with. You need to be a member of the tailnet, signed in to Tailscale with that email, before you request.
{% endhint %}

## Requesting from the P0 CLI

To request a posture:

```bash
p0 request tailscale posture <posture> [--device <device>] [--tailnet <tailnet>]
```

| Argument              | Description                                                                                                                                                                                                                          |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `<posture>`           | A posture the tailnet's policy file defines, such as `posture:p0_prod_db`. See [#what-you-can-request](#what-you-can-request "mention").                                                                                             |
| `--device <device>`   | Your device to set the posture on. If you have only one device of your own on the tailnet, you can leave it out. See [#choosing-a-device-for-a-posture](#choosing-a-device-for-a-posture "mention").                                 |
| `--tailnet <tailnet>` | The tailnet, by its Tailnet ID, such as `T1234CNTRL`. Lists show each tailnet with its DNS name, such as `T1234CNTRL (tail1234.ts.net)`, but enter the ID alone. Needed only when your organization has more than one tailnet in P0. |

P0 refuses Tailscale access with no end, so give your request a duration, such as `--duration '2 hours'`.

To list the postures you can request, run `p0 ls tailscale posture target`, and to list your devices, `p0 ls tailscale posture device`. The lists show what the tailnet has right now. See [p0 ls](https://docs.p0.dev/p0-cli/p0-commands-and-usage/p0-ls.md).

For example, to request the posture `posture:p0_prod_db` on your laptop, whose node ID is `nAbc123CNTRL`:

```bash
p0 request tailscale posture posture:p0_prod_db --device nAbc123CNTRL --duration '2 hours' --reason "Run the schema migration"
```

## Requesting from Slack or the P0 app

In Slack, the same commands work as slash commands, such as `/p0 request tailscale posture posture:p0_prod_db`. For a form, type `/p0 request` in Slack, or click **Request Access** on the **Access Management** page of the P0 app. Select **Tailscale**, pick the posture from what the tailnet's policy file defines, and pick your device. If your organization has one tailnet, the form selects it for you.

For every way to request access, see [Requesting access](https://docs.p0.dev/access-management/access-management/just-in-time-access/requesting-access.md).

## What you can request

| Type      | Shown as | Target                                                                    | Options                                                                                                                            | What you can reach while your access is active                                                         |
| --------- | -------- | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `posture` | Posture  | A posture the tailnet's policy file defines, such as `posture:p0_prod_db` | `--device`, your device to set the posture on. See [#choosing-a-device-for-a-posture](#choosing-a-device-for-a-posture "mention"). | Whatever your tailnet's policy file grants to devices with the posture, from the one device you choose |

Before approving, an approver sees the tailnet by its Tailnet ID and DNS name, such as `T1234CNTRL (tail1234.ts.net)`, and what the posture unlocks in the tailnet's policy file. See [Tailscale](https://docs.p0.dev/integrations/resource-integrations/tailscale.md#set-up-postures-in-your-policy-file). If the posture gates nothing, the approver sees `No grant or SSH rule in the tailnet's policy file names this posture.`

### Choosing a device for a posture

P0 sets the posture on one of your own devices: one signed in as you, with no tags, that the tailnet owns. A device shared in from another tailnet isn't in the device list, and P0 refuses it. If you have one such device, P0 picks it. If you have more than one, name it with `--device`, or pick it in the form. Name it as `p0 ls tailscale posture device` lists it, by the first part of that name, or by its node ID. Your access works from that device only.

## Requesting Tailscale access together with other access

To reach a database over Tailscale and sign in to it, make two requests: one for the database role, and one for the posture that your policy file gates the database on. For example:

```bash
p0 request postgres role analyst --instance my-instance --database orders --duration '2 hours' --reason "Run the schema migration"
p0 request tailscale posture posture:p0_prod_db --device nAbc123CNTRL --duration '2 hours' --reason "Run the schema migration"
```

Each request is approved and ends on its own. A posture can't be part of an Access Bundle, so always request it on its own. See [Access bundles](https://docs.p0.dev/policy-studio/policy-studio/access-bundles.md).

## When your access ends

When your access is revoked or expires, P0 removes the posture from your device. Within seconds, your device can't open new connections through it. A Tailscale SSH session you have open stays open until you close it. If the revoke fails, your request shows as errored, and the posture stays on your device until an admin clicks **Retry revoke**, or until it expires at the end of your access.

You can end your access early by relinquishing it. See [Requesting access](https://docs.p0.dev/access-management/access-management/just-in-time-access/requesting-access.md#relinquishing-access).

## When P0 refuses your request

P0 refuses a request as you make it in these cases. It checks most of them again at approval, so you can see them then too.

| Message                                                                                                                                                                           | Why                                                                                                                                    | What to do                                                                                            |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| A message that starts `Tailnet <tailnet> has no posture <posture> in its policy file.`                                                                                            | The tailnet's policy file doesn't define the posture, such as one removed after you listed it.                                         | Check the posture with `p0 ls tailscale posture target`, then request again.                          |
| A message that starts `Tailscale tailnet <tailnet> couldn't find the requested posture <posture>`                                                                                 | P0 couldn't read the tailnet's policy file: the tailnet is gone, or the connector's credential can't read it.                          | Ask your P0 admin to check the tailnet's install.                                                     |
| `The target must be a P0 posture, such as posture:p0_prod_db.`                                                                                                                    | The target isn't a P0 posture: its name doesn't start with `posture:p0_`, or the rest isn't lowercase letters, digits and underscores. | Request one of the postures `p0 ls tailscale posture target` lists.                                   |
| `The target must not be posture:p0_install_check, which P0's install check sets.`                                                                                                 | P0 keeps this posture for its own install check, so nobody can request it.                                                             | Ask your Tailscale admin to give the posture another name in the policy file, then request that name. |
| `Posture <posture> doesn't check <attribute> == true, so a device can pass it without P0. Add the assertion <attribute> == true to <posture> in tailnet <tailnet>'s policy file.` | The posture doesn't require the attribute P0 sets, so P0 won't grant it.                                                               | Ask your Tailscale admin to add the assertion the message names, then request again.                  |
| `You have no device on tailnet <tailnet> signed in as <email>, and P0 sets postures on your own untagged devices only. Sign a device in, then request again.`                     | You have no device of your own on the tailnet.                                                                                         | Sign a device in to the tailnet as yourself, then request again.                                      |
| `<device> isn't one of your own untagged devices on tailnet <tailnet>, the only devices P0 sets postures on. Yours are <devices>.`                                                | The device you named isn't yours, or it has tags.                                                                                      | Request again with one of the devices the message lists.                                              |
| A message that starts `You have more than one device on tailnet <tailnet>. Pick one in the Device field`                                                                          | You didn't say which of your devices to use.                                                                                           | Request again with one of the devices the message lists, in the **Device** field or with `--device`.  |

## Troubleshooting

| Message                                                                                                                                                                                                       | What to do                                                                                                                                                                                                                          |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Tailscale access needs an end. Request it again with a duration.`                                                                                                                                            | Your request had no duration. P0 changed nothing. Make a new request with `--duration`, or with a duration in the form.                                                                                                             |
| `Device <node ID> is tagged, so it belongs to its tags, not to <email>. Choose one of your own devices.` or `Device <node ID> isn't <email>'s. Choose one of your own devices.`                               | The device changed after you asked. P0 changed nothing. Make a new request for one of your own, untagged devices.                                                                                                                   |
| `Device <node ID> is shared into tailnet <tailnet> from another tailnet. Choose one of your own devices on tailnet <tailnet>.`                                                                                | The device belongs to another tailnet, and P0 sets postures only on the tailnet's own devices. P0 changed nothing. Make a new request for one of your own devices on the tailnet.                                                   |
| A message that ends `changed after you asked. Request access again.`                                                                                                                                          | The posture, or what it unlocks in the tailnet's policy file, changed after you asked. Your approver didn't see the change, so P0 changed nothing. Make a new request.                                                              |
| `Device <device> is no longer yours on tailnet <tailnet>. Request access again for one of your devices.`                                                                                                      | The device changed hands after you asked. Make a new request.                                                                                                                                                                       |
| `Device <node ID> isn't on tailnet <tailnet>. Choose one of your devices on the tailnet, then request again.`                                                                                                 | The device left the tailnet after you asked. Make a new request for one of your devices on the tailnet.                                                                                                                             |
| A message that includes `refused a custom device attribute`                                                                                                                                                   | Tailscale refused to set the posture on your device. Ask your P0 admin to check the tailnet's plan and the credential's scopes, as in [Tailscale](https://docs.p0.dev/integrations/resource-integrations/tailscale.md#on-requests). |
| `P0 couldn't reach the Tailscale connector. Ask your P0 admin to check its deployment.`                                                                                                                       | An admin checks that the connector is deployed, and that P0 can invoke it.                                                                                                                                                          |
| `P0's Tailscale connector couldn't read the OAuth client's secret. Ask your P0 admin to check the Tailscale install.`                                                                                         | An admin checks the OAuth client's secret, as in [Tailscale](https://docs.p0.dev/integrations/resource-integrations/tailscale.md#on-requests).                                                                                      |
| A message that starts `There is an unrecoverable error in your organization's Tailscale installation`                                                                                                         | Tailscale refused the connector's credential, or refused it a call. An admin fixes the install, as in [Tailscale](https://docs.p0.dev/integrations/resource-integrations/tailscale.md#on-requests).                                 |
| `The Tailscale connector for tailnet <tailnet> isn't installed, so P0 can't grant access on it. Ask your P0 admin to install it. Access that P0 already granted on <tailnet> may need to be removed by hand.` | An admin installs the tailnet's connector, as in [Tailscale](https://docs.p0.dev/integrations/resource-integrations/tailscale.md#on-requests).                                                                                      |
| `Tailscale is temporarily unavailable. Try again in a few minutes.`                                                                                                                                           | Try again in a few minutes.                                                                                                                                                                                                         |
| A message that says a posture can't be part of an Access Bundle                                                                                                                                               | The Access Bundle you requested holds a posture. Request the posture on its own.                                                                                                                                                    |
