This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2275964 - The content source of a host is always set to nil or blank when CNAME of the satellite is used for registration purposes
Summary: The content source of a host is always set to nil or blank when CNAME of the ...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts - Content
Version: 6.14.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-04-18 18:26 UTC by Sayan Das
Modified: 2024-06-06 17:28 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-06 17:28:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   SAT-24668 0 None Migrated None 2024-06-06 17:28:48 UTC

Description Sayan Das 2024-04-18 18:26:38 UTC
Description of problem:

Instead of the OS FQDN, If a CNAME is being used to setup the satellite, then after registering a host with the same satellite, The content source information of the host  would always be nil or empty 

This happens due to the way installer is used i.e. the Primary Smart Proxy is still using OS FQDN instead of CNAME

Version-Release number of selected component (if applicable):

Satellite 6.14.3

How reproducible:

Always if the satellite is installed in the same way as the end-user

And It is a regression from Sat 6.11


Steps to Reproduce and Observations:

1. Configure the /etc/hosts of satellite in this way i.e. 

# cat /etc/hosts | grep satellite
<IP of satellite>     vm205-101.uatlab.lab.example.com	satellite.uatlab.lab.example.com

where OS\Network FQDN is vm205-101.uatlab.lab.example.com
CNAME is satellite.uatlab.lab.example.com

2. Install the satellite using the following installer command:

# satellite-installer --scenario=satellite \
--foreman-initial-organization RedHat --foreman-initial-location GSS \
--foreman-initial-admin-username admin --foreman-initial-admin-password RedHat1! \
--certs-cname=satellite.uatlab.lab.example.com \
--foreman-servername=satellite.uatlab.lab.example.com \
--foreman-foreman-url=https://satellite.uatlab.lab.example.com \
--foreman-unattended-url=https://satellite.uatlab.lab.example.com \
--foreman-proxy-foreman-base-url=https://satellite.uatlab.lab.example.com \
--foreman-proxy-template-url=http://satellite.uatlab.lab.example.com:8000 --foreman-plugin-tasks-automatic-cleanup=true \
--enable-foreman-plugin-puppet --enable-foreman-cli-puppet --foreman-proxy-puppet=true --foreman-proxy-puppetca=true \
--enable-puppet --puppet-server=true \
--puppet-server-foreman-url=https://satellite.uatlab.lab.example.com \
--puppet-server-foreman-ssl-ca /etc/pki/katello/puppet/puppet_client_ca.crt \
--puppet-server-foreman-ssl-cert /etc/pki/katello/puppet/puppet_client.crt \
--puppet-server-foreman-ssl-key /etc/pki/katello/puppet/puppet_client.key \
--puppet-server-certname=satellite.uatlab.lab.example.com \
--foreman-proxy-puppet-ssl-cert=/etc/puppetlabs/puppet/ssl/certs/satellite.uatlab.lab.example.com.pem \
--foreman-proxy-puppet-ssl-key=/etc/puppetlabs/puppet/ssl/private_keys/satellite.uatlab.lab.example.com.pem \
--foreman-proxy-puppet-url=https://satellite.uatlab.lab.example.com:8140 \
--enable-foreman-plugin-remote-execution --enable-foreman-proxy-plugin-remote-execution-script \
--foreman-proxy-tftp=true --foreman-proxy-dhcp=false --foreman-proxy-dns=false --tuning=development


3. Check in /var/www/html/pub/katello-rhsm-consumer and the script is generated with CNAME 

# cat /var/www/html/pub/katello-rhsm-consumer  | grep ^KATELLO_SERVER
KATELLO_SERVER=satellite.uatlab.lab.example.com
KATELLO_SERVER_CA_CERT=katello-server-ca.pem


4. Check "hammer capsule info --id 1" and the internal smart-proxy is created using OS FQDN 

# hammer capsule list --fields Name,Url
---------------------------------|----------------------------------------------
NAME                             | URL                                          
---------------------------------|----------------------------------------------
vm205-101.uatlab.lab.example.com | https://vm205-101.uatlab.lab.example.com:9090
---------------------------------|----------------------------------------------


3. Create an activation key in Satellite for registration purposes. 

4. Take a RHEL 8 client host [ dhcp130-238.gsslab.lab.example.com ] and register it with satellite manually i.e. using katello-ca-consumer and sub-man register process. 

# cat /etc/hosts | grep satellite
<IP of satellite>     vm205-101.uatlab.lab.example.com	satellite.uatlab.lab.example.com

# yum localinstall http://satellite.uatlab.lab.example.com/pub/katello-ca-consumer-latest.noarch.rpm

# subscription-manager register --org="RedHat" --activationkey="new"


5. Come back to satellite and check hammer host info for the content source information:

# hammer host info --name dhcp130-238.gsslab.lab.example.com --fields "Content Information"

Content Information:      
    Content view environments: 
     1) Content view:          
            Id:        1
            Name:      Default Organization View
            Composite: no
        Lifecycle environment: 
            Id:   1
            Name: Library
    Content Source:            
        Id:   
        Name:
..
..

As we can see, Content Source is null 

6. Now, Even if we manually assign a content source with the host, Just Re-register the host simply by re-running the sub-man command with --force and the behavior remains same i.e. the COntent Source becomes Nil\null

7. Now, update the name and URL of the internal smart-proxy i.e. 

hammer capsule update --id 1 --name satellite.uatlab.lab.example.com --url https://satellite.uatlab.lab.example.com:9090

