fortinet: reconnect prompts for password after transient HTML login failure
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- go
- Domain
- authentication, backend
Research direction
Start in fortinet_auth.go at processAuthenticationResponse and trace how the opaque HTTP 200 response builds a retryable authentication error. Check the tests for that function and add coverage for a lockout HTML response with previousInitial=true. Done means the error preserves cached credentials for retry while explicit credential rejections still clear them.
Written by the indexing model from the issue text.
Description
Version: sing-box 1.14.7, sing-openconnect v0.1.1-0.20261130041732-0b1d63c5595c
Problem
With a fortinet endpoint that has username and password configured, reconnecting after a disconnect sometimes leaves the endpoint waiting for password entry in the dashboard instead of using the configured password.
A typical log sequence ends with the endpoint in auth-pending, and the dashboard renders an authentication form containing the password field.
Cause
In fortinet_auth.go (processAuthenticationResponse), when POST /remote/logincheck returns HTTP 200 with an opaque HTML page and no SVPNCOOKIE or challenge, the client returns:
return nil, nil, newRetryableAuthenticationError(E.New("logincheck returned neither SVPNCOOKIE nor a challenge"), rejectedCacheKeys...)
rejectedCacheKeys contains authCachePassword when the previous attempt was the initial login. The supervisor handles the retryable error and clears that cached credential:
func (c *Client) handleRetryableAuthenticationError(err error) bool {
authenticationError, loaded := E.Cast[*retryableAuthenticationError](err)
if loaded {
c.clearStableCredentials(authenticationError.cacheKeys...)
}
return loaded
}
The cached password was seeded from ClientOptions.Password only once in NewClient. On the next reconnect, BeginAuthentication gets the static login form, prefillAuthField finds no cached password, and awaitAuthChallenge publishes a visible password field. The configured password is still present in the sing-box config file but is no longer available to the client.
This is triggered by non-explicit failures such as a temporary login lockout page:
<!--sslvpnerrmsg=Too many bad login attempts. Please try again in a few minutes.-->
The gateway has not actually rejected the configured credentials, so clearing them turns a transient failure into an interactive prompt.
Configuration shape
{
"type": "openconnect",
"tag": "vpn",
"server": "https://vpn.example.com:10443",
"flavor": "fortinet",
"username": "[email protected]",
"password": "...",
"external_auth_disabled": true
}
Reproduction
- Configure a
fortinetendpoint with a validusernameandpassword. - Establish the tunnel, then disconnect.
- During reauthentication, have the gateway return an HTTP 200 HTML login/lockout page without
SVPNCOOKIE(for example by triggering the login block). - The retry clears the in-memory password; the following reconnect waits for password entry in the dashboard.
Expected behavior
A retryable opaque HTML failure should be retried with the configured credentials. Explicit credential rejections (ret=0, redirect/forbidden after the initial attempt) should still clear the cache so the user can be prompted.
Suggested fix
Do not attach rejectedCacheKeys to the opaque HTML branch:
if form == nil {
- return nil, nil, newRetryableAuthenticationError(E.New("logincheck returned neither SVPNCOOKIE nor a challenge"), rejectedCacheKeys...)
+ // Opaque HTML pages (for example a temporary login lockout) are not
+ // an explicit credential rejection. Keep the configured credentials
+ // so the retry can authenticate without asking the dashboard user.
+ return nil, nil, newRetryableAuthenticationError(E.New("logincheck returned neither SVPNCOOKIE nor a challenge"))
}
A regression test can feed a 200 lockout HTML body with previousInitial=true, then assert that the returned retryableAuthenticationError has no cache keys and the cached password remains present.
I can send this as a PR with the test if that is preferred.
- Dominant language
- Go
- Stars
- 5
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SagerNet/sing-openconnect
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
All issues in SagerNet/sing-openconnect
Similar issues
-
gui: a narrow window's gateway key row with a line under it wraps its faded badges onto blank linesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
contribution macOS 主机
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Lee-xeo/Claude-Cage#1386 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
prime-radiant-inc/evener#8264 ·
Maintainers usually reply within 1 day
-
Add a list commandOpenbackup-operator
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
platform-mesh/platform-mesh#819 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day