Skip to content
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

gpclient CLI fails with Error: Gateway login error: 512 <unknown status code> #318

Closed
lgsmith opened this issue Feb 8, 2024 · 23 comments
Closed

Comments

@lgsmith
Copy link

lgsmith commented Feb 8, 2024

I'm having an issue using the CLI, although I'm able to use the GUI. The symptom of this is I start the commandline client, get the expected popup window, sign in with my credentials, then get a commandline request to pick vag-external-GW or hnt-external-GW. Either one results in a new popup with a second login request. When I submit that one, it logs me out with the error in the title line.

Oddly, there is no file at .local/share/gpclient/gpclient.log. Happy to provide any additional info. I'm on Kubuntu 22.04 LTS, and as I said have a working connection through the GUI client.

@yuezk
Copy link
Owner

yuezk commented Feb 9, 2024

Hi @lgsmith Thanks for your feedback. The gpclient.log is only for the GUI client, though the name seems confusing. The log of the CLI client is the output of the CLI itself. Could you please provide them to me? Thanks.

@lgsmith
Copy link
Author

lgsmith commented Feb 15, 2024

Hey sorry this took me a while to get back to. I was very busy last week.

Note that one of the peculiarities of this is that it pops open an authentication window as expected, then after I fill out the popup it asks me about hnt or vag from the terminal, then creates another popup that is the same login page as before. I re-enter my info there, and it does some other stuff, notably trying to create some dirs it doesn't have permissions for, then exits with an error about invalid username. The username and PW work when I use the GUI version of your tool.

Here's a copypaste from the stuff that gets printed to my terminal when I try to run the CLI with gpclient connect vpn.myinstitution.com:

