How to sync yum repos via proxy

Add your proxy’s address to the below files:

/etc/foreman/settings.yaml

:http_proxy: http://yourProxyIP:3128

/etc/foreman/plugins/katello.yaml

:cdn_proxy:
    host: http://yourProxyIP
    port: 3128
    user: "" # this is not optional
    password: ""

/etc/pulp/server/plugins.conf.d/yum_importer.json

 {
   "proxy_host": "http://yourProxyIP",
   "proxy_port: 3128,
   "proxy_username": null,
   "proxy_password": null,
   "max_speed": null,
   "gpg_sign_metadata": false
 }

Restart foreman

-HTH

1 Like

One thing I forgot to mention. Make copies of those files as if you run foreman-install again they will get overwritten…

You can also use the installer options for it.

--katello-proxy-password Proxy password for authentication (default: nil)
--katello-proxy-port Port the proxy is running on (default: nil)
--katello-proxy-url URL of the proxy server (default: nil)
--katello-proxy-username Proxy username for authentication (default: nil)
1 Like

Hi there
Juste to add something, if you’re behind a corporate authenticated proxy and use an Active directory user, you’ll need to escape the \ :

{
"proxy_host": "yourproxy.domain.corp",
"proxy_port": 8080,
"proxy_username": "DOMAIN\\USER",
"proxy_password": "PASSWORD",
"max_speed": null,
"gpg_sign_metadata": false
}

Regards

1 Like

Hello,
Tried this but when I try to install my first machine, vmlinuz and initrd still sized 0 and :slight_smile:

[root boot]# tail -f /var/log/foreman-proxy/proxy.log
2021-03-05T10:55:56 6fcadf91 [I] [2272] Started task ["/usr/bin/wget", “–connect-timeout=10”, “–dns-timeout=10”, “–read-timeout=60”, “–tries=3”, “–no-check-certificate”, “-nv”, “-c”, “http://mirror.centos.org/centos/8/BaseOS/x86_64/kickstart/images/pxeboot/initrd.img”, “-O”, “/var/lib/tftpboot/boot/centos-8-mirror-ejPIbtG4jFDG-initrd.img”]

Also set HTTP(S) proxy http://myProxy:3128 in the GUI
Machine was also rebooted.
but NOTHING.
Please where to check further ?
Regards

I’ve worked arount by creating /etc/sysconfig/foreman-proxy and set the http_proxy variable inside.
Any idea please of the orthodox way to do it ?

So provided solution above is not working for you because of this is only for foreman itself and katello, but in your case it is Smart proxy TFTP that needs the proxy. I have not found an installer option or even puppet code when looking at it, so this really could be a missing feature or it simply expects a system-wide proxy setting, which Feature #1458: HTTP/HTTPS/FTP Proxy-Support - Smart Proxy - Foreman seams to confirm!

Hello,
There is a HTTP proxies option in infrastructrure menu. Also tested it but with no result.
The problem is if I set the general variable as mentionned, internal communication does not work anymore.
Whats the purpose of the HTTP proxies variable in the GUI is not this one ?
Regards

I had this problem but it seems even if your proxy doesn’t need a user and password it is required in the gui. seem sto be no way to get rid of the user admin and then the sync silently soesn;t do anything as it expects a password if there is a user.