8. Just simply re-register the host and the Content Source information now would be populated correctly.

Content Information:      
    Content view environments: 
     1) Content view:          
            Id:        1
            Name:      Default Organization View
            Composite: no
        Lifecycle environment: 
            Id:   1
            Name: Library
    Content Source:            
        Id:   1
        Name: satellite.uatlab.lab.example.com



So, Something about the SmartProxy of Satellite using vm205-101.uatlab.lab.example.com instead of  satellite.uatlab.lab.example.com is the issue here. Perhaps, Satellite is unable to detect or use the SmartProxy as a valid content source when the name and URL is vm205-101.uatlab.lab.example.com. 



Expected results:


It should behave the same way as it did in Satellite 6.11 i.e. identify the Content SOurce based on Registered Through capsule and then set it as content source without any hiccups but it should not be null. 


Additional info:

Check the support case description for the end-user related testing as that contains some more information and a bit different outputs e.g. The internal capsule has a name set to CNAME but URL set to https://FQDN:9090 etc.

Comment 1 Sayan Das 2024-04-18 18:32:28 UTC
CC'ing, 
Peter ( the end-user )
Gourav ( the case owner )
Jeremy ( Developer and possibly someone who can give more clarification )


For me, I never kept the name different than URl in my internal smart-proxy , and that could be due to the installer option i used. Perhaps Peter had used one or two more extra options than myself. And hence the difference. 

but for peter, The internal smart-proxy has name set to CNAME and URL is using OS FQDN of the satellite. 

When he changes the URL and uses the CNAME there as well, That does the trick for him [ as well as my own testing ]. 


Now the question is, How valid this entire scenario is ?

And is it the right way to integrate CNAME in satellite and use it? If not and if someone wants to use the CNAME for every possible action without changing the OS hostname\FQDN, what is the right approach here ?


-- Sayan

Comment 4 Peter Vreman 2024-04-19 09:32:17 UTC
There is no CNAME needed to reproduce, it 

On the client use the IP address in /etc/rhsm/rhsm.conf

[Server]
hostname = <ip-address-of-sat6>


I enabeled debug logging, but now see that it even a Warning (which is pretty hidden between the many red-herring warnigns about 'Scoped search' and other view related warnings)

~~~
2024-04-19T09:23:08 [W|app|9fd73270] Host clientA.example.com registered through unknown proxy 10.x.x.x
~~~

On the client this is not visible that the Satellite is having an issue with the used proxy/Capsule:

~~~
$ sudo /usr/sbin/subscription-manager register --org=Hilti --activationkey=$(sudo facter foreman_activationkey) --force
Unregistering from: 10.x.x.x:443/rhsm
The system with UUID bdeb2bbc-577c-434e-8d8e-4d72a4aa254e has been unregistered
All local data removed
The system has been registered with ID: 35b19a18-4040-4f03-b10c-1e9b18cfc3b4
The registered system name is: clientA
~~~

I expect here that the rhsm call is then failing the registration when the proxy is unknown. Then at least the error is known to the user that the rhsm.conf is using an invalid value.
And if it is allowed to have on a proxy differnt addresses then the proxy can have next to its primary name also other allowed aliases/CNAME/ipaddreses in a list so that the Satellite can map it to a valid content_source

Comment 5 Sayan Das 2024-04-19 09:40:03 UTC
Then codewise, it's happening correctly i.e. https://github.com/Katello/katello/blob/master/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb#L273-L277 is where We identify the parent host\source using HTTP_X_FORWARDED_HOST header or Setting[:foreman_url] in the absence of HTTP_X_FORWARDED_HOST header. 

    def get_parent_host(headers)
      hostnames = headers["HTTP_X_FORWARDED_HOST"]
      host = hostnames.split(/[,,:]/)[0].strip if hostnames
      host || URI.parse(Setting[:foreman_url]).host
    end


Then get_parent_host is later used in https://github.com/Katello/katello/blob/master/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb#L475-L493 for setting registered_through capsule and then the content source. 

So when the smart-proxy URL does not matches the get_parent_host output, The waring is logged and content_source is set as null 

https://github.com/Katello/katello/blob/master/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb#L491

      Rails.logger.warn "Host %s registered through unknown proxy %s" % [host.name, content_source_hostname] if content_source_id.nil?
      host.content_facet.update_attribute(:content_source_id, content_source_id)


foreman=# \d+ katello_content_facets
                                                                       Table "public.katello_content_facets"
                Column                |          Type          | Collation | Nullable |                      Default                       | Storage  | Stats target | Description 
--------------------------------------+------------------------+-----------+----------+----------------------------------------------------+----------+--------------+-------------
 id                                   | integer                |           | not null | nextval('katello_content_facets_id_seq'::regclass) | plain    |              | 
 host_id                              | integer                |           | not null |                                                    | plain    |              | 
 uuid                                 | character varying(255) |           |          |                                                    | extended |              | 
 kickstart_repository_id              | integer                |           |          |                                                    | plain    |              | 
 content_source_id                    | integer                |           |          |                                                    | plain    |              | 

---

From what I see content_source_id is nullable and hence a null value gets updated `host.content_facet.update_attribute` happens. 

If the request is to ensure that does not happen and logs a proper error during the same, Then +1 from my end about it as well.

Comment 7 Eric Helms 2024-06-06 17:28:50 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


Note You need to log in before you can comment on or make changes to this bug.