[2024-02-15T18:46:46Z INFO  gpclient::cli] gpclient started: 2.0.0 (2024-02-05)
[2024-02-15T18:46:46Z INFO  gpapi::portal::prelogin] Prelogin with user_agent: PAN GlobalProtect
[2024-02-15T18:46:46Z INFO  gpauth::cli] gpauth started: 2.0.0 (2024-02-05)
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] Open auth window, user_agent: PAN GlobalProtect
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] Auth window user agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] Load the SAML request as HTML...
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] Loaded uri: about:blank
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] No headers found in response
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] Raise window in 1 second(s)
[2024-02-15T18:46:46Z INFO  gpauth::auth_window] Raise window cancelled
[2024-02-15T18:46:47Z INFO  gpauth::auth_window] Loaded uri: https://w**********u/idp/profile/SAML2/POST/SSO?execution=e**********1
[2024-02-15T18:46:47Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:46:47Z INFO  gpauth::auth_window] No saml-auth-status header found
[2024-02-15T18:46:47Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-15T18:46:47Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-02-15T18:46:47Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-15T18:46:47Z INFO  gpauth::auth_window] Raise window in 1 second(s)
[2024-02-15T18:46:49Z WARN  gpapi::utils::window] Failed to raise window: Failed to raise window: GlobalProtect Login
[2024-02-15T18:46:55Z INFO  gpauth::auth_window] Loaded uri: https://a**********m/frame/frameless/v4/auth?sid=f**********f&tx=e**********w
[2024-02-15T18:46:55Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:46:55Z INFO  gpauth::auth_window] No saml-auth-status header found
[2024-02-15T18:46:55Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-15T18:46:55Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-02-15T18:46:55Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-15T18:46:56Z INFO  gpauth::auth_window] Loaded uri: https://w**********u/idp/profile/SAML2/POST/SSO?execution=e**********2&_eventId_proceed=1
[2024-02-15T18:46:56Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:46:56Z INFO  gpauth::auth_window] No saml-auth-status header found
[2024-02-15T18:46:56Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-15T18:46:56Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-02-15T18:46:56Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-15T18:46:56Z INFO  gpauth::auth_window] Loaded uri: https://v**********u/SAML20/SP/ACS
[2024-02-15T18:46:56Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:46:56Z INFO  gpauth::auth_window] Got auth data from headers
[2024-02-15T18:46:56Z INFO  gpapi::portal::config] Portal config, user_agent: PAN GlobalProtect
> Which gateway do you want to connect to? vag-external-GW (vag-gw.vpn.upenn.edu)
[2024-02-15T18:47:02Z INFO  gpapi::gateway::login] Gateway login, user_agent: PAN GlobalProtect
[2024-02-15T18:47:02Z INFO  gpclient::connect] Gateway login failed: Gateway login error: 512 <unknown status code>
[2024-02-15T18:47:02Z INFO  gpapi::portal::prelogin] Prelogin with user_agent: PAN GlobalProtect
[2024-02-15T18:47:03Z INFO  gpapi::portal::prelogin] Prelogin response does not contain region element
[2024-02-15T18:47:03Z INFO  gpauth::cli] gpauth started: 2.0.0 (2024-02-05)
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Open auth window, user_agent: PAN GlobalProtect
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Auth window user agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Load the SAML request as HTML...
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Loaded uri: about:blank
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] No headers found in response
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Raise window in 1 second(s)
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Raise window cancelled
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Loaded uri: https://w**********u/idp/profile/SAML2/POST/SSO?execution=e**********1
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] No saml-auth-status header found
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-15T18:47:03Z INFO  gpauth::auth_window] Raise window in 1 second(s)
[2024-02-15T18:47:05Z WARN  gpapi::utils::window] Failed to raise window: Failed to raise window: GlobalProtect Login
[2024-02-15T18:47:26Z INFO  gpauth::auth_window] Loaded uri: https://a**********m/frame/frameless/v4/auth?sid=f**********c&tx=e**********g
[2024-02-15T18:47:26Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:47:26Z INFO  gpauth::auth_window] No saml-auth-status header found
[2024-02-15T18:47:26Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-15T18:47:26Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-02-15T18:47:26Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-15T18:47:27Z INFO  gpauth::auth_window] Loaded uri: https://w**********u/idp/profile/SAML2/POST/SSO?execution=e**********2&_eventId_proceed=1
[2024-02-15T18:47:27Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:47:27Z INFO  gpauth::auth_window] No saml-auth-status header found
[2024-02-15T18:47:27Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-15T18:47:27Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-02-15T18:47:27Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-15T18:47:27Z INFO  gpauth::auth_window] Loaded uri: https://v**********u/SAML20/SP/ACS
[2024-02-15T18:47:27Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-15T18:47:27Z INFO  gpauth::auth_window] Got auth data from headers
[2024-02-15T18:47:27Z INFO  gpapi::gateway::login] Gateway login, user_agent: PAN GlobalProtect
[2024-02-15T18:47:27Z INFO  openconnect::ffi] openconnect version: v8.20-1
[2024-02-15T18:47:27Z INFO  openconnect::ffi] User agent: PAN GlobalProtect
[2024-02-15T18:47:27Z INFO  openconnect::ffi] VPNC script: /usr/share/vpnc-scripts/vpnc-script
[2024-02-15T18:47:27Z INFO  openconnect::ffi] OS: linux
[2024-02-15T18:47:27Z INFO  openconnect::ffi] CSD_USER: 1000
[2024-02-15T18:47:27Z INFO  openconnect::ffi] CSD_WRAPPER: (null)
[2024-02-15T18:47:27Z INFO  openconnect::ffi] POST https://vag-gw.vpn.upenn.edu/ssl-vpn/getconfig.esp
[2024-02-15T18:47:27Z INFO  openconnect::ffi] Connected to [2607:f470:0:2:0:4:56:3]:443
[2024-02-15T18:47:27Z INFO  openconnect::ffi] SSL negotiation with vag-gw.vpn.upenn.edu
[2024-02-15T18:47:27Z INFO  openconnect::ffi] Connected to HTTPS on vag-gw.vpn.upenn.edu with ciphersuite (TLS1.2)-(ECDHE-SECP256R1)-(RSA-SHA256)-(AES-256-GCM)
[2024-02-15T18:47:27Z INFO  openconnect::ffi] Tunnel timeout (rekey interval) is 480 minutes.
[2024-02-15T18:47:27Z INFO  openconnect::ffi] Idle timeout is 480 minutes.
[2024-02-15T18:47:27Z WARN  openconnect::ffi] GlobalProtect IPv6 support is experimental. Please report results to <openconnect-devel@lists.infradead.org>.
[2024-02-15T18:47:27Z WARN  openconnect::ffi] No MTU received. Calculated 1406 for ESP tunnel
[2024-02-15T18:47:27Z INFO  openconnect::ffi] POST https://vag-gw.vpn.upenn.edu/ssl-vpn/hipreportcheck.esp
[2024-02-15T18:47:27Z WARN  openconnect::ffi] WARNING: Server asked us to submit HIP report with md5sum ac92143a1cca3b607d5de4d8aea77bf0.
        VPN connectivity may be disabled or limited without HIP report submission.
        You need to provide a --csd-wrapper argument with the HIP report submission script.
