This document outlines the process and key considerations for configuring Authentication Policies when leveraging Captive Portal in conjunction with SAML authentication on a Palo Alto Networks firewall.
Document ID: 24370
Created On 07/02/20 06:58 AM - Last Modified 08/01/20 02:23 AM
Relevant Concepts: SAML, Authentication, User-ID, PAN-OS (8.0, 8.1, 9.0), Prisma Access.
The primary goal is to detail the configuration steps for integrating SAML authentication into the Captive Portal workflow using Authentication Policies. This is particularly relevant for scenarios where users (like guests or BYOD devices) need to authenticate via a web form, and your identity provider supports SAML. The document highlights a crucial configuration caveat to ensure the SAML authentication flow functions correctly when the Identity Provider (IdP) traffic traverses the same firewall.
A fundamental understanding of general SAML concepts and basic Palo Alto Networks Authentication Policy configuration is assumed. For initial SAML and Authentication Policy setup, refer to the official PAN-OS Administrator's Guide sections on "Configure SAML Authentication" and "Configure Authentication Policy".
Configuring SAML Single Sign-On (SSO) involves establishing trust and communication between the Palo Alto Networks firewall (acting as the Service Provider, SP) and your Identity Provider (IdP). Certificates are essential for securing SAML transactions, ensuring the integrity and confidentiality of messages exchanged. Palo Alto Networks requires HTTPS for transport and digital signatures for message integrity.
You need certificates for both the firewall (to sign messages sent to the IdP) and the IdP (for the firewall to validate signed messages from the IdP).
This profile registers the IdP with the firewall and defines connection parameters. The recommended method is to import the IdP's metadata file, which automatically populates most settings and imports the IdP's signing certificate.
This profile defines the authentication settings that apply to a set of users or applications.
Assign the configured SAML authentication profile to the specific applications or services that require SAML authentication.
Commit your changes after assigning the profile.
To register the firewall application (Captive Portal, GlobalProtect, or management interface) with the IdP, you need to generate a SAML metadata file from the firewall and import it into your IdP. This file contains information about the firewall as a Service Provider, such as its assertion consumer service URL and signing certificate details.
The Authentication policy is evaluated early in the traffic flow, before the Security policy. It determines whether a session requires active user authentication via the Captive Portal. For Captive Portal with SAML, you need rules to trigger the portal for unknown users *and* a specific rule to exempt traffic to the IdP.
When the Identity Provider (IdP) is located on the internet or a network segment that requires traffic to pass *through* the same Palo Alto Networks firewall enforcing the Captive Portal policy, a critical configuration is needed. If you configure an Authentication policy rule to intercept all 'unknown' user traffic for Captive Portal authentication, the initial SAML request from the user's browser (redirected by the firewall) to the IdP will also match this rule. This creates a loop where the firewall tries to authenticate the IdP traffic, preventing the SAML handshake from completing.
To prevent this, you MUST configure an Authentication policy rule *above* your main Captive Portal rule that specifically permits traffic to your IdP's URL or IP address without triggering the Authentication Portal.
Authentication policy rules showing the 'Exclude-Auth-rule' above the 'CP-Auth-Rule'.
Details of the 'Exclude-Auth-rule' using 'default-no-captive-portal' and a Custom URL Category for the IdP.
An Authentication Enforcement object defines *how* the authentication challenge is presented (e.g., web form) and links it to the specific Authentication Profile (which contains your SAML settings).
For the "Exclude-Auth-rule" mentioned in the caveat, you would typically use the built-in "default-no-captive-portal" enforcement object or create one that has no authentication method defined.
You need at least two rules for the SAML Captive Portal caveat scenario: one to exclude IdP traffic and one to trigger the portal for unknown users.
Arrange the 'Exclude-SAML-IdP' rule to be evaluated *before* the 'Trigger-SAML-Captive-Portal' rule.
If your SAML IdP integrates with MFA, the firewall might display a page for the second factor. This page can often be customized.
Refer to the documentation on customizing the MFA login page if you are using integrated MFA services.
After configuring the SAML Authentication Profile, Authentication Enforcement object, and the Authentication Policy rules (including the IdP exclusion), verify that the setup functions as expected.
Example of an Identity Provider login page after redirection.
(Optional) If redistributing user mappings to other firewalls, verify that the user-to-IP mapping and authentication timestamps are correctly synchronized.
This diagram illustrates the high-level flow when an unknown user is directed to the Captive Portal using SAML.
graph TD A[User Initiates Traffic (e.g., HTTP/S)]; A --> B{Firewall Evaluates Policy}; B -- User Unknown & Matches CP Rule --> C[Trigger Authentication Portal]; C --> D[Firewall Redirects User to CP Web Form]; D --> E[User Submits Credentials/Initates SAML on CP Form]; E --> F{Firewall Creates SAML Auth Request}; F --> G[Firewall Redirects User to IdP Login URL]; G --> H[User Authenticates at IdP]; H --> I{IdP Generates SAML Assertion}; I --> J[IdP Redirects User (Assertion in Browser) back to Firewall URL]; J --> K{Firewall Receives SAML Assertion}; K --> L{Firewall Validates Assertion (Signature, Timestamps) & User Identity}; L -- Validation Successful --> M[Firewall Creates User-to-IP Mapping]; M --> N[Original User Traffic Allowed Based on Identity Policies]; L -- Validation Failed --> O[Access Denied];
This diagram highlights how the IdP exclusion rule prevents the SAML communication from being intercepted by the main Captive Portal rule.
graph TD A[User Initiates Traffic] A --> B{Firewall Receives Session} B --> C{User-ID Mapping Check?} C -- Yes, Known --> D[Apply Security Policy based on User] C -- No, Unknown --> E[Evaluate Authentication Policy] E --> F{Rule 1: Matches Exclude-SAML-IdP Rule?} F -- Yes (Traffic to IdP URL) --> G[Action: default-no-captive-portal] G --> H[Allow traffic to IdP] F -- No --> I{Rule 2: Matches Trigger-SAML-Captive-Portal Rule} I -- Yes --> J[Action: SAML-Captive-Portal-Enforcement] J --> K[Trigger Captive Portal SAML flow begins] I -- No Match or Deny Rule Match --> L[Apply default or subsequent Policy Deny unknown users] H --> M[SAML Flow Continues, User Authenticates] M --> N[Firewall Creates User-ID Mapping] N --> D
Implementing Captive Portal with SAML authentication on Palo Alto Networks firewalls provides a flexible and secure way to onboard and identify users, particularly in guest or BYOD scenarios. The process involves careful configuration of SAML server profiles, authentication profiles, and crucially, the Authentication Policy rules. The key caveat to remember is the necessity of an explicit Authentication policy rule to exempt traffic destined for the SAML Identity Provider, ensuring the authentication flow can complete without being intercepted by the Captive Portal trigger rule itself. By following these steps and correctly ordering your Authentication Policy rules, you can successfully integrate SAML into your Captive Portal workflows, leveraging your existing identity infrastructure.