Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed config files do not disappear from the GUI list #729

Open
cron2 opened this issue Feb 19, 2025 · 5 comments
Open

removed config files do not disappear from the GUI list #729

cron2 opened this issue Feb 19, 2025 · 5 comments
Assignees
Labels

Comments

@cron2
Copy link
Contributor

cron2 commented Feb 19, 2025

So, @lstipakov made me fight windows OpenVPN to test the DCO/server functionality, and I was copying .ovpn files all around the place and then cleaning up stuff again... and I found something which I think is a bug.

This happens with the GUI bundled in our official 2.6.13-I001 installer (I002 is not on swupdate yet), so no private builds involved yet. No upgrade installation either, removed the old install and installed fresh, with default options.

There are a number of .ovpn files already in c:\program files\openvpn\config, and openvpn-gui.exe is running.

Add a new .ovpn file, right-click GUI, new file is visible.

Remove an .ovpn file (either the new one or one of the others), right-click GUI, freshly-removed config is still visible - trying to start it will of course cause an error (IService > OpenVPN exited with error: exit code = 1).

I do not understand enough windows coding to figure out how the GUI notices that "new files have appeared" and why it does not notice "files have been removed".

@cron2 cron2 added the bug label Feb 19, 2025
@lstipakov lstipakov self-assigned this Feb 19, 2025
@lstipakov
Copy link
Member

lstipakov commented Feb 19, 2025

I am on it.

Bisecting: 45 revisions left to test after this (roughly 6 steps)
[67a8db7664648e60108edead231c7b813b46034c] PLAP: Do not show profiles with no management address

@lstipakov
Copy link
Member

commit 6932c5e7109330d8cc75afca8980c80e457ef275
Author: Selva Nair <[email protected]>
Date:   Wed Jul 20 20:58:04 2022 -0400

    Change the logic of releasing persistent connections in OnHold

    (i)
    State is changed to detached before auto-starting
    so that OnHold() will see state = resuming and keep the hold.

    State is set to disconnected instead of detached on detach
    so that manual starts will release the hold automatically.

    End result: While connecting automatically, do not release if
    management-hold is on. But while started manually, release
    from hold so that connection can complete without further
    user action.

    In normal use of automatic service, one would not add management
    hold into the config. However, if the user disconnects the connection
    the GUI puts it on hold, and we do not want to auto-start it after a
    lock-unlock or some other automatic action.

    (ii)
    Also, currently, for persistent connections, the status
    window is not shown automatically which feels unnatural in
    real use. Instead, popup the status window when connection
    is manually initiated. Its not popped up when automatically
    attached to or if silent_connection is on.

    Only persistent connections are affected by the change.

    fixup: config file list is not recreated from scratch when
    enable_persistent == 2 (auto attach mode) to avoid losing info
    such as auto_connect = false on detached connections.

    Signed-off-by: Selva Nair <[email protected]>

@cron2
Copy link
Contributor Author

cron2 commented Feb 19, 2025

@selvanair this sounds as if this is a "known effect" (config file list not recreated from scratch) - but it still feels weird, and I'm sure I'm not understanding all the deails...?

@lstipakov
Copy link
Member

lstipakov commented Feb 19, 2025

Previously if one sets "Persistent Connections" to anything different from "Auto", we will recreate configs list. However, after this commit it is no longer possible.

@selvanair is it so, that we don't recreate configs list only not to lose "auto_connect" state? Maybe this could be separately preserved across recreation?

@selvanair
Copy link
Collaborator

It has been a while and I do not recall the details. I can't even completely comprehend my own commit message right now! Will take a look.

That said, it must be possible to retain the "auto_connect" info and recreate the list but probably I thought it was complicated at the time... After all the user can fix it by restarting the GUI and how often do they delete configs.
Alternates are (i) add a way to delete config files from the menu and discourage deleting manually from the file system or (ii) do a reverse scan of the list to grey-out configs not in file system.

