NetworManager and openconnect: using cookies



Hi guys,

we are trying to improve openconnect in some points that we believe
it will improve its behaviour.

Let me explain what would be the perfect scenario:

- start a vpn connection using NetworkManager plugin (NM-openconnect)
- nm-auth-dialog.c is launched
  - try to connect only once using cookie stored in gconf key '/system/networking/connections/%d/vpn/cookie'
  - on failure, ask user for username and password

When NetworkManager suspends, it should send a SIGKILL to openconnect child
pid (not a SIGTERM).

That way, when a Linux box resumed from a suspend, it would try to connect
once using the cookie previously saved and if it failed with cookie, it would
prompt user for username and password.

In order to test, I forced NM to always send a SIGKILL to openconnect pid and
added 'cookie' as a valid property. Please refer to the attachment patch-nm-openconnect-cookie-sigkill.patch


On openconnect front, I drafted a patch that tries to connect firstly using cookie
from gconf. The idea is that if it fails using cookie, it should jump to user
and ask for username and password. Please refer to the attachment patch-openconnect-cookie-first.patch


Using these patches, I'm able to connect via NM-openconnect using my
username/password. After it connects, it saves cookie in user's gconf settings.

I disconnect from vpn (it now sends a SIGKILL to openconnect) via NM-openconnect
so my openconnect cookie will be still valid on the next connection because
openconnect didn't send a BYE packet to the gateway.

I'm stuck on this step: if it fails on cookie, jump to ask username/password
inputs from user. It always tries to use cookie.

Please feel free to tell me which is the best approach to do this and point me
the right directions.

I'd be happy to improve my patch based on your recommendations.

Thanks in advance,

Murilo

Attachment: patch-nm-openconnect-cookie-sigkill.patch
Description: Binary data

Attachment: patch-openconnect-cookie-first.patch
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]