All Apps and Add-ons
Highlighted

Proxy Support

Explorer

I configured the proxy setting in this addon, yet I still see this in the log files:

ProxyError: HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /CANTSHOWTHISBIT/oauth2/v2.0/token (Caused by ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',)))

If I check TA-MS-AAD/bin/taazureutils/utils.py, I see that proxies can be set up differently:

def get_proxy(helper, proxy_type="requests"):
    proxies = None
    helper.log_debug("_Splunk_ Getting proxy server.")
    proxy = helper.get_proxy()

    if proxy:
        helper.log_debug("_Splunk_ Proxy is enabled: %s:%s" % (proxy["proxy_url"], proxy["proxy_port"]))
        if proxy_type.lower()=="requests":
            proxy_url = "%s:%s" % (proxy["proxy_url"], proxy["proxy_port"])
            proxies = {
                    "http" : proxy_url,
                    "https" : proxy_url
                }
        elif proxy_type.lower()=="event hub":
            proxies = {
                'proxy_hostname': proxy["proxy_url"],
                'proxy_port': int(proxy["proxy_port"]),
                'username': proxy["proxy_username"],
                'password': proxy["proxy_password"]
            }

    return proxies

So it seems it hardcodes the proxytype to requests. The requests library does support proxy authentication by specifying the proxy url as PROTOCOL://USER:PASS@PROXYURL

If I change the relevant code to this:

            proxy_url = "%s:%s@%s:%s" % (proxy["proxy_username"], proxy["proxy_password"], proxy["proxy_url"], proxy["proxy_port"])
            proxies = {
                    "http" : "http://%s" % proxy_url,
                    "https" : "https://%s" % proxy_url
                }

it seems to work

Is this a known issue?