Перейти к содержимому

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).

PlatformSoftwareModesWhat was verified
FortiGate-VM64 (multi-VDOM), admin GUI SAML SSOFortiOS 7.6.7 build3704password + MFAAdmin 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
  • Admin GUI sign-in only. Agentless VPN and firewall authentication over SAML use a different FortiOS configuration (config user saml per 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 group attribute 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.
  • 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.com below) and does not let you edit them; enter them in OkYouIn exactly like this:

    SettingValue
    SP Entity IDhttp://fortigate.example.com/metadata/ — http and the trailing slash, also when the GUI is on https
    ACS endpointshttps://fortigate.example.com/saml/?acs
    SP single logout URLhttps://fortigate.example.com/saml/?sls, binding HTTP-Redirect
    NameID formatUnspecified, NameID value: Username
    Attribute mappingusername (username), group (groups, multi-valued)
  • The application’s SAML slug — fortigate in the examples — is part of every IdP URL. The Connect tab shows the CLI with your slug and host.

  1. Import the signing certificate (the application’s certificate.pem, for example https://mfa.example.com/saml/fortigate/certificate.pem) as a remote certificate: System ▸ Certificates ▸ Create/Import ▸ Remote Certificate, or the CLI. With VDOMs, do it in config global. The name you choose (OkYouIn-SAML-1 here) is what idp-cert refers to.

    config global
    config certificate remote
    edit "OkYouIn-SAML-1"
    set remote "<paste certificate.pem, BEGIN to END lines>"
    next
    end
    end
  2. Enable admin SSO (a global setting with VDOMs):

    config global
    config system saml
    set status enable
    set role service-provider
    set default-login-page normal
    set 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 enable
    end
    end

    The 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.

  3. Give administrators their profile and VDOM (next section), and allow the application in the policy.

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
end
end

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.”).

FortiOS trusts exactly one IdP certificate (idp-cert) and does not read metadata:

  1. Prepare the next certificate in OkYouIn (state Next).
  2. Before activating, import it on the FortiGate as a second remote certificate, from https://mfa.example.com/saml/fortigate/certificate.pem?which=next (for example OkYouIn-SAML-2).
  3. Click Activate next in OkYouIn and right after it run set idp-cert "OkYouIn-SAML-2" in config 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.

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.

  1. 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).
  2. Logging ▸ SSO sign-in log shows the SAML sign-in with the MFA round and the allow.
SymptomCause
”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 pageThe SSO administrator’s VDOM differs from the VDOM of the interface the GUI is reached through.
Everyone gets the default profileExpected: groups are not used for admin SSO. Set accprofile per sso-admin.
OkYouIn refuses the requestThe SP Entity ID must be http://…/metadata/ with the trailing slash, exactly as FortiOS derives it.