From d7a0985ec314470a2602141f09f268ab83376f66 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Tue, 17 Sep 2019 10:59:49 -0400 Subject: [PATCH] Add 'GP_' prefix to environment variables This avoids a name collision with $HOST and $USER, which are overloaded in Linux/Unix environments. --- README.md | 6 +++--- gp-saml-gui.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6df9f5d..4e70a47 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Specify the GlobalProtect server URL (portal or gateway) and optional arguments. This script will pop up a [GTK WebKit2 WebView](https://webkitgtk.org/) window. After you succesfully complete the SAML login via web forms, the script will output -`HOST`, `USER`, and `COOKIE` variables in a form that can be used by +`GP_HOST`, `GP_USER`, and `GP_COOKIE` variables in a form that can be used by [OpenConnect](http://www.infradead.org/openconnect/juniper.html) (similar to the output of `openconnect --authenticate`): @@ -33,12 +33,12 @@ SAML response converted to OpenConnect command line invocation: echo 'blahblahblah' | openconnect --protocol=gp --user='foo12345@corp.company.com' --usergroup=prelogin-cookie:gateway --passwd-on-stdin vpn.company.com -$ echo $HOST; echo $USER; echo $COOKIE +$ echo $GP_HOST; echo $GP_USER; echo $GP_COOKIE https://vpn.company.com/gateway:prelogin-cookie foo12345@corp.company.com blahblahblah' -$ echo "$COOKIE" | openconnect --protocol=gp -u "$USER" --passwd-on-stdin "$HOST" +$ echo "$GP_COOKIE" | openconnect --protocol=gp -u "$GP_USER" --passwd-on-stdin "$GP_HOST" ``` TODO diff --git a/gp-saml-gui.py b/gp-saml-gui.py index e34d123..49f0f4f 100755 --- a/gp-saml-gui.py +++ b/gp-saml-gui.py @@ -148,4 +148,4 @@ def parse_args(args = None): print(''' echo {!r} |\n openconnect --protocol=gp --user={!r} --usergroup={}:{} --passwd-on-stdin {}\n'''.format( cv, un, ('portal' if args.portal else 'gateway'), cn, args.server), file=stderr) - print("HOST={!r}\nUSER={!r}\nCOOKIE={!r}".format('https://%s/%s:%s' % (args.server, ('portal' if args.portal else 'gateway'), cn), un, cv)) + print("GP_HOST={!r}\nGP_USER={!r}\nGP_COOKIE={!r}".format('https://%s/%s:%s' % (args.server, ('portal' if args.portal else 'gateway'), cn), un, cv))