Project

General

Profile

Actions

Bug #26828

closed

Cannot unset global http_proxy setting.

Added by Marek Hulán almost 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Settings
Target version:
-
Difficulty:
Triaged:
No
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 1 (0 open1 closed)

Related to Foreman - Bug #27293: Empty string setting value should be consistentRejectedOndřej EzrActions
Actions #1

Updated by Ondřej Ezr over 4 years ago

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

Updated by The Foreman Bot over 4 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
Actions #3

Updated by Marek Hulán over 4 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
Actions #4

Updated by Ondřej Ezr over 4 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF