-
Notifications
You must be signed in to change notification settings - Fork 42
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
Several improvements for gp-okta.py
#19
Conversation
This appears to be required for my VPN
This fixes Issue arthepsy#17 raised by @lvml. (Note that if you need to specify a client certificate for the `vpn_url`, then most probably you will also need to give the same certificate to the final `openconnect` call with `--certificate` via the `openconnect_args`)
…te VPN setups. The first authn call only returns the `sessionToken`, with the redirect later one gets the `stateToken` and afterwards need to do the authn call again for full authentication (and mfa).
… in `gp-okta.conf` for the requests-dance
- new option `vpn_url_cert` - new option `okta_url_cert` - rename client certificate option to `client_cert` from `cert` - totp: comment out ABCDEFGHIJKLMNOP secrets, default to not set (so you get asked) - grab and display prelogin errors (for example: client certificate needed or such) - new option `openconnect_certs` that points to a file to collect all given and collected server certificates, will be given to the final openconnect call (inspired by nicklans fork, thank you). If it is not set it will be a temp file. - check all redirect and parsed urls if they point to an expected domain (either `okta_url` or `vpn_url`) - learn `gateway` from getconfig call, if not set/overridden by config file
…iving to openconnect call
…eleted in case of the temp file solution
…A in Okta. Just insert your YubiKey and press the blinking button, when asked to do so. Needs `fido2` packages to work (`pip install fido2`).
…arameters for getconfig.esp (found in OpenConnect source code and docs)
Although not advertised as such, Symantec VIP Access is based on TOTP and there is an open-source implementation for provisioning the tokens and obtaining the TOTP secret at http://github.com/dlenski/python-vipaccess
Any news? Can this be please be merged? We have it here in production for months without problems. |
Just confirming I needed this fork in order to make it working! Having this merged would be awesome! (cc @arthepsy) Thanks heaps for making it! |
Treat "Symantec VIP Access" as TOTP
…at the portal (but not at the gateway)
…eways fetched from the portal - useful to see what values the 'gateway' option can take
gp-okta.py
Outdated
ftype = 'totp' | ||
if ftype not in ['totp', 'sms']: | ||
if ftype not in ['totp', 'sms', 'webauthn']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add push
to this list? It was missed in #14.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, please test.
log('saml-username (2): {0}'.format(saml_username)) | ||
log('prelogin-cookie (2): {0}'.format(prelogin_cookie)) | ||
|
||
if (not userauthcookie or userauthcookie == 'empty') and prelogin_cookie != 'empty': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small request: for some reason my GP server works with the prelogin_cookie but not the userauthcookie. Can the token to use be an option that is set in the config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or some preference setting? Could you please send a patch that is working on your side, then I can test here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure I will polish it up a bit tomorrow and send it. sorry to hijack your PR but this is the smoothest experience for using GP out of the few options there are :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wrong, for some reason it wasn't working yesterday but it is working fine now.
The next thing is that my server requires a HIP report, so I need to be able to pass --csd-wrapper=hipreport.sh to openconnect at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(FYI I woke up and realized I can add that to the openconnect command in the config file... maybe something to consider adding to the README)
I merged the pull request, but this completely broke our company's VPN in two ways, e.g.:
Issue is, our company's GW are named, not full URLs (same as for example gateway "Manual ..", which is not a valid URL).
Errors out, because gateway URL is different than VPN url. Will investigate how to fix those issues. |
@coldcoff could You please explain, is this really required and is correct? Seems wrong to me:
i.e, really, It fails for my company's VPN, but then again, I think I don't have a setup, where I can test this, because authenticating directly to our gateway, gives |
Fixed 1st issue (retaining this pull request features) in 2a1fb94, by using |
Fixed 2nd issue in b5dffd6, by only warning about unexpected URL. |
@arthepsy when you have these fixes in a PR let me know. I couldn't use the "dance" in this on my VPN, either. I had to hard code one of the gateways. Also, does the dance randomly pick the second gateway? The official client does something to try to figure out what the best option is. |
@cardonator these fixes are in master right now. You can test them out. Right now I'll only add features, e.g., removing "bug.*" and adding What do You mean "hard code one of the gateways"? If with dance You mean Official clients works detects which gateway to use by "priorities" (by getting config from portal) defined by administrator. They actually are in SAML responses. |
Okay, thanks for the info. I have to specify one of the gateways returned by the portal in order to connect prior to your changes. Right now, there is an issue on line 685 because in Python 3
If I fix that issue by casting it to a list, it does select one of the gateways but the dance still fails for some reason with
It tries to do the Okta dance again after that and then fails on putting in the login credentials:
If I add the second dance config, I get this instead:
If I add a value to the |
Yes, I haven't tested compatibility for Python2/Python3 with latest commits. Will do that after I implement few features (working on them now). So, do I understand correctly that except Python3 issue, when You change |
No that's exactly right. MY portal is weird because it does have a set of gateways that imply they need to do the okta dance. But if the behavior you understand is having the gateway specified, that use case does work for me as long as I have the push functionality (that you have gratefully merged in :) ) |
Actually, P.S. I'll commit new features and fixes in few minutes. |
Okay, thanks. I'll move this conversation to a new issue if I have more comments. |
This is basically line 929? The reasoning is/was: Note that a portal does not need to offer any gateway capabilities, although often both functionalities run on the very same machine, under different paths. |
Hello @arthepsy,
please have a look at this pull request.
implement all of @aclindsa's changes (aclindsa:master) [ I had foked from him, initially ] So this PR fully includes Add option for second round of Okta authentication #7 and is a superset of it.
rework @aclindsa's new 'another_dance' -> the real concept is to first dance with the portal (like
vpn.company.com
), afterwards dance with a specific gateway (likevpn-uk.company.com
), that also explains why there are two separate urls (this will answer your question Add option for second round of Okta authentication #7 (comment) and following in Add option for second round of Okta authentication #7), see also https://github.com/dlenski/openconnect/blob/master/PAN_GlobalProtect_protocol_doc.md(Note that in @aclindsa's setup the portal and the gateway seem to run on the same machine, which is only a special case of my general implementation, where really different machines in different regions of the worls may be involved).
Implement possibility to use an own client client certificate for https communication, fixes prelogin.response: "Valid client certificate is required" #17.
Implement possibility to check the server certificates for
vpn_url
andokta_url
, fixes Rebase, Client-Certificates, Double/Splitauthn
with Okta aclindsa/pan-globalprotect-okta#1 (comment). The configured certificates are also passed to the final openconnect call, potentially together with new learnt certificates from thepaloalto_getconfig
call (see also @nicklan's fork).some more, small bugfixes, enhancements, improvements (see individual commit messages). Based on feedback from our userbase of some dozen people here.
New Feature: Allow Yubikey
webauthn
authentication, if configured as 2FA in Okta. Just insert your YubiKey and press the blinking button, when asked to do so. Needsfido2
packages to work (pip install fido2
).I had asked @aclindsa to merge in his fork (as my work was based on his fork and he alreday has a PR against your repository open). But he asked me to bring the changes to your attention as now 15 of the 17 commits are from me, and as I might be able to answer most of your questions / comments better than him. Both of us don't want to maintain a permanent fork and we would like to bring our enhancements "back home" to you in your original repository (aclindsa#1 (comment)). Also this might be one more step towards @dlenski's wish for
one-script-to-rule-them-all
(see: dlenski/openconnect#122 (comment)).Please test, have a close look and feel free to ask every question or comment that comes to your mind reg. our changes. I'll try to address everything until it hopefully gets merged ;-)
Thank you and best regards
@coldcoff