FortiGate admin (SAML)
This template puts OkYouIn in front of the FortiGate administrator GUI as its SAML 2.0 identity provider (FortiGate is the service provider). The login page gains a Sign in with Single Sign-On button; administrators sign in on OkYouIn’s page with their password and second factor. For OkYouIn’s SAML IdP in general, see SAML 2.0.
For FortiClient VPN, firewall authentication and admin SSH over RADIUS, see FortiGate (RADIUS).
Verified on
Section titled “Verified on”| Platform | Software | Modes | What was verified |
|---|---|---|---|
| FortiGate-VM64 (multi-VDOM), admin GUI SAML SSO | FortiOS 7.6.7 build3704 | password + MFA | Admin GUI SSO with TOTP; single sign-on without a prompt; MFA asked again after the session lifetime; policy deny; single logout; signing modes (only Response and assertion with require-signed-resp-and-asrt); username attribute required (NameID ignored); admin profile and VDOM per SSO administrator; rotation through a pre-imported next certificate |
What works — and what does not
Section titled “What works — and what does not”- Admin GUI sign-in only. Agentless VPN and firewall authentication over SAML use a different
FortiOS configuration (
config user samlper VDOM) and a separate application; that variant is not verified. - Second factor: TOTP was verified. Push and e-mail MFA were not tested.
- Groups are not used for admin SSO: FortiOS 7.6 ignores the
groupattribute here. The admin profile and VDOM are set per SSO administrator on the FortiGate. - IdP-initiated sign-in is refused by FortiOS (“Single Sign-On Failed”): keep IdP-initiated sign-in off.
Before you start
Section titled “Before you start”-
OkYouIn’s public URL (Settings ▸ General) must be an
https://address. -
Keep a local administrator. The SSO button sits next to the normal login; keep a local super-admin account and a second admin session open while you change admin login.
-
Create the application in Access ▸ Applications ▸ Add application ▸ FortiGate admin (SAML). FortiOS derives its service-provider URLs from
server-address(the address browsers use for the GUI,fortigate.example.combelow) and does not let you edit them; enter them in OkYouIn exactly like this:Setting Value SP Entity ID http://fortigate.example.com/metadata/—httpand the trailing slash, also when the GUI is on httpsACS endpoints https://fortigate.example.com/saml/?acsSP single logout URL https://fortigate.example.com/saml/?sls, binding HTTP-RedirectNameID format Unspecified, NameID value: Username Attribute mapping username(username),group(groups, multi-valued) -
The application’s SAML slug —
fortigatein the examples — is part of every IdP URL. The Connect tab shows the CLI with your slug and host.
Configure
Section titled “Configure”-
Import the signing certificate (the application’s
certificate.pem, for examplehttps://mfa.example.com/saml/fortigate/certificate.pem) as a remote certificate: System ▸ Certificates ▸ Create/Import ▸ Remote Certificate, or the CLI. With VDOMs, do it inconfig global. The name you choose (OkYouIn-SAML-1here) is whatidp-certrefers to.config globalconfig certificate remoteedit "OkYouIn-SAML-1"set remote "<paste certificate.pem, BEGIN to END lines>"nextendend -
Enable admin SSO (a global setting with VDOMs):
config globalconfig system samlset status enableset role service-providerset default-login-page normalset default-profile "<read-only admin profile>"set server-address "fortigate.example.com"set idp-entity-id "https://mfa.example.com/saml/fortigate"set idp-single-sign-on-url "https://mfa.example.com/saml/fortigate/sso"set idp-single-logout-url "https://mfa.example.com/saml/fortigate/slo"set idp-cert "OkYouIn-SAML-1"set require-signed-resp-and-asrt enableendendThe GUI login page then shows Sign in with Single Sign-On next to the local login;
https://fortigate.example.com/saml/login/starts the SSO directly. -
Give administrators their profile and VDOM (next section), and allow the application in the policy.
Administrators, profiles and VDOMs
Section titled “Administrators, profiles and VDOMs”FortiOS takes the administrator name from the username attribute (the OkYouIn username)
and ignores the NameID; without the attribute it refuses the sign-in (“username is missing in
SAML assertion attributes”).
The first sign-in creates an SSO administrator (config system sso-admin, shown as
<name> (SSO)) with default-profile. Keep that a read-only or no-access profile, and pre-create
or edit the entries of users who need more:
config global config system sso-admin edit "<OkYouIn username>" set accprofile "<admin profile>" set vdom "<VDOM>" next endendSignatures
Section titled “Signatures”Keep Sign at Response and assertion and require-signed-resp-and-asrt enable. Without
that FortiOS option it accepts a Response signed on either level only; with it, Assertion only
or Response only is refused (“Response validation failed. SAML Response rejected.”).
Certificate rotation
Section titled “Certificate rotation”FortiOS trusts exactly one IdP certificate (idp-cert) and does not read metadata:
- Prepare the next certificate in OkYouIn (state Next).
- Before activating, import it on the FortiGate as a second remote certificate, from
https://mfa.example.com/saml/fortigate/certificate.pem?which=next(for exampleOkYouIn-SAML-2). - Click Activate next in OkYouIn and right after it run
set idp-cert "OkYouIn-SAML-2"inconfig system saml. Sign-ins fail in between; a Revert needs the same switch back.
Put this application on its own certificate (Signing certificate ▸ Own certificate) so a rotation of the global certificate does not touch the FortiGate.
Sign-out
Section titled “Sign-out”Logout of an SSO administrator sends a LogoutRequest (unsigned). OkYouIn asks “Sign out?”, ends its session and returns to the FortiGate login page; the next sign-in asks for the password again. Other applications of the same OkYouIn session are not signed out, and revoking a session in Logging ▸ SSO sessions does not end a GUI session that is already open.
Verify
Section titled “Verify”- In a private window, open the FortiGate GUI and click Sign in with Single Sign-On. After
password and code FortiOS reports “Single Sign-On was successful” and opens the GUI as
<username> (SSO). - Logging ▸ SSO sign-in log shows the SAML sign-in with the MFA round and the allow.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause |
|---|---|
| ”Single Sign-On Failed — Response validation failed. SAML Response rejected.” | FortiOS’s message for every refused Response: policy deny (see the SSO sign-in log), a signing mode other than Response and assertion, or a certificate that does not match idp-cert. |
| ”username is missing in SAML assertion attributes” | The username row is missing from Attribute mapping. |
| Sign-in succeeds at OkYouIn, then back to the FortiGate login page | The SSO administrator’s VDOM differs from the VDOM of the interface the GUI is reached through. |
| Everyone gets the default profile | Expected: groups are not used for admin SSO. Set accprofile per sso-admin. |
| OkYouIn refuses the request | The SP Entity ID must be http://…/metadata/ with the trailing slash, exactly as FortiOS derives it. |