Skip to content

Cisco anyconnect webvpn cookie #35

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sd2k9
Copy link

@sd2k9 sd2k9 commented Jan 13, 2022

Add support for Cisco AnyConnect SAML VPN

which returns the authentication cookie within the webvpn cookie.

I hope I did not broke anything else, unfortunately as I don't have other VPNs available I was unable to test it.
If you want to pick up my change and need to make modifications, then I'll of course help with testing it versus the AnyConnect functionality.

Thanks for your work, it was (is) a great base to get AnyConnect SAML running!

@dlenski
Copy link
Owner

dlenski commented Jan 13, 2022

Thanks! I don't have time to fully review and test now, but will take a more detailed look later.

I also don't have access to any AnyConnect server that does SAML. Hrmmm.

gp_saml_gui.py Outdated
if cookies:
self.cookies.set_accept_policy(WebKit2.CookieAcceptPolicy.ALWAYS)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm… what's the reason for removing this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed that I need to have cookies enabled to extract the webvpn cookie.
Therefore I changed to cookie parameter to only control the cookie storage (line 53+54).

I'll check whether that is actually true and when not revert this change.

In case cookies are required (and I don't want to store them in a cookie file), would you prefer to keep the -C/-K parameters as they are now (controlling both storage and cookie acceptance) - and add a new parameter for non-persistance acceptance?
Or change the parameters meaning, to support these 3 cases?

My proposal would be something like:

  1. --cookies: Store cookies in this file (instead of default %(default)s)')
  2. --no-cookies: Don't use or store cookies at all
  3. --no-cookies-store: Use cookies, but don't store them on disk

Copy link
Owner

@dlenski dlenski Jan 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the reason not to store the cookies persistently if they're used? 🤷🏻‍♂️

Normally, SAML/federated login providers use them for things like remembering your username, or not requiring you to receive an SMS code every time if the cookies shows you've logged in recently, etc.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP/TLS-based VPNs use cookies heavily in their authentication. Other than GlobalProtect (somewhat ironic given that's what this code was originally written to support), I don't think there's an SSL-VPN protocol out there where the login process will work with a browser/agent that disables cookies entirely.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give it a try with AnyConnect and see how it works.

I don't like to store unneeded stuff, especially when it's security related.
So as you point out I will probably need cookies enabled for the login to work. I will just input all credential data by myself. Or actually the password manager will do this for me. So single source of credentials, and not distributed over multiple files.
Thats of course just a personal preference. :-)

I also don't see/have all these features like SMS code with AnyConnect, so I cannot relate.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it - and AnyConnect cookie extraction also works with the orginial
"Don't use or store cookies at all" implementation.
I should have tested it first :-)

I reverted back cookie handling to the original state - please have a look when you find some time to spare.

AnyConnect cookie extraction also works with orginial
"Don't use or store cookies at all" implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants