Bug 1585069

Summary: Exclude Satellite fqdn and localhost from possible proxying when user set foreman http proxy
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: InfrastructureAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.1CC: ehelms, jsherril, mhulan, mmccune, pcreech, sgraessl
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-1.15.6.48-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1585076 1596359 (view as bug list) Environment:
Last Closed: 2018-08-22 20:07:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Pramuk 2018-06-01 09:10:36 UTC
Description of problem:
There is new RFE which implemented general http proxy for foreman(+katello)
BZ 1333595

If you set the setting to valid http proxy then suddenly all katello pages (and even org edit) throws "403 Forbidden" at you !!! This ultimate breakage is caused by the fact that every request is now proxied, even between internal components and even requests to localhost !!!

Some requests cannot and must not be proxied, for example all katello pages requests candlepin (8443/tcp) going via proxy all is denied.

Unless you specify Satellite FQDN in "HTTP(S) proxy except hosts" which is really really tricky and wouldn't be obvoius to many CUs.

So please exclude Satellite fqdn and localhost by default from being proxied.
Either by listing them by default in "HTTP(S) proxy except hosts" or (for localhost most applicable) exluding them right away in http proxy code.

Version-Release number of selected component (if applicable):
@satellite-6.3.1-3.el7sat.noarch (6.3.2 Snap1)
foreman-1.15.6.43-1.el7sat.noarch

How reproducible:
deterministic

Steps to Reproduce:
1. Set HTTP(S) proxy (having exlude list empty = which is default)
2. Navigate to any Katello page

"403 Forbidden" keeps smiling at ya

Actual results:
really really tricky and not obvious to many CUs.
setting http proxy breaks product

Expected results:
setting http proxy doesn't break anything

Comment 2 Marek Hulan 2018-06-01 09:23:51 UTC
Sebastian, could you please take a look? I think both Satellite FQDN and localhost are good default options for ignore hosts.

Comment 3 Marek Hulan 2018-06-01 09:28:23 UTC
After another discussion with Lukas, it seems we should always ignore localhost, that could cause more problems.

Comment 4 Justin Sherrill 2018-06-01 14:44:31 UTC
Should we add capsule FQDN's by default too?  I think in 99% of cases the users would want that.

Comment 5 Marek Hulan 2018-06-04 08:31:53 UTC
All capsules that are registered?

Comment 6 Sebastian Gräßl 2018-06-05 06:30:12 UTC
It would make sense to ignore Capsules by default, but this would be better as a Boolean setting, and not the current setting to list hosts to exempt from proxying as we would need to maintain the list and keep on par with capsule FQDNS.

We should maybe also consider a Boolean for disabling proxying requests to localhost or the Satellite FQDN, instead of using the except-list.

Comment 7 Lukas Pramuk 2018-06-05 11:22:58 UTC
Ok, all makes sense except boolean for proxying localhost.
There is no sense of proxying localhost since it is resolved on proxy. 

Example you define local docker http://localhost:2375 but it would be resolved on proxy, seeking for docker port on proxy instead of satellite.

I'm for avoiding proxying localhost always, no bools.

Comment 8 Marek Hulan 2018-06-07 06:48:07 UTC
Created redmine issue http://projects.theforeman.org/issues/23843 from this bug

Comment 10 Satellite Program 2018-06-11 10:23:31 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/23843 has been resolved.

Comment 11 Mike McCune 2018-06-27 17:15:19 UTC
TESTING NOTE:

Customers may need to include capsule hosts in the list of excludes if issues arise.

Comment 13 Lukas Pramuk 2018-08-06 14:40:48 UTC
VERIFIED.

@satellite-6.3.3-1.el7sat.noarch (6.3.3 Snap1)
foreman-1.15.6.48-1.el7sat.noarch

by two following manual reproducers:

A) 
1. Set "HTTP(S) proxy except hosts" to list of all capsules (usually [SATFQDN])

2. Set "HTTP(S) proxy" (http://proxy.example.com:3128)

3. Navigate to any Katello page

>>> success, Katello page is rendered correctly, when except hosts settings contains list of all capsules

B)
1. Set "HTTP(S) proxy" to nonsense (http://nononoproxy.example.com:3128)

2. Create a docker compute resource http://localhost:2375

>>> success, traffic to localhost is no more proxied

Comment 15 errata-xmlrpc 2018-08-22 20:07:12 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/RHBA-2018:2550