Unable to install CEF collector on Linux machine using web proxy
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:
- Login to Linux machine to install the CEF collector
- 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
- Re-login to system to ensure proxy settings persist
- 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>
- 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
Per the Log Analytics agent documentation here and here, you set up a proxy by modifying the proxy.conf.
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.
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.
Thanks for the contribution, we are taking a look and will address the issue
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)
Closing as this has been work-arounded