2 Replies Latest reply on Dec 15, 2011 6:43 AM by sco_at

    mcafee.client() and proxy


      I try to create a session from my workstation to my ePO-Server (both systems are on the same side of the company firewall) using mcafee.client ("ePO-fqdn", "port", "user", "password").    This statement works fine if i execute it locally on the ePO-Server. But if i try this from my workstation i get an error ("502 unauthorized") from the company proxy. Either Python or the mcafee.client-command tries to connect using the proxy - although of course the use of the proxy is excluded for local traffic. How can i modify the way my script connects?





        • 1. Re: mcafee.client() and proxy

          Ok, i did some testing & research. The default urllib2.ProxyHandler of Python cannot handle proxy exceptions and therefore forwards all traffic to the proxy server.  If i set up an empty ProxyHandler it works for a call to urlopen(local_address), but still fails for mcafee.client. So mcafee.client uses the default proxyhandler of urllib2, which cannot handle local destinations. Is there a way to "override" the ProxyHandler in the mcafee-module?

          • 2. Re: mcafee.client() and proxy

            And i found a workaround. I modified mcafee.py, class _CommandInvoker, ___Init___:



                    authhandler = urllib2.HTTPBasicAuthHandler(passmgr)

                   proxy_handler = urllib2.ProxyHandler({})

                    self.opener = urllib2.build_opener(authhandler, urllib2.HTTPCookieProcessor(), proxy_handler)


            This generates an empty ProxyHandler. But of course a supported solution would be preferred - companies usually have firewalls and proxies, so this could be an issue.

            1 of 1 people found this helpful