Bug 1601762 - accessing subscription.rhn.redhat.com unexpectedly
Summary: accessing subscription.rhn.redhat.com unexpectedly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Subscription Management
Version: 6.3.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: 6.5.0
Assignee: Michael Johnson
QA Contact: jcallaha
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-17 08:04 UTC by Masatake YAMATO
Modified: 2019-11-05 22:30 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:37:37 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 24675 Normal Closed accessing subscription.rhn.redhat.com unexpectedly 2020-01-24 03:24:14 UTC
Github Katello katello pull 7645 None closed Fixes #24675 - Update host name for Manifest refresh 2020-01-24 03:24:14 UTC
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:37:44 UTC

Description Masatake YAMATO 2018-07-17 08:04:53 UTC
Description of problem:

katello accesses subscription.rhn.redhat.com when refreshing manifest.
The host name is not listed in https://access.redhat.com/documentation/en-us/red_hat_satellite/6.3/html/installation_guide/installing_satellite_server#configuring_satellite_http_proxy.

As the result refreshing manifest fails always if an intermediate web proxy server allows only the sites listed in the document.


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

tfm-rubygem-katello-3.4.5.64-1.el7sat.noarch

How reproducible:


Steps to Reproduce:
1. Setup a web proxy server allows only sites listed in the document,
2. Setup a satellite server that uses the web proxy,
3. Upload a manifest, and
4. Refresh the manifet with hammer like "hammer subscription refresh-manifest".

Actual results:

[root@foo setup]# hammer subscription refresh-manifest
[..........................................................] [100%]
Error: 403 "Forbidden"
[root@f00 setup]# echo $?
70

Expected results:
[root@foo setup]# hammer subscription refresh-manifest
[..........................................................] [100%]
[root@foo setup]# echo $?
0

Additional info:

In /theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/glue/provider.rb of tfm-rubygem-katello-3.4.5.64-1.el7sat.noarch,
"subscription.rhn.redhat.com" is hardcoded.

I guess it should be: 
[root@foo setup]# diff -ruN /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/glue/provider.rb /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/glue/provider.rb.new 
--- /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/glue/provider.rb	2018-07-13 16:42:12.732384769 +0900
+++ /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64/app/models/katello/glue/provider.rb.new	2018-07-17 16:59:13.052732482 +0900
@@ -60,7 +60,7 @@
         end
 
         # Default to Red Hat
-        url = upstream['apiUrl'] || 'https://subscription.rhn.redhat.com/subscription/consumers/'
+        url = upstream['apiUrl'] || 'https://subscription.rhsm.redhat.com/subscription/consumers/'
 	Rails.logger.warn "XXX: #{url}"
 
         # TODO: wait until ca_path is supported
@@ -84,7 +84,7 @@
         end
 
         # Default to Red Hat
-        url = upstream['apiUrl'] || 'https://subscription.rhn.redhat.com/subscription/consumers/'
+        url = upstream['apiUrl'] || 'https://subscription.rhsm.redhat.com/subscription/consumers/'
 
         # TODO: wait until ca_path is supported
         #       https://github.com/L2G/rest-client-fork/pull/8


 
This one is applicable to https://github.com/Katello/katello/blob/master/app/models/katello/glue/provider.rb .

Comment 1 Craig Donnelly 2018-07-23 18:59:03 UTC
The docs here are correct on the addresses.

The code pointed out indeed is pointing at the older address for subscription data and should be updated to point at subscription.rhsm.redhat.com.

(Based on the patch in comment #0.)

Thanks.

Comment 4 Jonathon Turel 2018-08-15 19:12:48 UTC
Changing the URL in Katello is not the ultimate fix. As the code shows, we only fall back to the hard-coded value when we don't get one from the manifest (upstream['apiUrl']).

If the user has an older manifest - not downloaded from the Portal in the last few weeks (this was a recent change) - they will get the old URL (subscription.rhn.redhat.com) within the manifest.

Downloading a new manifest today will ensure the user gets the new url (subscription.rhsm.redhat.com) and they'll be in agreement with the documentation. That said - katello still needs to be fixed.

Comment 5 Michael Johnson 2018-08-21 17:15:28 UTC
Created redmine issue https://projects.theforeman.org/issues/24675 from this bug

Comment 6 pm-sat@redhat.com 2018-08-27 22:11:47 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/24675 has been resolved.

Comment 8 jcallaha 2019-02-14 20:30:45 UTC
Verified in Satellite 6.5.0 Snap 15.

Followed the steps outlined in the description.

Uploaded a manifest from 2017 and the refresh completed without any issues.

-bash-4.2# hammer -v subscription refresh-manifest --organization-id 1
[.............................................................] [100%]
-bash-4.2# 

Additionally, I had no issues enabling and syncing repositories from the cdn.

Comment 11 errata-xmlrpc 2019-05-14 12:37:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222


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