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 1710697 - Cannot refresh manifest via cdn_proxy after unset global http_proxy setting.
Summary: Cannot refresh manifest via cdn_proxy after unset global http_proxy setting.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Settings
Version: 6.4.2
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: 6.6.0
Assignee: Ondřej Ezr
QA Contact: Omkar Khatavkar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-16 06:14 UTC by Hao Chang Yu
Modified: 2019-10-22 19:48 UTC (History)
7 users (show)

Fixed In Version: foreman-1.22.0.12-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-10-22 19:48:44 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 26828 0 Normal Closed Cannot unset global http_proxy setting. 2020-12-15 13:04:01 UTC

Description Hao Chang Yu 2019-05-16 06:14:07 UTC
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

Comment 6 Marek Hulan 2019-05-20 06:42:49 UTC
Created redmine issue https://projects.theforeman.org/issues/26828 from this bug

Comment 7 Bryan Kearney 2019-07-14 16:03:00 UTC
Upstream bug assigned to oezr

Comment 8 Bryan Kearney 2019-07-14 16:03:02 UTC
Upstream bug assigned to oezr

Comment 9 Bryan Kearney 2019-07-15 14:02:55 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/26828 has been resolved.

Comment 12 Omkar Khatavkar 2019-08-19 08:19:15 UTC
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

Comment 13 Omkar Khatavkar 2019-08-19 08:19:28 UTC
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

Comment 17 Bryan Kearney 2019-10-22 19:48:44 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:3172


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