Skip to content
AnswerWell geo Documentation

Research · 8 min read · Answerwell

Infrastructure SSH Access, Short-Lived Certificates, Sessions, and Command Logs

How Cloudflare Access for Infrastructure secures SSH with certificates, policies, session limits, MFA, logging, and common setup mistakes.

This page summarises Cloudflare documentation on Access for Infrastructure: protocol-aware SSH access with short-lived certificates, per-user and per-port policies, session limits, and encrypted command logging. It focuses on native SSH clients with the Cloudflare One Client and WARP-to-Tunnel; browser SSH and client-side cloudflared are alternate paths described in SSH use cases.

Access for Infrastructure: what it is and when to use it

Section titled “Access for Infrastructure: what it is and when to use it”

Access for Infrastructure is an infrastructure application type that controls who can connect to servers, which UNIX usernames and ports they may use, and (with logging enabled) which commands they run. Infrastructure applications differ from self-hosted Access applications: self-hosted rules decide whether a user can reach a destination, while infrastructure applications also govern authorization after connect—usernames, ports, and commands.

Infrastructure applications provide protocol-aware access control for servers and infrastructure targets, whether reachable over a public hostname or a private network. Unlike self-hosted applications, which evaluate whether a user can reach a destination, infrastructure applications also control what a user can do after connecting — which usernames they can authenticate as, which ports they can access, and which commands they can run.

— Cloudflare, Choose an application type

Use an infrastructure application when you need short-lived SSH certificates, protocol-level policy, and command logging. Add an infrastructure application notes that only SSH is supported for this application type today; other protocols on private networks typically use a self-hosted private application. Infrastructure applications require the Cloudflare One Client; private targets also need Cloudflare Tunnel or Cloudflare Mesh.

Method Best for Certificates / keys Command logs
SSH with Access for Infrastructure Granular SSH policy, audit Short-lived Cloudflare SSH certificates Yes (with setup)
Self-managed SSH keys Keep existing keys, Gateway-only policy Your long-lived keys No
Client-side cloudflared SSH without Cloudflare One Client Access login + tunnel No
Browser-rendered SSH Quick admin from any browser Varies No

If you want to create more granular policies, allow Cloudflare to manage SSH keys for you, or to obtain command logs, consider using Access for Infrastructure instead.

— Cloudflare, Connect with self-managed SSH keys

Legacy short-lived certificates tied to self-hosted applications are not recommended for new deployments; new SSH certificate flows should use Access for Infrastructure.

Short-lived SSH certificates and the Cloudflare SSH CA

Section titled “Short-lived SSH certificates and the Cloudflare SSH CA”

SSH with Access for Infrastructure replaces long-lived user SSH keys with certificates issued from the user’s Access login.

SSH with Access for Infrastructure uses short-lived SSH certificates from Cloudflare, eliminating SSH key management and reducing the security risks associated with lost or stolen keys.

— Cloudflare, SSH with Access for Infrastructure

How to generate the SSH certificate authority (CA)

Section titled “How to generate the SSH certificate authority (CA)”

You can create the Cloudflare SSH CA in the Cloudflare One dashboard under Access controls → Service credentials, or via the Gateway CA API as described in SSH with Access for Infrastructure.

Previously, users had to generate this certificate by using the Cloudflare API ↗︎ directly. With this update, you can now create and manage this certificate in the Cloudflare One dashboard ↗︎ from the Access controls > Service credentials page.

— Cloudflare, Generate Cloudflare Access SSH certificate authority (CA) directly from the Cloudflare dashboard

On each SSH target, install the CA public key (for example in /etc/ssh/ca.pub) and set:

  • PubkeyAuthentication yes
  • TrustedUserCAKeys /etc/ssh/ca.pub

Add an infrastructure application and SSH with Access for Infrastructure describe trusting the Cloudflare SSH CA and authorizing configured usernames on the target. Cloudflare does not create UNIX users; accounts must already exist on the server.

Users connect with a normal SSH client while enrolled in the Cloudflare One Client, for example ssh <username>@<target IP>. SSH with Access for Infrastructure also supports scp, sftp, and rsync; SFTP support notes compatibility with clients such as Cyberduck.

Session duration: infrastructure applications vs Gateway limits

Section titled “Session duration: infrastructure applications vs Gateway limits”

Two different limits often confuse operators: infrastructure application session duration and Gateway proxy connection duration.

Configurable infrastructure application session duration

Section titled “Configurable infrastructure application session duration”

Infrastructure applications enforce a session duration (default 24 hours). When it elapses, active SSH sessions through that application are closed and users must reconnect.

Infrastructure applications now have a configurable session duration with a default value of 24 hours. You can set the session duration when creating or editing an infrastructure application in the dashboard or via the API.

— Cloudflare, Infrastructure applications support a configurable session duration

When the session duration elapses, any active SSH connections through that application will be closed, and users will need to reconnect.

— Cloudflare, Infrastructure applications support a configurable session duration

