Azure-Sentinel icon indicating copy to clipboard operation
Azure-Sentinel copied to clipboard

Unable to install CEF collector on Linux machine using web proxy

Open jgallucci32 opened this issue 6 years ago • 6 comments

Describe the bug When installing the Linux Syslog agent to collect Common Event Format (CEF) Syslog messages, the install errors out when the system using a web proxy (such as Squid) to forward requests to the internet.

To Reproduce Steps to reproduce the behavior:

  1. Login to Linux machine to install the CEF collector
  2. Configure proxy settings
cat << EOF > /etc/profile.d/proxy.sh
export http_proxy=http://myproxy:3128/
export https_proxy=https://myproxy:3128/
export no_proxy="127.0.0.1, localhost"
EOF
  1. Re-login to system to ensure proxy settings persist
  2. Run the following command to install and apply the CEF collector
sudo wget https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/DataConnectors/CEF/cef_installer.py&&sudo python cef_installer.py <hash value>
  1. See error
--2020-03-16 14:50:45--  https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/DataConnectors/CEF/cef_installer.py
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... failed: Name or service not known.
wget: unable to resolve host address ‘raw.githubusercontent.com’

Expected behavior Log agent installed successfully

Server Info Red Hat Enterprise Linux 7.7

jgallucci32 avatar Mar 16 '20 21:03 jgallucci32

Per the Log Analytics agent documentation here and here, you set up a proxy by modifying the proxy.conf.

oshezaf avatar Mar 16 '20 22:03 oshezaf

Thanks @oshezaf this is pointing me in the right direction. It looks like the python wrapper script written for Azure Sentinel does not have support yet for an http proxy. I'll see if I can modify the script and issue a pull request.

jgallucci32 avatar Mar 17 '20 00:03 jgallucci32

Created pull request https://github.com/Azure/Azure-Sentinel/pull/531

There were two parts to the issue. The first part is with the cef_installer.py script which is in the pull request. The second issue was with sudo not passing the https_proxy environment variable.

To fix the second issue you need to modify /etc/suoders or add the file /etc/sudoers.d/proxykeep to pass the environment variables for http proxy settings

Defaults env_keep += "http_proxy https_proxy no_proxy"

With sudo passing the https_proxy environment variable and the cef_installer.py script modified to detect and add the argument to the omsagent install script, the CEF collector can be installed fully with proxy settings and no post-modifications required.

jgallucci32 avatar Mar 17 '20 21:03 jgallucci32

Thanks for the contribution, we are taking a look and will address the issue

Ronmarsiano avatar Mar 24 '20 11:03 Ronmarsiano

We were able to work around this problem by updating /etc/wgetrc to add the proxy variables http_proxy and https_proxy and enable it using use_proxy = on. We also added check_certificate = off to prevent issues with SSL. This ensures any instance of wget being called by scripts or nested scripts will always pickup the proxy configuration. Ref (link)

laughingman42 avatar May 28 '20 03:05 laughingman42

Closing as this has been work-arounded

preetikr avatar Dec 03 '20 21:12 preetikr