-
Notifications
You must be signed in to change notification settings - Fork 128
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
Add support for portal-userauthcookie authentication #98
Conversation
Big 👍 👍 for prototyping it in Python, excellent. This is very closely related to #97, which also wants to submit the
Few questions on this…
Overall, I very much like your approach, but I'm wondering if there is a way to converge on a single script that will work for both this use case, as well as that of #97, and ideally as many other SAML-with-redirection use cases as well. |
Regarding script, what kind of use-cases did You think? I can adjust the script or help with a rewrite if that's what You would wish. Anyhow, it's a different task (can be worked on without this pull request), right? Therefore, would You mind merging these particular changes regarding |
I'm glad this is working for you, but the difficulty is that your changes add an additional command-line option which alters the authentication flow… and this won't be accessible from any GUI front-ends. Therefore these changes won't be accepted upstream in this form. I'm trying to figure out how to make a more general-purpose mechanism to alter the field used for the password/cookie, which will work with existing UIs. |
This change allows the user to specify an alternative-secret field for the login form submission, instead of 'passwd'. The alternative field is specified by appending :FIELDNAME to the URL path: https://vpn.bigcorp.com/gateway:prelogin-cookie (for #97) https://vpn.bigcorp.com/portal:portal-userauthcookie (for #98)
@arthepsy and @cizra, please check out and test the This is a general-purpose solution which allows you to specify an "alternative secret field name" instead of the default @arthepsy: For your use case, you would connect with: $ ./script_that_obtains_the_portal_userauthcookie |
> openconnect --passwd-on-stdin --protocol=gp -u USERNAME \
> https://vpn.bigcorp.com/portal:portal-userauthcookie @cizra: For your use case, you would connect with: $ ./script_that_obtains_the_SAML_gateway_prelogin_cookie |
> openconnect --passwd-on-stdin --protocol=gp -u USERNAME \
> https://vpn.bigcorp.com/gateway:prelogin-cookie Please test these and let me know if they work for you. (Of course, you can enter the cookie values manually rather than via script, as needed.) This solution is general-purpose enough that it should work with any other cookie-based login possibilities and allow integration into all the OpenConnect GUIs. |
This change allows the user to specify an alternative-secret field for the login form submission, instead of 'passwd'. The alternative field is specified by appending :FIELDNAME to the URL path: https://vpn.bigcorp.com/gateway:prelogin-cookie (for #97) https://vpn.bigcorp.com/portal:portal-userauthcookie (for #98)
This change allows the user to specify an alternative-secret field for the login form submission, instead of 'passwd'. The alternative field is specified by appending :FIELDNAME to the URL path: https://vpn.bigcorp.com/gateway:prelogin-cookie (for #97) https://vpn.bigcorp.com/portal:portal-userauthcookie (for #98)
This change allows the user to specify an alternative-secret field for the login form submission, instead of 'passwd'. The alternative field is specified by appending :FIELDNAME to the URL path: https://vpn.bigcorp.com/gateway:prelogin-cookie (for #97) https://vpn.bigcorp.com/portal:portal-userauthcookie (for #98)
|
@cizra, any updates on if this is working for you? Insofar as I'm able to test it with a fake "server simulator", it works fine and doesn't mishandle memory allocation. |
Yep, works fine. Sorry for the looooong delay. |
Finally, got to try it out and it doesn't work for me, i.e., it doesn't read from stdin. Tried with echo, printf, additional newline, - no changes. Always get this error:
If I prepend a newline ( |
Hmm… does it read something before the cookie, if you run interactively? Other than asking you to confirm the server certificate if it's no automatically verified, and asking for input of the username (if you don't specify with |
This patch adds new authentication mechanism (via
portal-userauthcookie
). This is required for different types of third-party integrations. I have tested this with OKTA (okta.com) integration. Was able to successfully use GlobalProtect VPN on FreeBSD and MacOS X, even with 2FA.Basically, there is a "authentication dance" with Global Protect and OKTA, which results in
portal-userauthcookie
, which is used instead ofpassword
, i.e., password is sent empty. Therefore, I use my python script to do the dance and just pass theportal-userauthcookie
toopenconnect
and everything is working fine.Simplified, "authentication dance" flow with OKTA is like this:
/global-protect/prelogin.esp
; retrievesaml-auth-method
andsaml-request
saml-request
); retrieve "redirect url" in response/api/v1/authn
(and if necessary then also with additional 2FA in following request) and retrievesessionToken
/login/sessionCookieRedirect
, providing "redirect url" andsessionToken
; retrievesaml-username
andprelogin-cookie
/global-protect/getconfig.esp
withsaml-username
andprelogin-cookie
; retrieveportal-userauthcookie
portal-userauthcookie
with openconnectYou can see the specific details of "authentication dance" by looking at python script in:
https://github.com/arthepsy/pan-globalprotect-okta