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(forcompute start-iap-tunnel)AWS:
AWS CLI+ Session Manager plugin (forssm start-session)Azure:
Azure CLI+ thesshextension (foraz ssh cert)
Logged-in User
Authentication
GCP: gcloud credentials for the IAP tunnel. The CLI runs
gcloud auth loginautomatically 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 loginso you can file requests on your behalfProject/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, orself-hosted)[p0-flags]: for example,--reason,--sudo,--debug--: separates p0 flags from native SSH options
Hands-on examples
1.1 GCP interactive shell
Under the hood:
Creates a Permission Request (
provider=gcloud, with your reason).Notifies approvers (for example, via Slack).
1.1.1 One-off command
Exit code of
dfbubbles 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=truefor extra scrutiny.1.2 AWS interactive shell
Under the hood:
Approver clicks “Approve” (for example, in Slack).
p0 grants you a temporary SSM session policy and uploads your public key.
CLI loops
aws ssm start-sessionin a ProxyCommand until access is allowed.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-sessioninvocation and the finalssh …you could re-run manually.
Provider-specific flag reference
Common flags:
--reason,--sudo,--debug,--parent,--providerGCP 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)
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