Installing Privileged Access for SSH
Deploy the Gateway and configure SSH access using the Twingate Terraform provider.
The recommended way to install Privileged Access for SSH is with the Twingate Terraform provider, which publishes complete, runnable examples. Each guide includes the full Terraform configuration, startup scripts, and step-by-step deployment instructions for a specific cloud.
Prerequisites
- A Twingate account with administrator privileges
- A Remote Network
- The Twingate Client meeting the minimum version requirements
- Terraform installed
What the Terraform guides set up
Each guide creates the same pieces, in this order:
- Two certificate authorities. An X.509 CA secures the TLS connection between the Twingate Client and the Gateway. An SSH CA signs the short-lived certificates the Gateway uses to sign in to target servers.
- Twingate objects. A Remote Network, both CAs registered with Twingate (
twingate_x509_certificate_authority,twingate_ssh_certificate_authority), atwingate_gateway, and a Connector with its tokens. - An SSH Resource. A
twingate_ssh_resourcebound to the Gateway, with access granted to a Group. - The Gateway. A VM running the Twingate Gateway with a YAML configuration that points to its TLS certificate, the SSH CA key, and the account it signs in as (
ssh.gateway.username). - The target SSH server.
sshdconfigured to trust the SSH CA (TrustedUserCAKeys), with a Linux account that matchesssh.gateway.username.
Terraform quick-start guides
These guides use a local SSH CA for simplicity, where the Gateway holds the CA private key and signs certificates directly. This is a good way to try out SSH access through the Gateway.
- Local SSH CA on AWS — Deploy a Gateway with SSH access on AWS.
- Local SSH CA on DigitalOcean — Deploy a Gateway with SSH access on DigitalOcean.
- Local SSH CA on GCE — Deploy a Gateway with SSH access on Google Compute Engine.
Manual installation without Terraform
To run the Gateway as a Docker container and register it with the Twingate GraphQL API instead of Terraform, follow the Gateway SSH installation guide. It covers generating both CAs, creating the Gateway and SSH Resource, writing the Gateway configuration, and configuring each SSH server to trust the CA.
Vault as SSH CA
For production deployments, the Gateway can use HashiCorp Vault’s SSH secrets engine to sign certificates instead of a local CA. See the Vault integration guide for setup instructions.
Sign target server host keys
By default, the Gateway trusts each target server’s host key on first use (TOFU). To remove TOFU, sign each server’s host key with the SSH CA so the Gateway verifies it against the CA on every connection.
-
On each target server, sign the host key with the SSH CA private key:
sudo ssh-keygen -s ssh_ca -I <hostname> -h \-n <hostname>,<address> -V +52w \/etc/ssh/ssh_host_ed25519_key.pubThis writes
/etc/ssh/ssh_host_ed25519_key-cert.pub. The-V +52woption makes the certificate valid for 52 weeks, so re-sign before it expires. -
Add the host key and certificate to the
sshdconfiguration, for example in/etc/ssh/sshd_config.d/twingate.conf:HostKey /etc/ssh/ssh_host_ed25519_keyHostCertificate /etc/ssh/ssh_host_ed25519_key-cert.pubTrustedUserCAKeys /etc/ssh/twingate_ca.pub -
Reload
sshd.
Next steps
After the Gateway is running and your SSH Resources are accessible, see Remote Development with VS Code to set up VS Code Remote SSH.
Last updated