[2024-02-15T18:47:32Z WARN  openconnect::ffi] Failed to connect ESP tunnel; using HTTPS instead.
mkdir: cannot create directory ‘/var/run/vpnc’: Permission denied
[2024-02-15T18:47:33Z WARN  openconnect::ffi] Failed to bind local tun device (TUNSETIFF): Operation not permitted
[2024-02-15T18:47:33Z WARN  openconnect::ffi] To configure local networking, openconnect must be running as root
    See https://www.infradead.org/openconnect/nonroot.html for more information
mkdir: cannot create directory ‘/var/run/vpnc’: Permission denied
[2024-02-15T18:47:33Z WARN  openconnect::ffi] Failed to bind local tun device (TUNSETIFF): Operation not permitted
[2024-02-15T18:47:33Z WARN  openconnect::ffi] To configure local networking, openconnect must be running as root
    See https://www.infradead.org/openconnect/nonroot.html for more information
Set up tun device failed
[2024-02-15T18:47:33Z INFO  openconnect::ffi] POST https://vag-gw.vpn.upenn.edu/ssl-vpn/logout.esp
[2024-02-15T18:47:33Z INFO  openconnect::ffi] SSL negotiation with vag-gw.vpn.upenn.edu
[2024-02-15T18:47:33Z INFO  openconnect::ffi] Connected to HTTPS on vag-gw.vpn.upenn.edu with ciphersuite (TLS1.2)-(ECDHE-SECP256R1)-(RSA-SHA256)-(AES-256-GCM)
[2024-02-15T18:47:33Z WARN  openconnect::ffi] Invalid user name
[2024-02-15T18:47:33Z WARN  openconnect::ffi] Logout failed.
[2024-02-15T18:47:33Z INFO  openconnect::ffi] openconnect_mainloop returned -5, exiting

@hussamnasir
Copy link

i am getting the exact same error

@yuezk
Copy link
Owner

yuezk commented Feb 16, 2024

@lgsmith @hussamnasir gpclient connect should be run with sudo. The GUI also connects the VPN server with the root privilege by leveraging the polkit policy. The CLI version cannot leverage it. So you need to run them as sudo manually.

@hussamnasir
Copy link

hussamnasir commented Feb 16, 2024

