RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1859532 - Proxy configuration in /etc/rhsm/rhsm.conf file is not considered by subscription-manager role,usage or addons module
Summary: Proxy configuration in /etc/rhsm/rhsm.conf file is not considered by subscrip...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: subscription-manager
Version: 8.3
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 8.0
Assignee: Jiri Hnidek
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks: 1634023
TreeView+ depends on / blocked
 
Reported: 2020-07-22 10:56 UTC by Shwetha Kallesh
Modified: 2020-11-04 01:40 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 01:39:41 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 2300 0 None closed 1859532: No traceback, when wrong proxy conf is used; ENT-2654 2021-02-05 13:48:57 UTC
Github candlepin subscription-manager pull 2302 0 None closed 1859532: Role --list handle wrong proxy conf (unregistered case) 2021-02-05 13:48:56 UTC
Red Hat Product Errata RHBA-2020:4460 0 None None None 2020-11-04 01:40:01 UTC

Description Shwetha Kallesh 2020-07-22 10:56:08 UTC
Description of problem:
Proxy configuration in /etc/rhsm/rhsm.conf file is not considered by subscription-manager role,usage or addons module 

Version-Release number of selected component (if applicable):
[root@kvm-07-guest02 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: Unknown
subscription management rules: Unknown
subscription-manager: 1.27.10-1.git.2.ffd7a7e.el8


How reproducible:


Steps to Reproduce:
[root@kvm-07-guest02 ~]# cat /etc/rhsm/rhsm.conf | grep proxy
# an http proxy server to use
proxy_hostname = autoservjv
# The scheme to use for the proxy when updating repo definitions, if needed
proxy_scheme = http
# port for http proxy server
proxy_port = 3129
# user name for authenticating to an http proxy, if needed
proxy_user =
# password for basic http proxy auth, if needed
proxy_password =
# host/domain suffix blacklist for proxy, if needed
no_proxy = 
[root@kvm-07-guest02 ~]# subscription-manager role --list
+-------------------------------------------+
               Available role
+-------------------------------------------+
 - Red Hat Enterprise Linux Workstation
 - Red Hat Enterprise Linux Server
 - Red Hat Enterprise Linux Compute Node
[root@kvm-07-guest02 ~]# subscription-manager usage --list
+-------------------------------------------+
               Available usage
+-------------------------------------------+
 - Development/Test
 - Production
 - Disaster Recovery
[root@kvm-07-guest02 ~]# subscription-manager addons --list
No valid values provided for "addons"


Actual results:
Values are listed 

Expected results:
Proxy connection failed, please check your settings.


Additional info:

Comment 1 Jiri Hnidek 2020-07-22 15:49:29 UTC
When you test this, then you have to consider that usage, role and addons commands uses cache: /var/lib/rhsm/cache/valid_fields.json

When you delete this file and then you set wrong values of proxy server into /etc/rhsm/rhsm.conf, then you get following result as for service-level command:

[root@localhost subscription-manager]# PYTHONPATH=./src:./syspurpose/src python -m subscription_manager.scripts.subscription_manager usage --list
Proxy error, unable to connect to proxy server.

I'm considering this as not a bug.

Comment 2 Shwetha Kallesh 2020-07-23 09:30:38 UTC
I actually see a traceback now with invalid proxy

[root@kvm-08-guest05 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription-manager: 1.27.10-1.git.2.ffd7a7e.el8


[root@kvm-08-guest05 ~]# ll /etc/rhsm/rhsm.conf 
-rw-r--r--. 1 root root 2994 Jul 23 04:59 /etc/rhsm/rhsm.conf
[root@kvm-08-guest05 ~]# 
[root@kvm-08-guest05 ~]# cat /etc/rhsm/rhsm.conf | grep proxy
# an http proxy server to use
proxy_hostname = sasadsa
# The scheme to use for the proxy when updating repo definitions, if needed
proxy_scheme = http
# port for http proxy server
proxy_port = 3129
# user name for authenticating to an http proxy, if needed
proxy_user =
# password for basic http proxy auth, if needed
proxy_password =
# host/domain suffix blacklist for proxy, if needed
no_proxy =

[root@kvm-08-guest05 ~]# cat /var/lib/rhsm/cache/valid_fields.json
cat: /var/lib/rhsm/cache/valid_fields.json: No such file or directory
[root@kvm-08-guest05 ~]# subscription-manager role --list
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 707, in _request
    conn.request(request_type, handler, body=body, headers=final_headers)
  File "/usr/lib64/python3.6/http/client.py", line 1254, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1300, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1249, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib64/python3.6/http/client.py", line 1036, in _send_output
    self.send(msg)
  File "/usr/lib64/python3.6/http/client.py", line 974, in send
    self.connect()
  File "/usr/lib64/python3.6/http/client.py", line 1414, in connect
    super().connect()
  File "/usr/lib64/python3.6/http/client.py", line 946, in connect
    (self.host,self.port), self.timeout, self.source_address)
  File "/usr/lib64/python3.6/socket.py", line 704, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/lib64/python3.6/socket.py", line 745, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.27.10', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 87, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 3246, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 546, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 899, in _do_command
    self.list()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 834, in list
    valid_fields = self._get_valid_fields()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 675, in _get_valid_fields
    valid_fields = get_syspurpose_valid_fields(uep=self.cp, identity=self.identity)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/syspurposelib.py", line 146, in get_syspurpose_valid_fields
    syspurpose_valid_fields = cache.read_data(uep, identity)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 899, in read_data
    current_data = self._sync_with_server(uep=uep, consumer_uuid=identity.uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 925, in _sync_with_server
    owner = cache.read_data(uep)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 899, in read_data
    current_data = self._sync_with_server(uep=uep, consumer_uuid=identity.uuid)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 969, in _sync_with_server
    return uep.getOwner(consumer_uuid)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1275, in getOwner
    return self.conn.request_get(method)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 883, in request_get
    return self._request("GET", method, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 909, in _request
    info=info, headers=headers, cert_key_pairs=cert_key_pairs)
  File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 735, in _request
    err))
