Bug 1670033

Summary: redhat-support-tool env var http_proxy does not work with user and password
Product: Red Hat Enterprise Linux 7 Reporter: Miroslav Hradílek <mhradile>
Component: redhat-support-toolAssignee: A.P. Rajshekhar <randalap>
Status: CLOSED ERRATA QA Contact: Miroslav Hradílek <mhradile>
Severity: high Docs Contact:
Priority: high    
Version: 7.6CC: cww, dwysocha, randalap
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1685296 (view as bug list) Environment:
Last Closed: 2019-08-06 13:11:47 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:
Bug Depends On:    
Bug Blocks: 1648022, 1685296    
Attachments:
Description Flags
redhat-support-trool.log none

Description Miroslav Hradílek 2019-01-28 13:14:29 UTC
Created attachment 1524203 [details]
redhat-support-trool.log

Description of problem:
When http proxy protected by user and password is defined in config redhat-support-tool can use it. When the same is done using variable http_proxy on environment it does not seem to work.

Version-Release number of selected component (if applicable):
redhat-support-tool-0.9.10-1.el7.noarch

How reproducible:
100%

Steps to Reproduce:
SETUP
=====
# yum install redhat-support-tool httpd httpd-tools curl
. . .
# rpm -q redhat-support-tool httpd httpd-tools curl
redhat-support-tool-0.9.10-1.el7.noarch
httpd-2.4.6-88.el7.x86_64
httpd-tools-2.4.6-88.el7.x86_64
curl-7.29.0-51.el7.x86_64
# rm -f ~/.redhat-support-tool/logs/* # Remove old log files

# cat > .redhat-support-tool/redhat-support-tool.conf
[RHHelp]
url = https://api.access.qa.redhat.com
password = *******
user = qa
proxy_url = http://localhost:8080
proxy_user = rstuser
proxy_password = AAAABRIWAQUcBhE=
no_verify_ssl = True

# cat > /etc/httpd/conf.d/rsttest-forward-proxy.conf
Listen 8080

<VirtualHost *:8080>
  ProxyRequests On
  ProxyVia On

  <Proxy *>
      Order deny,allow
      Allow from all
      AuthType Basic
      AuthName 'Password Required'
      AuthUserFile /etc/httpd/rsttest-password.file
      Require valid-user
  </Proxy>
</VirtualHost>

# htpasswd -b -c /etc/httpd/rsttest-password.file rstuser rstpassword
Adding password for user rstuser
# setsebool httpd_can_network_connect on
# systemctl start httpd
# curl --proxy rstuser:rstpassword@localhost:8080 --insecure https://access.qa.redhat.com/ >/dev/null # Verify proxy works
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 98046    0 98046    0     0  62261      0 --:--:--  0:00:01 --:--:-- 62290

CONFIGURED PROXY
================
# redhat-support-tool listproducts
Warning: no_ssl_verify is enabled in the Red Hat Support Tool configuration, this may allow other servers to intercept communications with Red Hat.  If you have a transparent SSL proxy server, you can trust it's Certificate Authority using: 'config ssl_ca <filepath>'
.NET Core
Ansible Tower by Red Hat
. . .
Subscription Asset Manager

PROXY ON ENVIRONMENT
====================
# rm -f ~/.redhat-support-tool/logs/* # Remove old log files
# http_proxy=http://rstuser:rstpassword@localhost:8080 redhat-support-tool listproducts
Info : Using proxy_url as defined in http_proxy environment variable: http://rstuser:rstpassword@localhost:8080
Warning: no_ssl_verify is enabled in the Red Hat Support Tool configuration, this may allow other servers to intercept communications with Red Hat.  If you have a transparent SSL proxy server, you can trust it's Certificate Authority using: 'config ssl_ca <filepath>'
Problem connecting to the support services API.  Is the service accessible from this host?
# tail -n 20 .redhat-support-tool/logs/red_hat_support_tool.log 
2019-01-28 12:39:31,912 - redhat-support-tool.rhhelp - Level 31 - Loading plugin listentitlements
2019-01-28 12:39:31,913 - redhat-support-tool.rhhelp - Level 31 - Loading plugin modifycase
2019-01-28 12:39:32,339 - redhat_support_tool.helpers.common - WARNING - Problem connecting to the support services API.  Is the service accessible from this host?
2019-01-28 12:39:32,339 - redhat_support_tool.helpers.launchhelper - ERROR - Strata API connection failure, [Errno -2] Name or service not known
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/launchhelper.py", line 106, in run
    return cls.non_interactive_action()
  File "/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_products.py", line 67, in non_interactive_action
    ary = get_products()
  File "/usr/lib/python2.7/site-packages/redhat_support_tool/helpers/common.py", line 125, in get_products
    productsAry = api.products.list()
  File "/usr/lib/python2.7/site-packages/redhat_support_lib/infrastructure/brokers.py", line 1398, in list
    doc, headers = self._getProxy().get(url)
  File "/usr/lib/python2.7/site-packages/redhat_support_lib/infrastructure/proxy.py", line 44, in get
    return self.request(method='GET', url=url, headers=headers)
  File "/usr/lib/python2.7/site-packages/redhat_support_lib/infrastructure/proxy.py", line 120, in request
    conn=self.getConnectionsPool().getConnection())
  File "/usr/lib/python2.7/site-packages/redhat_support_lib/infrastructure/proxy.py", line 140, in __doRequest
    raise ConnectionError, str(e)
ConnectionError: Strata API connection failure, [Errno -2] Name or service not known

Expected results:
Work just like if its configured using config.

Additional info:
Log is attached. Is https_proxy (in addition to http_proxy) variable supposed to be used by RST? Seems to ignore that variable.

Comment 9 errata-xmlrpc 2019-08-06 13:11:47 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-2019:2267