Project

General

Profile

Bug #26828

Cannot unset global http_proxy setting.

Added by Marek Hulán 5 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Settings
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1710697

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"

  1. 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


Related issues

Related to Foreman - Bug #27293: Empty string setting value should be consistentRejected

Associated revisions

Revision 8aeb29b2 (diff)
Added by Ondřej Ezr 3 months ago

Fixes #26828 - expect http_proxy to be empty string (#6900)

History

#1 Updated by Ondřej Ezr 3 months ago

  • Related to Bug #27293: Empty string setting value should be consistent added

#2 Updated by The Foreman Bot 3 months ago

  • Assignee set to Ondřej Ezr
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6900 added

#3 Updated by Marek Hulán 3 months ago

  • Subject changed from Cannot unset global http_proxy setting. to Cannot unset global http_proxy setting.
  • Fixed in Releases 1.23.0 added

#4 Updated by Ondřej Ezr 3 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF