Bug #26828
closedCannot unset global http_proxy setting.
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"
- 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
Updated by Ondřej Ezr over 5 years ago
- Related to Bug #27293: Empty string setting value should be consistent added
Updated by The Foreman Bot over 5 years ago
- Status changed from New to Ready For Testing
- Assignee set to Ondřej Ezr
- Pull request https://github.com/theforeman/foreman/pull/6900 added
Updated by Marek Hulán over 5 years ago
- Subject changed from Cannot unset global http_proxy setting. to Cannot unset global http_proxy setting.
- Fixed in Releases 1.23.0 added
Updated by Ondřej Ezr over 5 years ago
- Status changed from Ready For Testing to Closed
Applied in changeset 8aeb29b2a2a4ad3bd9787bd8124a47bb46e9aa02.