@yuezk The error was with running using sudo
``[2024-02-16T13:16:08Z INFO gpclient::cli] gpclient started: 2.0.0 (2024-02-05)
[2024-02-16T13:16:08Z INFO gpapi::portal::prelogin] Prelogin with user_agent: PAN GlobalProtect
[2024-02-16T13:16:08Z INFO gpauth::cli] gpauth started: 2.0.0 (2024-02-05)
[2024-02-16T13:16:08Z INFO gpauth::cli] Fixing OpenSSL environment
[2024-02-16T13:16:08Z INFO gpauth::auth_window] Open auth window, user_agent: PAN GlobalProtect
[2024-02-16T13:16:08Z INFO gpauth::auth_window] Auth window user agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
[2024-02-16T13:16:08Z INFO gpauth::auth_window] Load the SAML request as URI...
[2024-02-16T13:16:09Z INFO gpauth::auth_window] Loaded uri: https://a**********u/adfs/ls/?SAMLRequest=h**********%3D&RelayState=E**********%3D
[2024-02-16T13:16:09Z INFO gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-16T13:16:09Z INFO gpauth::auth_window] No saml-auth-status header found
[2024-02-16T13:16:09Z INFO gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-16T13:16:09Z INFO gpauth::auth_window] No auth data found in HTML
[2024-02-16T13:16:09Z INFO gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-16T13:16:09Z INFO gpauth::auth_window] Raise window in 1 second(s)
[2024-02-16T13:16:16Z WARN gpauth::auth_window] Failed to load uri: https://a**********u/adfs/ls/?SAMLRequest=h**********%3D&RelayState=E**********%3D&client-request-id=a**********f with error: Load request cancelled
[2024-02-16T13:16:16Z INFO gpauth::auth_window] Loaded uri: https://a**********u/adfs/ls/?SAMLRequest=h**********%3D&RelayState=E**********%3D&client-request-id=a**********f
[2024-02-16T13:16:16Z INFO gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-16T13:16:16Z INFO gpauth::auth_window] No saml-auth-status header found
[2024-02-16T13:16:16Z INFO gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-16T13:16:16Z INFO gpauth::auth_window] No auth data found in HTML
[2024-02-16T13:16:16Z INFO gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-16T13:16:17Z INFO gpauth::auth_window] Loaded uri: https://a**********m/frame/frameless/v4/auth?sid=f**********0&tx=e**********Q
[2024-02-16T13:16:17Z INFO gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-16T13:16:17Z INFO gpauth::auth_window] No saml-auth-status header found
[2024-02-16T13:16:17Z INFO gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-16T13:16:17Z INFO gpauth::auth_window] No auth data found in HTML
[2024-02-16T13:16:17Z INFO gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-16T13:16:18Z INFO gpauth::auth_window] Loaded uri: https://a**********m/frame/v4/preauth/healthcheck?sid=f**********0
[2024-02-16T13:16:18Z INFO gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-16T13:16:18Z INFO gpauth::auth_window] No saml-auth-status header found
[2024-02-16T13:16:18Z INFO gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-16T13:16:18Z INFO gpauth::auth_window] No auth data found in HTML
[2024-02-16T13:16:18Z INFO gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-16T13:16:18Z INFO gpauth::auth_window] Loaded uri: https://a**********m/frame/frameless/v4/auth?sid=f**********0&tx=e**********Q
[2024-02-16T13:16:18Z INFO gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-16T13:16:18Z INFO gpauth::auth_window] No saml-auth-status header found
[2024-02-16T13:16:18Z INFO gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-16T13:16:18Z INFO gpauth::auth_window] No auth data found in HTML
[2024-02-16T13:16:18Z INFO gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-16T13:16:19Z INFO gpauth::auth_window] Loaded uri: https://a**********m/frame/frameless/v4/auth?sid=f**********0&tx=e**********Q
[2024-02-16T13:16:19Z INFO gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-16T13:16:19Z INFO gpauth::auth_window] No saml-auth-status header found
[2024-02-16T13:16:19Z INFO gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-16T13:16:19Z INFO gpauth::auth_window] No auth data found in HTML
[2024-02-16T13:16:19Z INFO gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-16T13:16:21Z INFO gpauth::auth_window] Loaded uri: https://a**********u/adfs/ls/?SAMLRequest=h**********%3D&RelayState=E**********%3D&client-request-id=a**********f
[2024-02-16T13:16:21Z INFO gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-16T13:16:21Z INFO gpauth::auth_window] No saml-auth-status header found
[2024-02-16T13:16:21Z INFO gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-16T13:16:21Z INFO gpauth::auth_window] No auth data found in HTML
[2024-02-16T13:16:21Z INFO gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-16T13:16:21Z INFO gpauth::auth_window] Loaded uri: https://r**********u/SAML20/SP/ACS
[2024-02-16T13:16:21Z INFO gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-16T13:16:21Z INFO gpauth::auth_window] Got auth data from headers
[2024-02-16T13:16:21Z INFO gpapi::portal::config] Portal config, user_agent: PAN GlobalProtect
[2024-02-16T13:16:21Z INFO gpapi::gateway::login] Gateway login, user_agent: PAN GlobalProtect
[2024-02-16T13:16:21Z INFO gpclient::connect] Gateway login failed: Gateway login error: 512
[2024-02-16T13:16:21Z INFO gpapi::portal::prelogin] Prelogin with user_agent: PAN GlobalProtect
[2024-02-16T13:16:21Z INFO gpauth::cli] gpauth started: 2.0.0 (2024-02-05)
[2024-02-16T13:16:21Z INFO gpauth::cli] Fixing OpenSSL environment
[2024-02-16T13:16:21Z INFO gpauth::auth_window] Open auth window, user_agent: PAN GlobalProtect
[2024-02-16T13:16:21Z INFO gpauth::auth_window] Auth window user agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
[2024-02-16T13:16:21Z INFO gpauth::auth_window] Load the SAML request as URI...
[2024-02-16T13:16:22Z INFO gpauth::auth_window] Loaded uri: https://a**********u/adfs/ls/?SAMLRequest=h**********f&RelayState=H**********%3D
[2024-02-16T13:16:22Z INFO gpauth::auth_window] Trying to read auth data from response headers...
[2024-02-16T13:16:22Z INFO gpauth::auth_window] No saml-auth-status header found
[2024-02-16T13:16:22Z INFO gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-02-16T13:16:22Z INFO gpauth::auth_window] No auth data found in HTML
[2024-02-16T13:16:22Z INFO gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-02-16T13:16:22Z INFO gpauth::auth_window] Raise window in 1 second(s)
[2024-02-16T13:16:26Z INFO gpclient::connect] Failed to connect portal with prelogin: Auth cancelled
`

@yuezk
Copy link
Owner

yuezk commented Feb 16, 2024

@hussamnasir does the GUI version work for you?

@hussamnasir
Copy link

hussamnasir commented Feb 16, 2024

yes it did until my trial license ended 2 days ago and that's when I switched to the CLi version. It worked both via the experiment browser connect and the pop browser window for authentication

@yuezk
Copy link
Owner

yuezk commented Feb 16, 2024

Have the CLI version ever worked for you? The CLI version has the same workflow except it doesn’t support the default browser.

@yuezk
Copy link
Owner

yuezk commented Feb 16, 2024

@hussamnasir From your logs, it got the auth cookie from the pop auth window but failed to log in to the gateway, the request failed with a 512 status code. So it tries to connect the portal as a gateway, but you canceled the auth workflow.

@hussamnasir
Copy link

Well, I got the pop-up the first time I authenticated, but then the pop-up for auth relaunched and I canceled it when it popped up the second time.

@yuezk
Copy link
Owner

yuezk commented Feb 16, 2024

You could try to authenticate the second time to see if it can connect.

@hussamnasir
Copy link

hussamnasir commented Feb 16, 2024

Yes it connects after the second auth . Is this a bug ? i am using Ubuntu 23.10

@yuezk
Copy link
Owner

yuezk commented Feb 16, 2024

No. It’s related to the portal server. We will try the portal authentication first, and fall back to the gateway authentication workflow if failed. This is designed to support more portal servers.

@hussamnasir
Copy link

okay. Is the browser based experimental feature that is available in the GUI version be available for the
CLI

@yuezk
Copy link
Owner

yuezk commented Feb 16, 2024

Yes. Will add it in the future releases.

@lgsmith
Copy link
Author

lgsmith commented Feb 20, 2024

When I run with sudo I am able to connect, but it still asks me to log in twice, serially, with popups. I see this is expected behavior but am wondering if I can set an option that causes it to default past the first kind of portal servers.

Also, would be pretty great to not have to use sudo. Why is it that the CLI needs this but GUI doesn't?

@yuezk
Copy link
Owner

yuezk commented Feb 26, 2024

@lgsmith

When I run with sudo I am able to connect, but it still asks me to log in twice, serially, with popups. I see this is expected behavior but am wondering if I can set an option that causes it to default past the first kind of portal servers.

Will consider if I could add a new option for this.

The GUI version can leverage the polkit policy, but the CLI cannot. See my above reply: #318 (comment)

@Papooch
Copy link

Papooch commented Apr 2, 2024

I am also experiencing the same issue of having to log in two times. A CLI option to choose an authentication option manually would be appreciated :)

Btw. I also tried sudo gpclient connect --gateway <server> <server> in attempt to make it to use the server as gateway, but that didn't work.

These are my logs:

# It fails at first
[2024-04-02T14:38:01Z INFO  gpapi::gateway::login] Gateway login, user_agent: PAN GlobalProtect
[2024-04-02T14:38:02Z WARN  gpapi::gateway::login] Gateway login error: reason=<none>, status=512 <unknown status code>, response=<html>
      <head></head>
      <body>
      var respStatus = "Error";
      var respMsg = "Authentication failure: Invalid username or password";
      thisForm.inputStr.value = "";
    </body>
    </html>
[2024-04-02T14:38:02Z INFO  gpclient::connect] Gateway login failed: Gateway login error, reason: <none>
[2024-04-02T14:38:02Z INFO  gpclient::connect] Treat the portal as the gateway, connecting...
[2024-04-02T14:38:02Z INFO  gpapi::portal::prelogin] Prelogin with user_agent: PAN GlobalProtect
[2024-04-02T14:38:02Z INFO  gpauth::cli] gpauth started: 2.1.1 (2024-03-25)
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] Open auth window, user_agent: PAN GlobalProtect
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] Auth window user agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] Load the SAML request as URI...
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] Loaded uri: https://i**********z/my.policy
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] No saml-auth-status header found
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-04-02T14:38:02Z INFO  gpauth::auth_window] Raise window in 1 second(s)
[2024-04-02T14:38:04Z WARN  gpapi::utils::window] Failed to raise window: Failed to raise window: GlobalProtect Login
[2024-04-02T14:38:10Z INFO  gpauth::auth_window] Loaded uri: https://i**********z/my.policy
[2024-04-02T14:38:10Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-04-02T14:38:10Z INFO  gpauth::auth_window] No saml-auth-status header found
[2024-04-02T14:38:10Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-04-02T14:38:10Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-04-02T14:38:10Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-04-02T14:38:17Z INFO  gpauth::auth_window] Loaded uri: https://i**********z/saml/idp/profile/redirectorpost/sso?SAMLRequest=l**********b&RelayState=f**********w&SigAlg=h**********6&Signature=b**********%3D
[2024-04-02T14:38:17Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-04-02T14:38:17Z INFO  gpauth::auth_window] No saml-auth-status header found
[2024-04-02T14:38:17Z INFO  gpauth::auth_window] No auth data found in headers, trying to read from body...
[2024-04-02T14:38:17Z INFO  gpauth::auth_window] No auth data found in HTML
[2024-04-02T14:38:17Z INFO  gpauth::auth_window] No auth data found, it may not be the /SAML20/SP/ACS endpoint
[2024-04-02T14:38:17Z INFO  gpauth::auth_window] Loaded uri: https://g**********z/SAML20/SP/ACS
[2024-04-02T14:38:17Z INFO  gpauth::auth_window] Trying to read auth data from response headers...
[2024-04-02T14:38:17Z INFO  gpauth::auth_window] Got auth data from headers
# Then it succeeds
[2024-04-02T14:38:17Z INFO  gpapi::gateway::login] Gateway login, user_agent: PAN GlobalProtect
[2024-04-02T14:38:17Z INFO  openconnect::ffi] openconnect version: v8.20-1
[2024-04-02T14:38:17Z INFO  openconnect::ffi] User agent: PAN GlobalProtect
[2024-04-02T14:38:17Z INFO  openconnect::ffi] VPNC script: /usr/share/vpnc-scripts/vpnc-script
[2024-04-02T14:38:17Z INFO  openconnect::ffi] OS: linux
[2024-04-02T14:38:17Z INFO  openconnect::ffi] CSD_USER: 1000
[2024-04-02T14:38:17Z INFO  openconnect::ffi] CSD_WRAPPER: /usr/libexec/openconnect/hipreport.sh
[2024-04-02T14:38:17Z INFO  openconnect::ffi] MTU: 0
[2024-04-02T14:38:17Z INFO  openconnect::ffi] POST https://xxxxxx.xx/ssl-vpn/getconfig.esp
[2024-04-02T14:38:17Z INFO  openconnect::ffi] Connected to xx.xx.xx.xx:xxx

While it says Authentication failure: Invalid username or password, I am always entering the same information. It always works on the second try.

EDIT: I am on version gpclient 2.1.2 (2024-03-29)

@yuezk
Copy link
Owner

yuezk commented Apr 2, 2024

@Papooch Thanks for the logs, I will investigate it and add an option if necessary.

yuezk added a commit that referenced this issue Apr 6, 2024
yuezk added a commit that referenced this issue Apr 6, 2024
@yuezk
Copy link
Owner

yuezk commented Apr 8, 2024

@Papooch In 2.1.3, I added the option --as-gateway to gpclient connect command. Passing this option will treat the server as a gateway and connect to it directly.

Closing it for now, reopen if it is not fixed.

@yuezk yuezk closed this as completed Apr 8, 2024
@Papooch
Copy link

Papooch commented Apr 8, 2024

Thank you for the quick fix! It works as expected now and I don't have to re-enter my information twice!

@lgsmith
Copy link
Author

lgsmith commented Apr 13, 2024

Thanks, this also worked for me. I'm a bit curious what the --gateway option is for, if not this.

@yuezk
Copy link
Owner

yuezk commented Apr 14, 2024

The gateway parameter is used to specify which gateway to use when the server is a portal and has multiple gateways.

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

No branches or pull requests

4 participants