Bug #11136
closedSmart Proxy does not download PXE files through proxy
Description
I am setting up a Foreman environment behind a corporate proxy and am having issues with the Smart Proxy. Looking at the foreman-proxy log file, I see the messages:
DEBUG -- : Starting task: /usr/bin/wget --timeout=10 --tries=3 --no-check-certificate nv -c "http://mirror.centos.org/centos/6/os/x86_64/images/pxeboot/initrd.img" -O "/var/lib/tftpboot/boot/CentOS-6.6-x86_64-initrd.img" : [(unknown)] wget: unable to resolve host address "mirror.centos.org"
DEBUG -
Investigating /etc/rc.d/init.d/foreman-proxy reveals that foreman-proxy does not source /etc/profile (which sources /etc/profile.d/proxy.sh) or have any other method of pulling in proxy environment variables. I have been able to resolve the issue by adding /etc/profile to the sources as below:
if [ -f /etc/sysconfig/foreman-proxy ]; then
. /etc/sysconfig/foreman-proxy
. /etc/profile
fi
I am not sure if there is a better or more preferred way to resolve the issue I am seeing or if this change should be pushed to the Foreman source.
Updated by Dominic Cleal over 9 years ago
- Category set to TFTP
/etc/profile is normally only appropriate for a login shell, not a service, so we shouldn't really include it by default (plus this only works for init scripts).
It's probably best to set http_proxy in the sysconfig file so it's included into the environment.
Updated by Blaine Gardner over 9 years ago
Thank you for your reply. I can confirm that adding the following lines to /etc/sysconfig/foreman-proxy solves the issue:
HTTP_PROXY=<http_proxy>
HTTPS_PROXY=<https_proxy>
NO_PROXY=<no_proxy>
Additionally, 'service foreman-proxy restart' does not reload this configuration. It is necessary to stop and then start the process.