rhsm.connection.ProxyException: Unable to connect to: sasadsa:3129 [Errno -2] Name or service not known

Comment 3 Shwetha Kallesh 2020-07-23 13:59:51 UTC
See also https://bugzilla.redhat.com/show_bug.cgi?id=1694811

Comment 6 Shwetha Kallesh 2020-07-29 08:56:35 UTC
Moving the bug to verified as I dont see any traceback with invalid proxy and also proper message is thrown

[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: Unknown
subscription management rules: Unknown
subscription-manager: 1.27.11-1.el8

[root@hpe-dl380pgen8-02-vm-2 ~]# cat /etc/rhsm/rhsm.conf | grep proxy
# an http proxy server to use
proxy_hostname = autoservjv
# The scheme to use for the proxy when updating repo definitions, if needed
proxy_scheme = http
# port for http proxy server
proxy_port = 3129
# user name for authenticating to an http proxy, if needed
proxy_user =
# password for basic http proxy auth, if needed
proxy_password =
# host/domain suffix blacklist for proxy, if needed
no_proxy = 

[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.

[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager role --list --username stage_auto_syspurpose001 --password redhat 
Organization: 12814047
Proxy connection failed, please check your settings.

[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager register --noproxy=*
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_auto_testuser
Password: 
The system has been registered with ID: 248c3228-ff5c-4a30-9d6f-c56fadfde6e1
The registered system name is: hpe-dl380pgen8-02-vm-2.hpe2.lab.eng.bos.redhat.com

[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager role --list
Proxy connection failed, please check your settings.

Comment 7 Shwetha Kallesh 2020-07-29 09:02:40 UTC
Adding verification steps for addons and usage module too

[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager usage --list --username stage_auto_syspurpose001 --password redhat
Organization: 12814047
Proxy connection failed, please check your settings.
[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager addons --list --username stage_auto_syspurpose001 --password redhat
Organization: 12814047
Proxy connection failed, please check your settings.

[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager register --noproxy=*
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_auto_syspurpose001
Password: 
CACHED_SYSPURPOSE: /var/lib/rhsm/cache/syspurpose.json
The system has been registered with ID: d810505c-bd37-4eef-99c6-e4a50e967386
The registered system name is: hpe-dl380pgen8-02-vm-2.hpe2.lab.eng.bos.redhat.com
[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager usage --list
Proxy connection failed, please check your settings.
[root@hpe-dl380pgen8-02-vm-2 ~]# subscription-manager addons --list
Proxy connection failed, please check your settings.

Comment 10 errata-xmlrpc 2020-11-04 01:39:41 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 (subscription-manager bug fix and enhancement update), 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-2020:4460


Note You need to log in before you can comment on or make changes to this bug.