python-eduvpn-client
python-eduvpn-client copied to clipboard
Deactivate doesn't work for CLI
Installation
From this repo, per instructions in readme
Version
45c58ec0108bd2dfc11d082fce38c2239a1c220e
OS/Distribution
Arch Linux
Logs
(venv) melis@juggle 11:15:~/c/python-eduvpn-client$ eduvpn-cli activate
INFO:eduvpn.remote:Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
INFO:eduvpn.storage:updating token for https://surf.eduvpn.nl/
INFO:eduvpn.nm:calling action with CLI mainloop
INFO:eduvpn.nm:activate_connection uuid: c13b19c5-3dbf-485b-b353-8a9be1d55caa connection: <NM.RemoteConnection object at 0x7fb6800df340 (NMRemoteConnection at 0x5620032f4710)>
INFO:eduvpn.nm:activate_connection_async result: <NM.VpnConnection object at 0x7fb67dde9cc0 (NMVpnConnection at 0x56200327d240)>
INFO:eduvpn.nm:Quiting main loop, thanks!
(venv) melis@juggle 11:15:~/c/python-eduvpn-client$ eduvpn-cli status
# Global configuration
uuid: c13b19c5-3dbf-485b-b353-8a9be1d55caa
auth_url: https://surf.eduvpn.nl/
VPN connection active: False
VPN NM status is: None
Active VPN connection is EduVPN: False
## Previous connection properties
** CURRENT ACTIVE CONFIGURATION **
auth_url https://surf.eduvpn.nl/
api_url: https://surf.eduvpn.nl/portal/api.php/v3
display_name: SURF BV
support_contact: ['https://support.ia.surf.nl/']
profile_id: medewerkers
token_endpoint: https://surf.eduvpn.nl/portal/oauth.php/token
authorization_endpoint: https://surf.eduvpn.nl/portal/_oauth/authorize
con_type: INSTITUTE
country_id: None
token.token_type: bearer
token.expires_in: 3600
token.expires_at: 1647947540.9699554
(venv) melis@juggle 11:20:~/c/python-eduvpn-client$ eduvpn-cli deactivate
INFO:eduvpn.nm:calling action with CLI mainloop
<hangs and VPN stays active>
<after pressing Ctl-C:>
^CTraceback (most recent call last):
File "/home/melis/c/python-eduvpn-client/venv/bin/eduvpn-cli", line 33, in <module>
sys.exit(load_entry_point('eduvpn-client==2.2.1', 'console_scripts', 'eduvpn-cli')())
File "/home/melis/c/python-eduvpn-client/eduvpn/cli.py", line 139, in eduvpn
parse_eduvpn(argv[1:])
File "/home/melis/c/python-eduvpn-client/eduvpn/cli.py", line 105, in parse_eduvpn
parsed.func(parsed)
File "/home/melis/c/python-eduvpn-client/eduvpn/cli.py", line 34, in deactivate
actions.deactivate()
File "/home/melis/c/python-eduvpn-client/eduvpn/actions.py", line 137, in deactivate
deactivate_connection_with_mainloop(get_uuid())
File "/home/melis/c/python-eduvpn-client/eduvpn/nm.py", line 439, in deactivate_connection_with_mainloop
action_with_mainloop(action=lambda callback: deactivate_connection(get_client(), uuid, callback))
File "/home/melis/c/python-eduvpn-client/eduvpn/nm.py", line 426, in action_with_mainloop
main_loop.run()
File "/home/melis/c/python-eduvpn-client/venv/lib/python3.10/site-packages/gi/overrides/GLib.py", line 495, in run
with register_sigint_fallback(self.quit):
File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
next(self.gen)
File "/home/melis/c/python-eduvpn-client/venv/lib/python3.10/site-packages/gi/_ossighelper.py", line 237, in register_sigint_fallback
signal.default_int_handler(signal.SIGINT, None)
KeyboardInterrupt
When using eduvpn-gui to do the same steps I get this error (and the VPN connection stays active):
(venv) melis@juggle 11:18:~/c/python-eduvpn-client$ eduvpn-gui
2022-03-22 11:18:41,211 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022-03-22 11:18:41,211 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022-03-22 11:18:41,212 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022-03-22 11:18:41,226 - init-server-db - INFO - eduvpn.remote - remote.py:23 - Requesting https://disco.eduvpn.org/v2/server_list.json
2022-03-22 11:18:41,368 - init-server-db - INFO - eduvpn.remote - remote.py:37 - Retrieving signature https://disco.eduvpn.org/v2/server_list.json.minisig
2022-03-22 11:18:41,479 - init-server-db - INFO - eduvpn.remote - remote.py:44 - verifying signature of https://disco.eduvpn.org/v2/server_list.json
2022-03-22 11:18:41,480 - init-server-db - INFO - eduvpn.remote - remote.py:23 - Requesting https://disco.eduvpn.org/v2/organization_list.json
2022-03-22 11:18:41,659 - init-server-db - INFO - eduvpn.remote - remote.py:37 - Retrieving signature https://disco.eduvpn.org/v2/organization_list.json.minisig
2022-03-22 11:18:41,777 - init-server-db - INFO - eduvpn.remote - remote.py:44 - verifying signature of https://disco.eduvpn.org/v2/organization_list.json
2022-03-22 11:18:42,845 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022-03-22 11:18:42,845 - MainThread - INFO - eduvpn.ui.ui - ui.py:580 - selection empty
2022-03-22 11:18:42,846 - oauth-refresh - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
2022-03-22 11:18:43,002 - load-server-info - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
2022-03-22 11:18:43,129 - configure-connection - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
2022-03-22 11:18:43,362 - MainThread - INFO - eduvpn.nm - nm.py:265 - writing ovpn configuration to Network Manager
2022-03-22 11:18:43,362 - MainThread - INFO - eduvpn.nm - nm.py:188 - Writing configuration to /tmp/tmpbfeg_wqz/eduVPN.ovpn
2022-03-22 11:18:43,558 - MainThread - INFO - eduvpn.nm - nm.py:221 - Updating existing connection with new configuration
2022-03-22 11:18:43,580 - MainThread - INFO - eduvpn.interface.event - event.py:187 - Finished saving network manager config: <Gio.Task object at 0x7fcbe37ad300 (GTask at 0x55cd21e02100)>
2022-03-22 11:18:43,583 - MainThread - INFO - eduvpn.nm - nm.py:354 - setting default gateway: False
2022-03-22 11:18:43,601 - MainThread - INFO - eduvpn.nm - nm.py:286 - activate_connection uuid: c13b19c5-3dbf-485b-b353-8a9be1d55caa connection: <NM.RemoteConnection object at 0x7fcbe37ac740 (NMRemoteConnection at 0x55cd21d011f0)>
2022-03-22 11:18:43,675 - MainThread - INFO - eduvpn.nm - nm.py:301 - activate_connection_async result: <NM.VpnConnection object at 0x7fcbe045fa40 (NMVpnConnection at 0x55cd21f81370)>
<deactivate in GUI with the 0/1 switch>
2022-03-22 11:18:53,305 - stop-connection - INFO - eduvpn.remote - remote.py:23 - Requesting https://surf.eduvpn.nl/.well-known/vpn-user-portal
Traceback (most recent call last):
File "/home/melis/c/python-eduvpn-client/eduvpn/ui/ui.py", line 616, in on_switch_connection_state
self.app.interface_transition('deactivate_connection')
File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 172, in interface_transition
self._base_transition(
File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 133, in _base_transition
state_machine.transition(
File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 174, in transition
new_state = transition_func(*args, **kwargs)
File "/home/melis/c/python-eduvpn-client/eduvpn/interface/state.py", line 364, in deactivate_connection
app.network_transition('disconnect')
File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 148, in network_transition
self._base_transition(
File "/home/melis/c/python-eduvpn-client/eduvpn/app.py", line 133, in _base_transition
state_machine.transition(
File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 176, in transition
with self.trigger_callbacks(old_state, new_state):
File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
next(self.gen)
File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 188, in trigger_callbacks
self._call_edge_callbacks(ENTER, old_state, new_state)
File "/home/melis/c/python-eduvpn-client/eduvpn/state_machine.py", line 262, in _call_edge_callbacks
callback(old_state, new_state)
File "/home/melis/c/python-eduvpn-client/eduvpn/ui/app.py", line 153, in enter_DisconnectedState
self.connection_notification.hide()
File "/home/melis/c/python-eduvpn-client/eduvpn/notify.py", line 32, in hide
self.notification.close() # type: ignore
gi.repository.GLib.GError: notification-daemon-error-quark: GDBus.Error:org.gtk.GDBus.UnmappedGError.Quark._notification_2ddaemon_2derror_2dquark.Code100: 0 is not a valid notification ID (100)
I see no messages in the journalctl output when I run the deactivate command, seems to get stuck before doing anything.
Hi, I also run into the same issue when I don't make the eduVPN the default route in the NetworkManager configuration (i.e. having never-default=true
).
After checking the code, I suspect that it is probably due to the fact that the deactivate
uses get_primary_connection()
of the NetworkManager to get the connection (see https://github.com/eduvpn/python-eduvpn-client/blob/master/eduvpn/nm.py#L310).
According to this document, the get_primary_connection
doesn't return the VPN connection if it doesn't have the default route.
Looks like these are actually all separate issues around deactivation:
- deactivating in the cli; the app hangs
- deactivating in the gui; notification id error
- deactivating with other connections defined in NM doesn't do anything; this is a duplicate of #464
I can't speak on the cli, but for the gui issue we'll probably need more details on your unique setup and how to reproduce this. Can you create a separate issue and add this information?
I can't speak on the cli, but for the gui issue we'll probably need more details on your unique setup and how to reproduce this. Can you create a separate issue and add this information?
Done, see #467
@paulmelis you are linking to this issue, you probably meant #469
@paulmelis you are linking to this issue, you probably meant #469
Ah, yes, my bad, sorry
Fixed in version 4, install instructions https://python-eduvpn-client.readthedocs.io/en/latest/installation.html