Repository navigation
network: support fortinet vpn with saml and password auth - #3384
Conversation
Adds Fortinet gateway support to the NetworkManager openconnect path. A SAML gateway authenticates through the browser, with the loopback redirect handled in core and the session traded for the cookie openconnect needs. Certificate trust is confirmed once and stored as the digest openfortivpn uses. openfortivpn config files can be imported as profiles. A saml-login line selects the browser login, anything else imports as a password profile carrying whatever credentials the file had. Co-Authored-By: Claude Opus 5 <[email protected]>
e011e68 to
146bbe5
Compare
|
/claude review |
Claude reviewNo issues found. Checked: the SAML loopback listener lifecycle (graceful |
|
@bbedward Let me know if your content with the implementation, and I'll add a PR for the docs. |
|
Looks good, go ahead and add the docs PR if you think its helpful |
|
@bbedward PR opened. |
Description
Adds Fortinet VPN support to the NetworkManager openconnect path, covering both SAML/SSO and password authentication, and lets openfortivpn config files be imported as profiles.
FortiGate gateways configured for SAML can't be used with a username and password — authentication happens in a browser against an external IdP. DMS previously detected that a Fortinet profile needed external browser auth, logged that only GlobalProtect was supported, and fell back to prompting for credentials that don't exist.
Connecting. A Fortinet profile with
authtype=samlnow runs the login in core:saml-portoverrides) and open/remote/saml/startin the browser.SVPNCOOKIEover a connection pinned to the probed certificate.The cookie is handed to the openconnect plugin through the existing secret agent, the same way GlobalProtect already works, so this needs no root and leaves no long-lived process behind. The listener is torn down as soon as the login completes.
A Fortinet profile with
authtype=passwordgoes to the openconnect password flow that already existed, unchanged.Importing.
ImportVPNreads openfortivpn configs and builds an openconnect profile fromhost,port,username,password,realm,trusted-certandsaml-login. Asaml-loginline selects the browser login; anything else is imported as a password profile carrying whatever credentials the file had, and the connect prompt asks for whichever of username and password is missing. A password alongsidesaml-loginis dropped, since that path never reads one.openfortivpn configs are conventionally extensionless, so detection reads the contents rather than the extension, and anything that doesn't parse falls through to the existing nmcli importers untouched. For the same reason the two VPN import file browsers now offer
*alongside the per-plugin extensions.Certificates. Trust is stored as the whole-certificate digest that openfortivpn's
trusted-certuses, so an existing config's trust line is honoured on the first connect and a newly approved certificate stays compatible with openfortivpn. Approving a certificate appends to that list rather than replacing it, which keeps gateways that answer from several nodes working. openconnect separately gets the public-key pin it expects for--servercert.Known limitation. Certificate trust is only persisted when the connection was started from DMS. The approval is queued into the same pending-save slot the existing credential flow uses, and that slot is drained by a handler which returns early unless DMS initiated the activation. Started from nmcli, the applet, or autoconnect, the user approves a certificate and the trust is discarded, so the prompt returns on the next connect. This gap predates the PR and affects saved VPN credentials the same way, so I've left the shared behavior alone rather than changing it from a Fortinet feature. Happy to fix it here or in a follow-up, whichever you prefer.
Notes for reviewers. This path requires the NetworkManager openconnect plugin, which the import checks for up front and reports if missing. The tunnel is openconnect's Fortinet implementation, not openfortivpn — the config file is only a settings source and nothing about openfortivpn runs.
The loopback listener accepts the session id from any request on its port, matching what openfortivpn's own
--saml-loginserver does. A local page racing it during a login costs a retry: the bogus id goes to the real gateway over the pinned connection, is rejected, and the IdP session is still live. Happy to tighten it if you'd rather not carry that.Implementation written with Claude Code; I directed the design, tested it end to end against a production FortiGate gateway, and reviewed the changes — but Go and VPN internals aren't my area, so I'd appreciate scrutiny of the certificate handling and the secret-agent path.
Type of change
Related issues
Closes #1614
Screenshots / video
Certificate trust prompt. Shown once per gateway certificate, before the browser opens. Fingerprint redacted.
Loopback completion page. Served by core once the gateway redirects the browser back with the session id. The IdP login in between is whatever the gateway's organisation has configured, so there is nothing DMS-specific to show there.
Checklist
I18n.tr()with translator context, reusing existing terms where possibleGlobalProtect SAML/SSOand following the same pattern.make fmt, added/updated tests,make testpasses, andgo mod tidyis cleanmake lint-qmlwith no new warnings