4 [![Test Workflow Status](https://github.com/dlenski/gp-saml-gui/workflows/build/badge.svg)](https://github.com/dlenski/gp-saml-gui/actions/workflows/test.yml)
9 * [Introduction](#introduction)
10 * [Installation](#installation)
11 * [First, non-Python Dependencies](#first-non-python-dependencies)
12 * [Second, gp-saml-gui itself](#second-gp-saml-gui-itself)
13 * [How to use](#how-to-use)
14 * [Extra arguments to OpenConnect](#extra-arguments-to-openconnect)
20 This is a helper script to allow you to interactively login to a GlobalProtect VPN
21 that uses [SAML](https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language)
22 authentication, so that you can subsequently connect with [OpenConnect](https://www.infradead.org/openconnect).
23 (The GlobalProtect protocol is supported in OpenConnect v8.0 or newer; v8.06+ is recommended.)
25 Interactive login is, unfortunately, sometimes a necessary alternative to automated
26 login via scripts such as
27 [zdave/openconnect-gp-okta](https://github.com/zdave/openconnect-gp-okta).
29 This script is known to work with many GlobalProtect VPNs using the major single-sign-on (SSO) providers:
31 - Okta (sign-in URLs typically `https://<company>.okta.com/login/*`)
32 - Microsoft (sign-in URLs typically `https://login.microsoftonline.com/*`)
34 Please search and file [issues](https://github.com/dlenski/gp-saml-gui/issues) if you can report success
35 or failure with other SSO SAML providers.
40 First, non-Python Dependencies
41 ------------------------------
43 gp-saml-gui uses GTK, which requires Python 3 bindings.
45 On Debian / Ubuntu, these are packaged as `python3-gi`, `gir1.2-gtk-3.0`, and
49 $ sudo apt install python3-gi gir1.2-gtk-3.0 gir1.2-webkit2-4.0
52 On Fedora (and possibly RHEL/CentOS) the matching libraries are packaged in
53 `python3-gobject`, `gtk3-devel`, and `webkit2gtk3-devel`:
56 $ sudo dnf install python3-gobject gtk3-devel webkit2gtk3-devel
59 On Arch Linux, the libraries are packaged in `gtk3`, `gobject-introspection`
63 $ sudo pacman -S gtk3 gobject-introspection webkit2gtk
66 Second, gp-saml-gui itself
67 --------------------------
69 Install gp-saml-gui itself using `pip`:
72 $ pip3 install https://github.com/dlenski/gp-saml-gui/archive/master.zip
75 usage: gp-saml-gui [-h] [--no-verify] [-C COOKIES | -K] [-p | -g] [-c CERT]
76 [--key KEY] [-v | -q] [-x | -P | -S] [-u]
77 [--clientos {Windows,Linux,Mac}] [-f EXTRA]
78 server [openconnect_extra [openconnect_extra ...]]
79 gp-saml-gui: error: the following arguments are required: server, openconnect_extra
85 Specify the GlobalProtect server URL (portal or gateway) and optional
86 arguments, such as `--clientos=Windows` (because many GlobalProtect
87 servers don't require SAML login, but apparently omit it in their configuration
88 for OSes other than Windows).
90 This script will pop up a [GTK WebKit2 WebView](https://webkitgtk.org/) window
91 alongside your terminal window (see this [screenshot](screenshot.png)).
92 After you successfully complete the SAML login via web forms, the script will output
93 `HOST`, `USER`, `COOKIE`, and `OS` variables in a form that can be used by
94 [OpenConnect](http://www.infradead.org/openconnect/juniper.html)
95 (similar to the output of `openconnect --authenticate`):
98 $ eval $( gp-saml-gui --gateway --clientos=Windows vpn.company.com )
99 Got SAML POST content, opening browser...
100 Finished loading about:blank...
101 Finished loading https://company.okta.com/app/panw_globalprotect/deadbeefFOOBARba1234/sso/saml...
102 Finished loading https://company.okta.com/login/sessionCookieRedirect...
103 Finished loading https://vpn.qorvo.com/SAML20/SP/ACS...
104 Got SAML relevant headers, done: {'prelogin-cookie': 'blahblahblah', 'saml-username': 'foo12345@corp.company.com', 'saml-slo': 'no', 'saml-auth-status': '1'}
106 SAML response converted to OpenConnect command line invocation:
108 echo 'blahblahblah' |
109 openconnect --protocol=gp --user='foo12345@corp.company.com' --os=win --usergroup=gateway:prelogin-cookie --passwd-on-stdin vpn.company.com
111 $ echo $HOST; echo $USER; echo $COOKIE; echo $OS
112 https://vpn.company.com/gateway:prelogin-cookie
113 foo12345@corp.company.com
117 $ echo "$COOKIE" | openconnect --protocol=gp -u "$USER" --os="$OS" --passwd-on-stdin "$HOST"
120 If you specify either the `-P`/`--pkexec-openconnect` or `-S`/`--sudo-openconnect` options, the script
121 will automatically invoke OpenConnect as described, using either [`pkexec` from Polkit](https://www.freedesktop.org/software/polkit/docs/0.106/polkit.8.html)
122 or [`sudo`](https://www.sudo.ws/), as specified.
124 # Extra Arguments to OpenConnect
126 Extra arguments needed for OpenConnect can be specified by adding ` -- ` to the command line, and then
127 appending these. For example:
130 $ gp-saml-gui -P --gateway --clientos=Windows vpn.company.com -- --csd-wrapper=hip-report.sh
132 Launching OpenConnect with pkexec, equivalent to:
133 echo blahblahblahlongrandomcookievalue |
134 sudo openconnect --protocol=gp --user=foo12345@corp.company.com --os=win --usergroup=gateway:prelogin-cookie --passwd-on-stdin vpn.company.com
135 <pkexec authentication dialog pops up>