Repository navigation
network: log in to plugin VPNs before activating them - #4281
Conversation
For VPN plugins without a dedicated flow, the secret agent guessed a "password" secret. OpenConnect (AnyConnect, Pulse, ...), gpclient and vpnc never accept it, so connecting from DMS failed with "no valid VPN secrets". Logins now happen in ConnectVPN before activation, like the existing GlobalProtect and Fortinet SAML flows, and the agent hands NM the cached result: - OpenConnect password login (DMS prompt plus openconnect --authenticate) is no longer limited to Fortinet. Other protocols use openconnect's connect URL and resolve entry, like the plugin's own dialog. When the server asks again or for more input, the plugin's auth dialog takes over. Fortinet keeps its previous behavior. - Other plugins run the auth dialog named in their NetworkManager .name file. With external UI mode its fields go to DMS's prompt and Save persists them; otherwise the plugin's own window opens. - The OpenConnect and dialog results share one cache. Returned secrets without flags are marked not saved first, since NM drops secrets an agent returns for keys it treats as system-owned. A login that fails before activation now marks the profile's row like a failed activation, and the toast for that failure is shown once. The credentials panel hides its username and password fields for profiles that log in through the plugin's dialog and store no "password" secret, since saving there was never used.
Claude reviewOne data-loss issue in the new secret-flag handling. Otherwise the auth dialog flow looks sound.
|
A plugin's auth dialog asked for secrets NetworkManager already had stored, and marking what the user typed as not saved made NetworkManager drop the stored password. A normal user can't read those secrets, so DMS can't tell whether one is stored. Secrets without the agent-owned or not-saved flag are now left to NetworkManager: the dialog path no longer asks for, returns or marks them, and the secret agent no longer guesses a username and password for profiles that log in through the plugin's dialog. One-time values from a plugin's own window are still marked, and only when they differ from what is stored.
Claude reviewThe latest commit fixes the earlier finding about saved secrets being cleared. One new issue: some plugin profiles can no longer get a password from DMS.
|
| var ask []FieldInfo | ||
| for _, f := range fields { | ||
| switch { | ||
| case !secretFlagsAgentAsks(data[f.Name+"-flags"]): |
There was a problem hiding this comment.
Take a profile with no -flags key and no stored secret, for example an L2TP or PPTP profile made with nmcli connection add ... vpn.data "gateway=...,user=..." and the -gnome plugin installed. DMS can no longer log in to it:
- This filter drops the
passwordfield even though the dialog marks itShouldAsk, so no prompt appears. GetSecrets(agent_networkmanager.go:243) then returns NoSecrets where it used to infer and prompt forpassword.PluginLoginis true becausepassword-flagsis missing (line 105), so the control center hides the username, password and Save fields too.
The connection fails with "no valid VPN secrets" and DMS offers no way to enter the password. On master, L2TP and PPTP prompted for it.
Fix: only skip a system-owned field if stored already has a value for it. When nothing is stored, ask for it. markSecretsNotSaved will then flag it 2, and nothing saved is lost.
There was a problem hiding this comment.
That's the case I mentioned in the reply to the other finding, and the suggested fix would bring back the bigger issue.
For a secret without flags DMS can't see whether something is stored: NetworkManager answers with no secrets even when the caller has the modify permission (tested on a vpnc profile with both secrets saved in the keyfile). So "nothing stored" would be true for every profile like this, DMS would ask again and flag the saved password as not saved. I'd rather have nmcli profiles without a saved password fail like this than lose passwords that are saved.
Then the user needs to either save the password or set it to not saved via nmcli or nm-connection-editor (for example nmcli connection modify <name> +vpn.data password-flags=2), after which DMS asks for it on every connect.
Will add this to the docs too
|
Hello @Conava, I have tried to follow your instructions, but DMS is not able to start. Here is the console log for |
|
Thanks for trying @cyperion ! It's in the AUR, and it doesn't touch your installed DMS (that one keeps running on Quickshell and you will need it soon anyways): After that |
|
Thanks, i was able to get it running now! Here are my observations: Also i was not able to create the new OpenConnect VPN-Connections via settings and had to go back to |
The bar popout kept the keyboard, so the prompt fields took no input. The control center already closes itself for the prompt.
Login fields whose flags leave them to NetworkManager are not asked for, since DMS cannot see whether they are stored. When the connection then fails for missing secrets, name those fields and how to fix it instead of only "Authentication required".
Claude reviewNo issues found. |
|
(1) Found the issue, the VPN popout from the bar kept the keyboard while the login dialog was open. It now closes when the dialog opens. (2) Getting the dialog and having it accept the credentials is already the important part. Could you try again once the VPN is back up? Then we'll know if the connection itself goes through. (3) Right, this PR only handles logging in to VPNs that already exist. Settings can create WireGuard profiles and import OpenVPN, vpnc, strongSwan, PPTP/L2TP and openfortivpn config files, but other plugin VPNs like OpenConnect need to be fully set up in nm-connection-editor. DMS then only asks for what the profile doesn't save, like a one-time code. I added that to the docs, and if a login is missing because it isn't saved I made an error explaining that. |
Description
Connecting a VPN from DMS failed for every Networkmanager plugin that did not get a dedicated implementation in DMS, like OpenConnect with Cisco AnyConnect or Pulse, gpclient or vpnc. We just assumed the plugin wants a password, but that was never accepted by those plugins so the connection ended with "no valid VPN secrets".
DMS now logs in before the connection starts, the same way the GlobalProtect and Fortinet SAML logins already work:
The credentials panel in the control center now hides username and password for profiles that dont support it (vpnc, gpclient, OpenConnect with a certificate).
@cyperion could you try this with your VPN? Its hard to think about every possible config before and a test with real VPNs and configurations would be amazing. It needs Go, make and of course git installed:
git clone --recurse-submodules -b vpn-auth-dialog https://github.com/Conava/dux-shell cd dux-shell systemctl --user stop dms make runThen connect from the VPN widget as usual. Ctrl+C stops it, and
systemctl --user start dmsbrings your normal shell back.Type of change
Related issues
Fixes #4204
Screenshots / video
Checklist
I18n.tr()with translator context, reusing existing terms where possiblemake fmt, added/updated tests,make testpasses, andgo mod tidyis cleanmake lint-qmlwith no new warnings