Smart Proxy missing API after Foreman 3.1.2/Katello 4.3 upgrade

Problem:
After upgrading to Foreman 3.1.2 and Katello 4.3 from Foreman 2.5.2, the Smart Proxies cannot find host groups via the API when registering a host.

Expected outcome:
Successful registration via bootstrap.py script

Foreman and Proxy versions:
Foreman 3.1.2 and Katello 4.3.0-1

Foreman and Proxy plugin versions:
Foreman Proxy 3.1.2-1

Distribution and version:
CentOS 7.9.2009

Other relevant data:
When registering via the bootstrap.py script, we get a 404 Not Found error back

An error occurred: HTTP Error 404: Not Found
url: https://smartproxyfqdn:443/api/v2/hostgroups/?search=title%3D"centos7"
code: 404
error: HTTP Error 404: Not Found

But if I try to use curl to query the Foreman server directly, I get a proper response. However when querying any of my Smart Proxies, I get the 404 Not Found error.

Can you try editing /etc/rhsm/rhsm.conf and setting port to 8443 instead?

We have recently consolidated ports a bit, and this might be fallout from this.

cc @ehelms @wbclark

Okay, I can reproduce this on latest nightly.

The change in Fixes #33863 - Allow registration through content proxy via port 443 · theforeman/puppet-foreman_proxy_content@76e2a68 · GitHub did set rhsm_port to 443 unconditionally, which is fine for RHSM, as the same commit also configures a reverse proxy on smartproxy:443/rhsm to map to katello:443/rhsm.

However, this breaks bootstrap as it expects (wrongfully, but it does) to be able to talk the the API on the same port as RHSM (which isn’t true anymore):

I’m glad I’m not going completely mental trying to figure out what’s going on. :slight_smile:

Whenever I change the port = 443 to port = 8443 in /etc/rhsm/rhsm.conf though, something in the bootstrap.py process switches it back to 443 (I’m guessing the installation of the SSL certificate from the smart proxy) and I still run into the 404 Error.

Right… Well, then I am afraid you just got promoted to be my guinea pig to test some auto-detection code in bootstrap.py :smiley:

I’ll try to cook up a patch later today and post here for you to test.

Okay, can you please try the version in detect the right api port, as it can differ from the rhsm port by evgeni · Pull Request #362 · Katello/katello-client-bootstrap · GitHub?

@evgeni I deployed the updated bootstrap.py to a test server which I then used to register against my Foreman 3.1.x Smart Proxy. I first tested with the “old” bootstrap.py script just to make sure the 404 Error is still present, which it was.

I then used the updated bootstrap.py script that I pulled down off GitHub and ran it with the same options as the previous failed attempt and it went fully through the registration process for the host, so your changes look good.

Thanks!

1 Like

Thanks, merged the PR and released a 1.7.8.

Packaging for nightly is at Release katello-client-bootstrap 1.7.8 by evgeni · Pull Request #7722 · theforeman/foreman-packaging · GitHub and once merged I’ll make sure to backport it to older, supported Katello releases.