selvanair added a commit to selvanair/openvpn-gui that referenced this issue Feb 19, 2025
Since the introduction of persistent connections, we
no longer recreate the entire config menu but only add newly
added connection profiles during each rescan. This leaves
any deleted configs actively displayed in the menu until the
GUI is restarted.

Improve this situation by graying out entries corresponding to
profiles not readable from file system. If the file reappears
the item gets automatically enabled again.

Also, if the corresponding connection is active, the item is not
grayed out to allow the user to disconnect or reconnect it. Otherwise
the corresponding OpenVPN core process will hang around with no way to
control it from the GUI. Here "active" includes those on management-hold
in case of persistent connections, as those can be started even if the
underlying config file has gone missing.

Addresses github issue OpenVPN#729

Signed-off-by: Selva Nair <[email protected]>
selvanair added a commit to selvanair/openvpn-gui that referenced this issue Feb 19, 2025
Since the introduction of persistent connections, we
no longer recreate the entire config menu but only add newly
added connection profiles during each rescan. This leaves
any deleted configs actively displayed in the menu until the
GUI is restarted.

Improve this situation by graying out entries corresponding to
profiles not readable from file system. If the file reappears,
the item gets automatically enabled again.

Also, if the corresponding connection is active, the item is not
grayed out to allow the user to disconnect or reconnect it.
Otherwise the corresponding OpenVPN core process will hang around
with no way to control it from the GUI. Here "active" includes
those on management-hold in case of persistent connections, as
those can be started even if the underlying config file has
gone missing.

Addresses github issue OpenVPN#729

Signed-off-by: Selva Nair <[email protected]>
selvanair added a commit to selvanair/openvpn-gui that referenced this issue Feb 19, 2025
Since the introduction of persistent connections, we
no longer recreate the entire config menu but only add newly
added connection profiles during each rescan. This leaves
any deleted configs actively displayed in the menu until the
GUI is restarted.

Improve this situation by graying out entries corresponding to
profiles not readable from file system. If the file reappears,
the item gets automatically enabled again.

Also, if the corresponding connection is active, the item is not
grayed out to allow the user to disconnect or reconnect it.
Otherwise the corresponding OpenVPN core process will hang around
with no way to control it from the GUI. Here "active" includes
those on management-hold in case of persistent connections, as
those can be started even if the underlying config file has
gone missing.

Addresses github issue OpenVPN#729

Signed-off-by: Selva Nair <[email protected]>
selvanair added a commit to selvanair/openvpn-gui that referenced this issue Feb 19, 2025
Since the introduction of persistent connections, we
no longer recreate the entire config menu but only add newly
added connection profiles during each rescan. This leaves
any deleted configs actively displayed in the menu until the
GUI is restarted.

Improve this situation by graying out entries corresponding to
profiles not readable from file system. If the file reappears,
the item gets automatically enabled again.

Also, if the corresponding connection is active, the item is not
grayed out to allow the user to disconnect or reconnect it.
Otherwise the corresponding OpenVPN core process will hang around
with no way to control it from the GUI. Here "active" includes
those on management-hold in case of persistent connections, as
those can be started even if the underlying config file has
gone missing.

Addresses github issue OpenVPN#729

Signed-off-by: Selva Nair <[email protected]>
selvanair added a commit to selvanair/openvpn-gui that referenced this issue Feb 19, 2025
Since the introduction of persistent connections, we
no longer recreate the entire config menu but only add newly
added connection profiles during each rescan. This leaves
any deleted configs actively displayed in the menu until the
GUI is restarted.

Improve this situation by graying out entries corresponding to
profiles not readable from file system. If the file reappears,
the item gets automatically enabled again.

Also, if the corresponding connection is active, the item is not
grayed out to allow the user to disconnect or reconnect it.
Otherwise the corresponding OpenVPN core process will hang around
with no way to control it from the GUI. Here "active" includes
those on management-hold in case of persistent connections, as
those can be started even if the underlying config file has
gone missing.

Addresses github issue OpenVPN#729

Signed-off-by: Selva Nair <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants