Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Description of problem:
If user set a value for "http_proxy" and then unset it. Satellite will set the http_proxy to ''(empty string). This is causing all the outgoing http requests not using proxy including the outgoing traffic to Customer Portal. The katello "cdn_proxy" setting is ignored and Satellite will connect to the Customer Portal directly. Thus, manifest refresh fails.
In "/usr/share/foreman/lib/foreman/http_proxy.rb"
# Answers if this request should be proxied
def proxy_http_request?(current_proxy, request_host, schema)
!http_proxy.nil? && <========== This is using ".nil?" which will return false for empty string. Suggest to use ".blank?" which should fix the issue.
current_proxy.nil? &&
!request_host.nil? &&
http_request?(schema) &&
http_proxy_host?(request_host) &&
!local_request?(request_host)
end
Steps to Reproduce:
1. http_proxy setting is nil in the beginning.
echo "select id,name,value from settings where name = 'http_proxy'" | su postgres -c 'psql foreman'
id | name | value
-----+------------+-------
108 | http_proxy |
2. Go to the Setting page set the http_proxy to any url, such as http://proxy.example.com and save it.
echo "select id,name,value from settings where name = 'http_proxy'" | su postgres -c 'psql foreman'
id | name | value
-----+------------+------------------------------
108 | http_proxy | --- http://proxy.example.com+
| | ...
3. Still in the Setting page unset the http_proxy and save it.
echo "select name,value from settings where name = 'http_proxy'" | su postgres -c 'psql foreman'
name | value
------------+--------
http_proxy | --- ''
4. Block your Satellite to connect to the Customer portal directly.
5. Set the cdn_proxy in etc/foreman/plugins/katello.yaml
:cdn_proxy:
:host: http://proxy.example.com
:port: 3128
:user: hao
:password: mypassword
6. Restart Satellite.
7. Refresh Manifest and the Foreman task should fail with connection error.
8. Check the production.log, you should see something like.
[app] [I] Proxying request to subscription.rhsm.redhat.com via
Verified on Satellite 6.6 Snap 16 with an unset in http_proxy not able to see an error in production log. and fix look working as
irb(main):002:0> Setting[:http_proxy].presence
=> nil
Verified on Satellite 6.6 Snap 16 with an unset in http_proxy not able to see an error in production log. and fix look working as
irb(main):002:0> Setting[:http_proxy].presence
=> nil
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:3172
Description of problem: If user set a value for "http_proxy" and then unset it. Satellite will set the http_proxy to ''(empty string). This is causing all the outgoing http requests not using proxy including the outgoing traffic to Customer Portal. The katello "cdn_proxy" setting is ignored and Satellite will connect to the Customer Portal directly. Thus, manifest refresh fails. In "/usr/share/foreman/lib/foreman/http_proxy.rb" # Answers if this request should be proxied def proxy_http_request?(current_proxy, request_host, schema) !http_proxy.nil? && <========== This is using ".nil?" which will return false for empty string. Suggest to use ".blank?" which should fix the issue. current_proxy.nil? && !request_host.nil? && http_request?(schema) && http_proxy_host?(request_host) && !local_request?(request_host) end Steps to Reproduce: 1. http_proxy setting is nil in the beginning. echo "select id,name,value from settings where name = 'http_proxy'" | su postgres -c 'psql foreman' id | name | value -----+------------+------- 108 | http_proxy | 2. Go to the Setting page set the http_proxy to any url, such as http://proxy.example.com and save it. echo "select id,name,value from settings where name = 'http_proxy'" | su postgres -c 'psql foreman' id | name | value -----+------------+------------------------------ 108 | http_proxy | --- http://proxy.example.com+ | | ... 3. Still in the Setting page unset the http_proxy and save it. echo "select name,value from settings where name = 'http_proxy'" | su postgres -c 'psql foreman' name | value ------------+-------- http_proxy | --- '' 4. Block your Satellite to connect to the Customer portal directly. 5. Set the cdn_proxy in etc/foreman/plugins/katello.yaml :cdn_proxy: :host: http://proxy.example.com :port: 3128 :user: hao :password: mypassword 6. Restart Satellite. 7. Refresh Manifest and the Foreman task should fail with connection error. 8. Check the production.log, you should see something like. [app] [I] Proxying request to subscription.rhsm.redhat.com via