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 695675 - certificate is not generated after changing the SELinux context of directory
Summary: certificate is not generated after changing the SELinux context of directory
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: certmonger
Version: 6.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Nalin Dahyabhai
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks: 695718
TreeView+ depends on / blocked
 
Reported: 2011-04-12 11:50 UTC by Kaleem
Modified: 2011-05-19 13:07 UTC (History)
4 users (show)

Fixed In Version: certmonger-0.41-1.el6
Doc Type: Bug Fix
Doc Text:
Previously, the getcert tool terminated unexpectedly with a segmentation fault if the user issued the getcert start-tracking command with changed values of the parameters Extended Key Usage, DNS, Email and Principal name. The command caused a buffer overflow in the getcert tool because the internal buffer in the getcert command was too small to hold four new values. This update enlarges the internal buffer of the command and the bug no longer occurs.
Clone Of:
: 695718 (view as bug list)
Environment:
Last Closed: 2011-05-19 13:07:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:0570 0 normal SHIPPED_LIVE certmonger bug fix and enhancement update 2011-05-19 09:37:40 UTC

Description Kaleem 2011-04-12 11:50:44 UTC
Description of problem:
certificate is not generated after changing the SELinux context of directory.

Version-Release number of selected component (if applicable):
certmonger-0.40-1.el6.x86_64

How reproducible:
Create a temporary NSS database directory and try to generate a certificate without changing its SELinux Security Policy Context.

Steps to Reproduce:
(1)Install Certmonger

(2)Start certmonger service

(3)creating a temp directory
[root@mars ~]# mkdir /tmp/temp2

(4)issue a certificate request
[root@mars ~]# getcert request -d /tmp/temp2 -n test1 -c SelfSign
New signing request "20110406104323" added.
[root@mars ~]# getcert list
Number of certificates and requests being tracked: 1.
Request ID '20110406104323':
    status: NEED_KEY_PAIR
    stuck: no
    key pair storage: type=NSSDB,location='/tmp/temp2',nickname=test1
    certificate: type=NSSDB,location='/tmp/temp2',nickname=test1
    CA: SelfSign
    issuer:
    subject:
    expires: unknown
    track: yes
    auto-renew: yes

  Here status is 'NEED_KEY_PAIR'

(5)changing the SElinux Security context of temp directory created in step 1
[root@mars ~]# chcon -t cert_t /tmp/temp2

(6)submitting the request again

[root@mars ~]# getcert resubmit -d /tmp/temp2/ -n test1 -c SelfSign
Resubmitting "20110406104323" to "SelfSign".
[root@mars ~]# getcert list
Number of certificates and requests being tracked: 1.
Request ID '20110406104323':
    status: NEED_CSR
    stuck: no
    key pair storage: type=NSSDB,location='/tmp/temp2',nickname=test1
    certificate: type=NSSDB,location='/tmp/temp2',nickname=test1
    CA: SelfSign
    issuer:
    subject:
    expires: unknown
    track: yes
    auto-renew: yes
[root@mars ~]#

Request status is 'NEED_CSR' which should be 'MONITORING'. 
  
Actual results:
Certificate is not generated after changing the SELinux security context of directory

Expected results:
Certificate should have been generated after changing the SELinux security context of directory

Comment 2 Nalin Dahyabhai 2011-04-12 13:08:18 UTC
The service's design didn't take into account the possibility that it would be asked to resubmit a certificate request while there was no key pair available, so it would get confused.  Changing it to check whether or not it was able to successfully read information about the private key, and going back to the key generation phase if it hadn't, fixes this.  As a prerequisite, it needs to also read that information back immediately after generating a key in order for the key size to be known, which is what it uses as an indicator of the key being present.

Comment 6 Kaleem 2011-04-13 07:38:24 UTC
Verified.

RHEL Version:
=============
[root@testing ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.1 Beta (Santiago)

Certmonger Version:
===================
[root@testing ~]# rpm -qai certmonger |head
Name        : certmonger                   Relocations: (not relocatable)
Version     : 0.41                              Vendor: Red Hat, Inc.
Release     : 1.el6                         Build Date: Tue 12 Apr 2011 03:15:19 AM IST
Install Date: Wed 13 Apr 2011 07:21:08 AM IST      Build Host: hs20-bc2-4.build.redhat.com
Group       : System Environment/Daemons    Source RPM: certmonger-0.41-1.el6.src.rpm
Size        : 871428                           License: GPLv3+
Signature   : (none)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL         : http://certmonger.fedorahosted.org
Summary     : Certificate status monitor and PKI enrollment client
[root@testing ~]#


Steps used to verify:
=====================
(1)Install certmonger

[root@testing ~]# yum install certmonger -y
Installed:
  certmonger.x86_64 0:0.41-1.el6                                                                                                                             
Dependency Installed:
  libtevent.x86_64 0:0.9.8-8.el6                                                                                                                             

(2)Start certmonger service

[root@testing ~]# service certmonger start
Starting certmonger:                                       [  OK  ]

(3)Create a temp directory

[root@testing ~]# mkdir /tmp/kaleem

(4)Issue a certificate request using directory as NSS database created in last step

[root@testing ~]# getcert request -d /tmp/kaleem/ -n test -I testing -c Selfsign
New signing request "testing" added.
[root@testing ~]# getcert list
Number of certificates and requests being tracked: 1.
Request ID 'testing':
	status: NEED_KEY_PAIR
	stuck: no
	key pair storage: type=NSSDB,location='/tmp/kaleem',nickname='test'
	certificate: type=NSSDB,location='/tmp/kaleem',nickname='test'
	CA: SelfSign
	issuer: 
	subject: 
	expires: unknown
	track: yes
	auto-renew: yes
[root@testing ~]#

Request status is 'NEED_KEY_PAIR' here.

(5)Change SELinux security context of temp directory created in step (3)

[root@testing ~]# chcon -t cert_t  /tmp/kaleem/
[root@testing ~]#

(6)Resubmit the certificate request

[root@testing ~]# getcert resubmit -i testing
Resubmitting "testing" to "SelfSign".
[root@testing ~]# getcert list
Number of certificates and requests being tracked: 1.
Request ID 'testing':
	status: MONITORING
	stuck: no
	key pair storage: type=NSSDB,location='/tmp/kaleem',nickname='test',token='NSS Certificate DB'
	certificate: type=NSSDB,location='/tmp/kaleem',nickname='test',token='NSS Certificate DB'
	CA: SelfSign
	issuer: CN=testing.mars.lab.eng.pnq.redhat.com
	subject: CN=testing.mars.lab.eng.pnq.redhat.com
	expires: 20120413015649
	dns: testing.mars.lab.eng.pnq.redhat.com
	principal name: host/testing.mars.lab.eng.pnq.redhat.com
	eku: id-kp-serverAuth
	track: yes
	auto-renew: yes
[root@testing ~]#

Now here request status is 'MONITORING'.

Result:

Now certificate is generated after changing the SELinux context of the directory.

Comment 7 Eva Kopalova 2011-05-02 17:04:56 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Previously, the getcert tool terminated unexpectedly with a segmentation fault if the user issued the getcert start-tracking command with changed values of the parameters Extended Key Usage, DNS, Email and Principal name. The command caused a buffer overflow in the getcert tool because the internal buffer in the getcert command was too small to hold four new values. This update enlarges the internal buffer of the command and the bug no longer occurs.

Comment 8 errata-xmlrpc 2011-05-19 13:07:27 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0570.html


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