Black Belt: Palo Alto GlobalProtect Pre-Logon: Machine Certificates and the Logon Transition
Pre-logon solves the chicken-and-egg problem of a laptop that needs the VPN to reach the domain, but needs the domain to log a user in. The device authenticates with a machine certificate before anyone touches the keyboard, and the tunnel is rebuilt as the user once they sign in. Getting it right means understanding the two identities, the two tunnels, and the handoff between them.
Two identities, one laptop
| Phase | Who connects | How it authenticates | What it should reach |
|---|---|---|---|
| Pre-logon | The machine. The GlobalProtect service runs as SYSTEM, before the Windows logon screen. | Machine certificate from the Local Machine store, validated by a certificate profile on the portal and gateway. | Domain controllers, DNS, Intune/MDM, KMS, software updates. Nothing else. |
| User | The person, after Windows logon. | SAML, LDAP or client certificate, per the portal's user authentication settings. | Whatever your normal user policy allows. |
In the firewall's eyes the pre-logon session has a literal username of pre-logon. That string is what you write security policy against. Treat it like an untrusted service account: narrow destinations, narrow applications, logged.
Configuration, in order
- Certificates. Endpoints need a machine certificate (Intune SCEP or AD autoenrollment) in Local Computer → Personal, with the Client Authentication EKU. The firewall needs the issuing CA chain imported, and a Certificate Profile that references it. Set the username field in the profile to Subject Common Name (or SAN) so logs show the hostname.
- Portal → Authentication. Add the certificate profile to the portal's client authentication. For pre-logon the portal must accept the certificate alone; add a second client authentication entry for the user phase (SAML or LDAP) and order it so the OS-specific pre-logon entry is matched first.
- Portal → Agent config. Create a config whose Config Selection Criteria → User/User Group is
pre-logon. Under App, set Connect Method to Pre-logon (Always On). Below it, a second agent config for your user group with its own connect method (User-logon (Always On) is typical). - Gateway → Authentication. Same certificate profile and the same two client-authentication entries. The gateway is where the tunnel actually terminates, so it has to accept both identities too.
- Gateway → Agent → Client Settings. A client-settings entry for
pre-logonthat hands out an IP pool, split-tunnel includes for DC, DNS and MDM subnets, and nothing broad. A second entry for users. - Security policy. Rules from the VPN zone with source user =
pre-logon: allowdns,ldap,kerberos,msrpc,ms-ds-smb,ntpto the domain controllers; allowsslto the Intune and Windows Update FQDNs. Deny the rest, logged. User rules sit below.
Pre-logon vs. pre-logon then on-demand
Pre-logon (Always On) keeps the user connected after logon. Pre-logon then On-Demand tears the machine tunnel down at logon and leaves the user to connect manually. The first is what most managed fleets want; the second suits shared or kiosk machines where the user session should not inherit a connection.
What actually happens at logon
- Windows boots. The PanGPS service starts, finds the machine certificate, connects to the portal, downloads the
pre-logonagent config and builds a tunnel to the gateway as userpre-logon. The logon screen appears with the tunnel already up, so the laptop can reach a domain controller for a first-time logon or a password change. - The user signs in. The agent now has a user context. It re-authenticates to the portal as the user (SAML pops a browser, or certificate/LDAP happens silently) and pulls the user agent config.
- The agent then connects to the gateway as the user. On PAN-OS the pre-logon tunnel is replaced rather than renamed: the firewall ends the
pre-logonsession and establishes a new one for the username. Most of the time this is a sub-second gap; applications that hold long-lived TCP sessions across logon (rare) will see a reset. - From here, security policy for the user applies. The
pre-logonrules no longer match, so anything that depended on them during the gap (a logon script that starts the instant the desktop appears) must also be allowed for the user.
The classic failure: user logon never completes the switch
If the user-phase authentication fails, the agent stays connected as pre-logon and the user has a VPN that reaches only domain controllers. In PanGPS.log look for portal prelogon followed by the user-phase GetConfig; a SAML or LDAP error there is the cause. On the firewall, show global-protect-gateway current-user still showing pre-logon for that machine confirms it.
Verify
admin@PA-5410> show global-protect-gateway current-user gateway GP-GW-1
Username : pre-logon
Computer : WS-0423
Client : Microsoft Windows 11 Enterprise
Virtual IP : 172.16.50.17
Login Time : Nov.03 07:41:02
admin@PA-5410> show global-protect-portal current-user
admin@PA-5410> show log globalprotect direction equal backward | match WS-0423
admin@PA-5410> show log traffic query equal "(user.src eq 'pre-logon')" direction equal backward
PS C:\> Get-Content "C:\Program Files\Palo Alto Networks\GlobalProtect\PanGPS.log" -Tail 200 | Select-String -Pattern "prelogon|pre-logon|GetConfig|cert"
A healthy sequence in the GlobalProtect log on the firewall is: portal-prelogon succeeded for the hostname → gateway-prelogon connected → a few minutes later portal-auth and gateway-login for the real user. Traffic logs filtered on user.src eq 'pre-logon' show you exactly what the machine reached before anyone logged in, which is also what an auditor will ask for.
Design notes
- Certificate renewal happens during the pre-logon phase on an unattended machine, so the SCEP or autoenrollment path must be reachable through the pre-logon policy, or renewals will silently fail and the machine will stop connecting a year later.
- Split tunnel the pre-logon phase tightly and consider full tunnel for users. The machine identity is only as strong as physical possession of the laptop.
- HIP checks run in both phases if enabled. Make the pre-logon HIP profile lenient (disk encryption on, that is all) or a machine that fails HIP at boot can never reach the systems that would fix it.
- Entra-joined, no AD? Pre-logon still works and is still useful: the machine tunnel reaches Intune, update services and internal apps that use cloud identity. The user phase is SAML to Entra ID. You simply have no domain controllers in the pre-logon rules.
Summary
- Pre-logon is a machine-certificate tunnel as user
pre-logon; write policy for that user as if it were a service account. - Portal and gateway both need the certificate profile and both authentication entries, plus a
pre-logonagent config and client settings. - At logon, the machine tunnel is torn down and replaced by the user's; a failed user authentication leaves the device stuck as
pre-logon. - Verify with
show global-protect-gateway current-user, the GlobalProtect log, andPanGPS.logon the endpoint.