Skip to content

Commit 13d373a

Browse files
mchehabdlenski
authored andcommitted
gp_saml_gui.py: allow ignore system proxy settings
Using a proxy while trying to connect to VPN can be problematic, as proxies are usually behind the VPN. So, add an option to disable it when opening the WebKit window.
1 parent fd1a3fb commit 13d373a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gp_saml_gui.py

+7
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ def __init__(self, uri, html, args):
6666
self.cookies.set_persistent_storage(args.cookies, WebKit2.CookiePersistentStorage.TEXT)
6767
self.wview = WebKit2.WebView()
6868

69+
if args.no_proxy:
70+
data_manager = self.ctx.get_website_data_manager()
71+
data_manager.set_network_proxy_settings(WebKit2.NetworkProxyMode.NO_PROXY, None)
72+
6973
if args.user_agent is None:
7074
args.user_agent = 'PAN GlobalProtect'
7175
settings = self.wview.get_settings()
@@ -279,6 +283,7 @@ def parse_args(args = None):
279283
help='Allow use of insecure renegotiation or ancient 3DES and RC4 ciphers')
280284
p.add_argument('--user-agent', '--useragent', default='PAN GlobalProtect',
281285
help='Use the provided string as the HTTP User-Agent header (default is %(default)r, as used by OpenConnect)')
286+
p.add_argument('--no-proxy', action='store_true', help='Disable system proxy settings')
282287
p.add_argument('openconnect_extra', nargs='*', help="Extra arguments to include in output OpenConnect command-line")
283288
args = p.parse_args(args)
284289

@@ -413,6 +418,8 @@ def main(args = None):
413418
if key:
414419
openconnect_args.insert(1, "--sslkey="+key)
415420
openconnect_args.insert(1, "--certificate="+cert)
421+
if args.no_proxy:
422+
openconnect_args.insert(1, "--no-proxy")
416423

417424
openconnect_command = ''' echo {} |\n sudo openconnect {}'''.format(
418425
quote(cv), " ".join(map(quote, openconnect_args)))

0 commit comments

Comments
 (0)