For the complete documentation index, see llms.txt. This page is also available as Markdown.

p0 ssh

Securely access a VM on GCP or AWS without long-lived keys or open firewall rules.


Overview

Use the p0 ssh command to securely access VMs on both GCP and AWS without long-lived keys or open firewall rules.

  • Common concepts: alias discovery, permission requests, ProxyCommand anatomy, cleanup

  • How to install and configure prerequisites for each cloud

  • Step-by-step examples for interactive shells, one-off commands, port-forwarding, sudo requests

  • Provider-specific flags, Windows quoting tips, and troubleshooting

  • Security guarantees and quick “vault” of handy commands


Why use p0 SSH?

p0 enables secure, auditable, on-demand SSH access to cloud VMs without static keys or open ingress. It handles permission requests, key management, and in-tunnel auditing.


Prerequisites

Before you can use p0 ssh, ensure you have:

  • Cloud SDK / CLI

    • GCP: gcloud SDK (for compute start-iap-tunnel)

    • AWS: AWS CLI + Session Manager plugin (for ssm start-session)

    • Azure: Azure CLI + the ssh extension (for az ssh cert)

Azure requires the Azure CLI ssh extension. p0 ssh --provider azure runs az ssh cert, which the base Azure CLI install does not include. Install the extension before your first Azure SSH session:

If az ssh cert fails because the extension is missing, p0 ssh prints these install instructions. If the extension is present but fails to load — usually after an Azure CLI or Python upgrade — reinstall it:

  • Logged-in User

    • Authentication

      • GCP: gcloud credentials for the IAP tunnel. The CLI runs gcloud auth login automatically when these credentials are missing or expired.

        • AWS: valid AWS credentials (SSO or API keys)

        • Azure: Valid Azure Credentials or Keys

  • p0 identity: you must sign in with p0 login so you can file requests on your behalf

  • Project/account mapping: your org’s p0 config must map SSH destination to real instances

Discover available instance aliases

This command shows the aliases your platform team has registered (GCE instance names or EC2 instance IDs). Listing does not imply you already have access -- you still need approval.

Command anatomy

  • --provider: choose your cloud (gcloud, aws, azure, or self-hosted)

  • [p0-flags]: for example, --reason, --sudo, --debug

  • --: separates p0 flags from native SSH options

  1. Hands-on examples

    1.1 GCP interactive shell

    Under the hood:

    1. Creates a Permission Request (provider=gcloud, with your reason).

    2. Notifies approvers (for example, via Slack).

    1.1.1 One-off command

    Exit code of df bubbles up locally, ideal for scripting.

    1.1.2 Reverse port-forward

    1.1.3 Request sudo

    Adds a NOPASSWD sudoers entry for your user; approvers see sudo=true for extra scrutiny.

    1.2 AWS interactive shell

    Under the hood:

    1. Approver clicks “Approve” (for example, in Slack).

    2. p0 grants you a temporary SSM session policy and uploads your public key.

    3. CLI loops aws ssm start-session in a ProxyCommand until access is allowed.

    4. Opens the SSH handshake over the SSM tunnel.

    1.2.1 Local port-forward

    1.2.2 Request sudo

    p0 writes a short-lived /etc/sudoers.d/p0-<id> entry granting NOPASSWD ALL to your temp user.

    Prints full aws ssm start-session invocation and the final ssh … you could re-run manually.

Provider-specific flag reference

  • Common flags: --reason, --sudo, --debug, --parent, --provider

  • GCP only: none beyond common (relies on gcloud’s config)

  • AWS only: pass AWS-specific SSH options after -- (the separator between P0 flags and raw SSH flags)

Windows Note:

In PowerShell, wrap the entire SSH tail in double quotes and escape inner quotes with backslash.

Quick command vault

List all aliases, for any provider:

Start an interactive session with an explicit GCP project:

Copy a local directory to a GCP VM, using scp over IAP:

Copy a build artifact to AWS EC2, using SSM and scp:

Print dry-run debug output:

Last updated