If a target matches multiple infrastructure applications, the shortest session duration applies. Configure session duration on the application in Session management (SSH, RDP, and VNC section) or via API (session_duration in whole seconds).

Ten-hour Gateway guarantee and client-session behavior

Section titled “Ten-hour Gateway guarantee and client-session behavior”

Separately, all traffic proxied through Cloudflare Gateway—including Access for Infrastructure SSH—has a maximum guaranteed duration of 10 hours.

All connections proxied through Cloudflare Gateway, including traffic to Access to Infrastructure SSH targets, have a maximum guaranteed duration of 10 hours.

— Cloudflare, Troubleshoot Access

Proxy endpoints repeat this 10-hour limit. To reduce surprise disconnects, Cloudflare recommends scheduled termination (for example an 8-hour idle timeout) via ChannelTimeout on the SSH server or client, as in Troubleshoot Access.

For Cloudflare One Client session duration on Access or Gateway policies, Client sessions states that active SSH connections are not terminated when only the device client session expires. That differs from infrastructure application session duration, which does close proxied SSH when the infrastructure session ends (Session management).

Designing ZTNA access policies explains why shorter session durations align with continuous verification; infrastructure SSH is one place that enforcement can cut off live sessions.

MFA for SSH: policy, application, and YubiKey PIV

Section titled “MFA for SSH: policy, application, and YubiKey PIV”

MFA session duration for SSH controls how often users must pass MFA before opening a new connection; it does not drop an already-active session.

The MFA session duration determines how long users can open new SSH connections without another MFA prompt. Set the duration to 0m to require MFA for every new connection. Expiration does not terminate an active connection.

— Cloudflare, Enforce MFA

Evaluation order: policy-level duration, then application-level, then organization-level; when multiple policies match, the shortest duration wins (Enforce MFA).

Independent MFA for infrastructure applications adds YubiKey PIV as a hardware-backed second factor for SSH, with per-application and per-policy rules (for example stricter requirements for root). Client setup for PIV/FIDO2 is covered in Independent MFA.

Access for Infrastructure can record SSH commands for compliance and incident review.

Access authentication logs for infrastructure applications include hostname, target ID, SSH user, and SSH commands when logging is configured. SSH command logs describe session metadata (session ID, user email, addresses, timestamps, program type, encrypted payload).

Prerequisites from SSH command logs:

  • Access for Infrastructure on the SSH servers
  • An uploaded SSH log encryption public key (HPKE); dashboard payloads are encrypted and must be downloaded and decrypted locally with the SSH Logging CLI

SSH with Access for Infrastructure notes downloadable logs are best-effort; Enterprise customers can use Logpush for guaranteed delivery. Logpush payloads are not encrypted with your customer public key—protect the destination accordingly (SSH command logs).

Section titled “Private hostname applications on non-443 ports (related)”

SSH over infrastructure apps is distinct from securing arbitrary TCP via private hostname Access applications. Access private hostname applications support all ports/protocols removed the earlier HTTPS-on-443 + SNI requirement so SSO, MFA, device posture, and session lengths can apply to SSH, RDP, databases, and other private services reachable via a Cloudflare off-ramp. Use choose application type to pick infrastructure vs self-hosted private apps.

Common mistakes and unsupported SSH features

Section titled “Common mistakes and unsupported SSH features”
Symptom / error Typical cause What to check
Error 0: Bad Request. Please create a ca for application No CA for the application Generate CA per Troubleshoot Access
SSH “Origin auth failed” sshd misconfiguration PubkeyAuthentication yes, correct TrustedUserCAKeys; no multi-method AuthenticationMethods
Certificate accepted but login fails Principal mismatch AuthorizedPrincipalsFile / AuthorizedPrincipalsCommand per SSH with Access for Infrastructure
Target missing for user Policy or routing warp-cli target list, Split Tunnels, device profile (SSH with Access for Infrastructure)

Cloudflare Access for Infrastructure currently does not support AuthenticationMethods with multiple comma-separated requirements (for example, publickey,keyboard-interactive).

— Cloudflare, Troubleshoot Access

SSH with Access for Infrastructure lists unsupported features: local/remote port forwarding, ProxyJump, SSH agent forwarding, and X11 forwarding. Plan workflows without these patterns.

Authenticate coding agents notes cloudflared sessions follow the application’s configured session duration and require browser login again after expiry. For automation, Client-side cloudflared recommends service tokens or WARP-to-Tunnel when WebSocket instability is a concern—not interactive cloudflared alone.

  1. On a enrolled device, run warp-cli target list and confirm the SSH target, port, and allowed usernames match your policy (SSH with Access for Infrastructure).
  2. Open Access authentication logs in Cloudflare One and verify a test login shows the infrastructure target, SSH user, and (if enabled) SSH log fields.
  3. After enabling command logging, download and decrypt a test session via SSH command logs and your SSH Logging CLI private key.
  4. Confirm infrastructure Session duration on the application matches your policy, and expect disconnects at the shorter of that value, overlapping application matches, or the Gateway 10-hour ceiling (Session management, Proxy endpoints).
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about so it can be corrected.