Bug 1569188 - a DEBUG logging statement surfaces to stderr when trying to rct cat-cert a protected file as a non-root-user
Summary: a DEBUG logging statement surfaces to stderr when trying to rct cat-cert a pr...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.6
Hardware: Unspecified
OS: Unspecified
high
low
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-18 18:28 UTC by John Sefler
Modified: 2021-02-22 21:49 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1562412
Environment:
Last Closed: 2021-02-15 07:38:32 UTC
Target Upstream Version:


Attachments (Terms of Use)

Comment 2 John Sefler 2018-04-18 18:46:16 UTC
This bug has also surfaced on subscription-manager: 1.21.2-3.git.33.c63a48b.el7


[root@jsefler-rhel7 ~]# whoami
root
[root@jsefler-rhel7 ~]# userdel -rf non-root-user
[root@jsefler-rhel7 ~]# useradd non-root-user
[root@jsefler-rhel7 ~]# subscription-manager register 
Registering to: jsefler-candlepin.usersys.redhat.com:8443/candlepin
Username: testuser1
Password: 
Organization: admin
The system has been registered with ID: d8cadb0f-c519-4b15-9225-abe1f89a6125
The registered system name is: jsefler-rhel7.usersys.redhat.com
[root@jsefler-rhel7 ~]# 
[root@jsefler-rhel7 ~]# su non-root-user --command 'rct cat-cert /etc/pki/consumer/cert.pem'
2018-04-18 14:37:39,959 [DEBUG] rct:18072:MainThread @https.py:56 - Using standard libs to provide httplib and ssl
Unable to read certificate file '/etc/pki/consumer/cert.pem': Error loading certificate: [Errno 13] Permission denied: '/etc/pki/consumer/cert.pem'
[root@jsefler-rhel7 ~]# echo $?
0
[root@jsefler-rhel7 ~]# su non-root-user --command 'rct cat-cert /etc/pki/consumer/cert.pem' 1>/tmp/stdout 2>/tmp/stderr
[root@jsefler-rhel7 ~]# 
[root@jsefler-rhel7 ~]# cat /tmp/stderr 
2018-04-18 14:40:35,981 [DEBUG] rct:18168:MainThread @https.py:56 - Using standard libs to provide httplib and ssl
[root@jsefler-rhel7 ~]# 
[root@jsefler-rhel7 ~]# tail -1 /var/log/rhsm/rhsm.log
2018-04-18 14:36:11,563 [DEBUG] rct:18056:MainThread @https.py:56 - Using standard libs to provide httplib and ssl


Notice that the DEBUG statement that goes to /var/log/rhsm/rhsm.log is also going to stderr.  Did not expect this.


I suspect this is an unintentional consequence of subscription-manager commit 630e1a2eb06e6bfacac669ce11f38e228c907ea9 1507030: RestlibExceptions should show they originate server-side

Comment 3 John Sefler 2018-04-18 18:52:35 UTC
Note: It happens even when accessing a world readable file (e.g. /etc/pki/product-default/69.pem)

[root@jsefler-rhel7 ~]# ls -l /etc/pki/product-default/69.pem 
-rw-r--r--. 1 root root 2159 Jun 28  2017 /etc/pki/product-default/69.pem
[root@jsefler-rhel7 ~]# 
[root@jsefler-rhel7 ~]# su non-root-user --command 'rct cat-cert /etc/pki/product-default/69.pem' 1>/dev/null
2018-04-18 14:51:17,635 [DEBUG] rct:19868:MainThread @https.py:56 - Using standard libs to provide httplib and ssl
[root@jsefler-rhel7 ~]#

Comment 6 RHEL Program Management 2021-02-15 07:38:32 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.

Comment 7 John Sefler 2021-02-22 21:49:04 UTC
Update: The unexpected logging to stderr is now justified by the work done on bug 1782910 as introduced in subscription-manager-1.27.1-1

[root@kvm-06-guest39 ~]# rpm -q subscription-manager --changelog | grep 1782910
- 1782910: Log errors in logging set up after set up completes; ENT-1890

[root@kvm-06-guest39 ~]# su non-root-user --command 'rct cat-cert /etc/pki/product-default/69.pem'
2021-02-22 16:46:59,079 [ERROR] rct:42957:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
2021-02-22 16:46:59,093 [DEBUG] rct:42957:MainThread @https.py:56 - Using standard libs to provide httplib and ssl
The specified certificate file does not exist.
[root@kvm-06-guest39 ~]# 


[root@kvm-06-guest39 ~]# su non-root-user --command 'rct cat-cert /etc/pki/consumer/cert.pem'
2021-02-22 16:47:58,904 [ERROR] rct:42985:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
2021-02-22 16:47:58,918 [DEBUG] rct:42985:MainThread @https.py:56 - Using standard libs to provide httplib and ssl
Unable to read certificate file '/etc/pki/consumer/cert.pem': Error loading certificate: [Errno 13] Permission denied: '/etc/pki/consumer/cert.pem'
[root@kvm-06-guest39 ~]#


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