cancel
Showing results for 
Search instead for 
Did you mean: 
sco_at
Level 9
Report Inappropriate Content
Message 1 of 3

mcafee.client() and proxy

Jump to solution

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?

Thanks,

Bernhard

1 Solution

Accepted Solutions
Highlighted
sco_at
Level 9
Report Inappropriate Content
Message 3 of 3

Re: mcafee.client() and proxy

Jump to solution

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.

2 Replies
sco_at
Level 9
Report Inappropriate Content
Message 2 of 3

Re: mcafee.client() and proxy

Jump to solution

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?

Highlighted
sco_at
Level 9
Report Inappropriate Content
Message 3 of 3

Re: mcafee.client() and proxy

Jump to solution

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.

More McAfee Tools to Help You

Community Help Hub

    New to the forums or need help finding your way around the forums? There's a whole hub of community resources to help you.

  • Find Forum FAQs
  • Learn How to Earn Badges
  • Ask for Help
Go to Community Help

Join the Community

    Thousands of customers use the McAfee Community for peer-to-peer and expert product support. Enjoy these benefits with a free membership:

  • Get helpful solutions from McAfee experts.
  • Stay connected to product conversations that matter to you.
  • Participate in product groups led by McAfee employees.
Join the Community
Join the Community