CAS is an open and well-documented authentication protocol. The primary implementation of the protocol is an open-source Java server component by the same name hosted here, with support for a plethora of additional authentication protocols and features.
I guess it falls in the category of web browser (SSO) single sign-on, which has been widely discussed in past posts:
It can be a challenge to automate the interaction with a server designed for web browsers, with potentially complex and unexpected web page contents, sometimes generated by JavaScript.
Direct user interaction from a command-line based client such as OpenConnect is obviously difficult. The maintainers have been unable to identify a recent and maintained library implementing a text based browser that could be used to interact with such pages without the need for a GUI.
I am afraid I cannot be more helpful here, others may know better. Look through other GlobalProtect issues for ideas. The solution might be as simple as using option --useragent to convince the server that the current client is able to handle the authentication process, or as complex as using some external script (such as gp-saml-gui for SAML) that launches a web browser to handle the authentication and retrieve a session cookie, then feed the cookie to OpenConnect using the --cookie option.
POST https://gp.example.com/global-protect/prelogin.esp?tmp=tmp&clientVer=4100&clientos=LinuxAttempting to connect to server 192.168.1.1:443Connected to 192.168.1.1:443Négociation SSL avec gp.example.comConnected to HTTPS on gp.example.com with ciphersuite (TLS1.2)-(ECDHE-SECP256R1)-(RSA-SHA256)-(AES-256-GCM)> POST /global-protect/prelogin.esp?tmp=tmp&clientVer=4100&clientos=Linux HTTP/1.1> Host: gp.example.com> User-Agent: PAN GlobalProtect> Got HTTP response: HTTP/1.1 200 OKDate: Fri, 08 Sep 2023 05:53:53 GMTContent-Type: application/xml; charset=UTF-8Content-Length: 538Connection: keep-aliveCache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0Set-Cookie: SESSID=3cda0a56-498b-4b26-8034-7c4a8827e6d6; Path=/; HttpOnly; SecureX-Frame-Options: DENYStrict-Transport-Security: max-age=31536000;X-XSS-Protection: 1; mode=blockX-Content-Type-Options: nosniffContent-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; img-src * data:; style-src 'self' 'unsafe-inline';HTTP body length: (538)< <?xml version="1.0" encoding="UTF-8" ?>< <prelogin-response>< <status>Error</status>< <ccusername></ccusername>< <autosubmit>false</autosubmit>< <msg>CAS is not supported by the client. Minimum client version is 6.0</msg>< <newmsg></newmsg>< <authentication-message>Enter login credentials</authentication-message>< <username-label>Username</username-label>< <password-label>Password</password-label>< <panos-version>1</panos-version>< <saml-default-browser>yes</saml-default-browser>< < <auth-api>no</auth-api><region>FR</region>< </prelogin-response>CAS is not supported by the client. Minimum client version is 6.0Failed to complete authentication
It might be time to bump the emulated version number from 5.1.5-8 to something more recent, such as 6.1.2-82. Does it get you further, that is, is the error message different?
I've configure the GlobalProtect client in dump mode and see this request:
It might be time to bump the emulated version number from 5.1.5-8 to something more recent, such as 6.1.2-82. Does it get you further, that is, is the error message different?
As of !333 (merged), we will simply parrot back whatever software version number the portal thinks is the latest and greatest.
… but yes, we probably should also bump the fallback version number that we use in case of a direct connection to the gateway, in which case OpenConnect won't learn the version number to parrot. 🦜
Can I test this theory by running tests/fake-gp-server.py with a different default (e.g. from master)
I don't understand what you're proposing here.
The fake GP server does not care what emulated version number you send to it. You can send it Help.I.Am.Trapped.In.A.VPN.Factory as your app-version, and it won't care.
You need to modify the client and test it with your real server. Quite likely the change you need is b22782f5 in, also described above in #651 (comment 1573448681).
I also get this error with gp-saml-gui and openconnect 9.12 trying to connect to GlobalProtect cloud service with Cloud Authentication Service where Cloud Identity Engine serves as proxy for AzureAD (sorry for the buzzword dump, I'm only relaying what I was told :P).
I'd like to avoid installing the proprietary client to post a dump as above, but I'm happy to share more detailed information in private if someone tells me what to test. :)
> POST /global-protect/prelogin.esp?tmp=tmp&clientVer=4100&clientos=Linux HTTP/1.1> Host: gp.example.com> User-Agent: PAN GlobalProtect …CAS is not supported by the client. Minimum client version is 6.0
And try this with curl:
curl -kvL -X POST -A 'PAN GlobalProtect' 'https://$SERVER/prelogin.esp?tmp=tmp&clientVer=4100&clientos=Windows'
You should get the same error.
Try adding various parameters to the end of the URL (appVersion=6.1.2-82? app-version=6.1.2-82? appversion=6.1.2-82? etc.)
Keep trying more stuff like that. If any of them cause you not to get the error, then great!
The official GlobalProtect client is sending a new parameter in the body of the request: cas-support=yes. If you send this you won't get the error CAS is not supported by the client. Minimum client version is 6.0 anymore. The clientVer string is unchanged; it's still 4100.
Here's an example curl request:
curl -X POST \-d 'cas-support=yes' \-H 'Connection: Keep-Alive' \-H 'User-Agent: PAN GlobalProtect' \ 'https://<your-gateway>.gw.gpcloudservice.com/ssl-vpn/prelogin.esp?tmp=tmp&clientVer=4100&clientos=Windows'
It works for me, at least it doesn't give me the CAS is not supported by the client. Minimum client version is 6.0 error anymore. Now I have the error Failed to complete authentication.
Wow, thanks @dlenski for the quick patch. That takes care of the prelogin but the login seems a bit different with this CAS auth method. We don't get a prelogin cookie or userauth cookie anymore. Instead we get a JWT. I'll see if I can figure it out..
That takes care of the prelogin but the login seems a bit different with this CAS auth method.
Somewhat unsurprising, sadly.
We don't get a prelogin cookie or userauth cookie anymore. Instead we get a JWT. I'll see if I can figure it out..
Interesting. Can at least one of you post an anonymized log of openconnect --dump-http-traffic -vvvv? Or email to the address on my profile if you aren't comfortable sharing it publicly? (I won't share it publicly; will just use it to give you advice on how to proceed, or to inform the implementation in OpenConnect if it's obvious how to proceed.)
I can probably make some educated guesses based on that.
Thanks. Clashing/inconsistent naming in proprietary VPN clients would also be sadly unsurprising
Although just based on a quick search, it appears that JWT is one of the pluggable options for the non-GP-specific CAS, so maybe they are using a standard-ish authentication method with its standard name?
I do have a test server featuring cas support and after finding out that i need to set cas-support, i found this ticket :) Will have a look at the JWT and try to add it.
Ok, i do have a working version. Will prepare a MR, but this depends on my external browser MR (!499). According to Palo Alto this is a requirement for CAS, didn't test internal webview.