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 1881500 - Certmonger segfault after cert renewal request
Summary: Certmonger segfault after cert renewal request
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: certmonger
Version: 8.3
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: rc
: 8.5
Assignee: Rob Crittenden
QA Contact: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-22 14:26 UTC by Aleksandr Sharov
Modified: 2023-12-15 19:28 UTC (History)
6 users (show)

Fixed In Version: certmonger-0.79.13-4.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-10 13:38:10 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FREEIPA-7047 0 None None None 2021-10-07 06:22:57 UTC
Red Hat Product Errata RHBA-2022:1789 0 None None None 2022-05-10 13:38:20 UTC

Description Aleksandr Sharov 2020-09-22 14:26:24 UTC
Description of problem:
Command 

# ipa-getcert request -k /etc/pki/tls/private/cmgmr01.prod.csp.local.key -f /etc/pki/tls/certs/cmgmr01.prod.csp.local.pem 

gets certmonger to segfault with error:

Sep  9 12:48:01 cmgmr01 kernel: certmonger[14515]: segfault at 0 ip 00007f09ca36cdaa sp 00007ffe4d9358c8 error 4 in libc-2.17.so[7f09ca22e000+1c3000]
Sep  9 12:48:01 cmgmr01 systemd: certmonger.service: main process exited, code=killed, status=11/SEGV
Sep  9 12:48:01 cmgmr01 systemd: Unit certmonger.service entered failed state.
Sep  9 12:48:01 cmgmr01 systemd: certmonger.service failed.

Version-Release number of selected component (if applicable):
certmonger-0.78.4-12.el7.x86_64

How reproducible:
always

Steps to Reproduce:
Described earlier

Actual results:
Certmonger enters failed state after segfault

Expected results:
Certmonger handles command correctly

Additional info:
After failing, certmonger restarts normally and works fine until another request. Sosreport and coredump file are attached to the linked case.


[root@cmgmr01 chatfir]# getcert list
Number of certificates and requests being tracked: 2.
Request ID 'dogtag-ipa-renew-agent':
        status: NEED_KEY_PAIR
        stuck: no
        key pair storage: type=NONE
        certificate: type=FILE,location=''
        issuer:
        subject:
        expires: unknown
        pre-save command:
        post-save command:
        track: no
        auto-renew: no
Request ID '20180911095336':
        status: MONITORING
        stuck: no
        key pair storage: type=FILE,location='/opt/cloudera/security/key.pem'
        certificate: type=FILE,location='/opt/cloudera/security/cert.pem'
        CA: IPA
        issuer: CN=Certificate Authority,O=PROD.CSP.LOCAL
        subject: CN=cmgmr01.prod.csp.local,O=PROD.CSP.LOCAL
        expires: 2022-09-09 14:57:40 UTC
        dns: cmgmr01.prod.csp.local
        principal name: host/cmgmr01.prod.csp.local.LOCAL
        key usage: digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment
        eku: id-kp-serverAuth,id-kp-clientAuth
        pre-save command:
        post-save command:
        track: yes
        auto-renew: yes

Comment 2 Rob Crittenden 2020-09-22 14:53:35 UTC
It is failing while iterating through the set of certificates due to the failed request 'dogtag-ipa-renew-agent'. Can you provide this request? It's in /var/lib/certmonger/requests/<some_id>. A simple grep for 'dogtag-ipa-renew-agent' should identify it from the other request.

#1  0x000055dc4032245d in base_add_request (conn=0x55dc420ebf10, 
    msg=0x55dc420ec450, ci=0x7ffe02627170, ctx=0x55dc420d2b50) at tdbush.c:681
681                     if (strcmp(cert_location, e->cm_cert_storage_location) != 0) {
(gdb) print cert_location
$3 = 0x55dc420dfce0 "/etc/pki/tls/certs/cmgmr01.prod.csp.local.pem"
(gdb) print e->cm_cert_storage_location
$4 = 0x0

Any guess how this request was made? It would help tighten up the code as it appears now to assume that this will always be set (which I can also fix).

I think to resolve this simply deleting the failed request will fix it but I'd like the chance to look at it first.

Comment 3 Aleksandr Sharov 2020-09-23 09:59:22 UTC
Hi Rob!

I've requested it from the client, you can see it attached to the case. 

Thank you!

Comment 4 Rob Crittenden 2020-09-23 12:54:38 UTC
It is safe to remove this with: getcert stop-tracking -i dogtag-ipa-renew-agent

That should fix things. I'm curious how this was created at all. It is effectively completely empty:

id=dogtag-ipa-renew-agent
key_type=UNSPECIFIED
key_gen_type=UNSPECIFIED
key_size=0
key_gen_size=0
key_next_type=UNSPECIFIED
key_next_gen_type=UNSPECIFIED
key_next_size=0
key_next_gen_size=0
key_preserve=0
key_storage_type=NONE
key_perms=0
key_requested_count=0
key_issued_count=0
cert_storage_type=FILE
cert_perms=0
cert_is_ca=0
cert_ca_path_length=0
cert_no_ocsp_check=0
last_need_notify_check=19700101000000
last_need_enroll_check=19700101000000
template_is_ca=0
template_ca_path_length=-1
template_no_ocsp_check=0
state=NEED_KEY_PAIR
autorenew=0
monitor=0
submitted=19700101000000

Comment 7 Rob Crittenden 2021-02-17 16:53:59 UTC
Cloned upstream to https://pagure.io/certmonger/issue/191

Comment 9 Rob Crittenden 2021-02-17 19:14:40 UTC
Moving to RHEL 8.

Comment 11 Rob Crittenden 2021-02-17 19:16:47 UTC
Upstream PR https://pagure.io/certmonger/pull-request/192

Comment 12 Petr Čech 2021-02-19 07:38:26 UTC
Thank you taking your time and submitting this request for Red Hat Enterprise Linux 7.
Red Hat Enterprise Linux 7 is in Maintenance Support 2 Phase. This bug was reevaluated and will be postponed to RHEL 8.
Thank you for understanding.
Red Hat Enterprise Linux Identity Management Team

Comment 13 Rob Crittenden 2021-05-14 18:40:45 UTC
merged upstream: 0eec70b9dbd0a50a24fe173a68fd9ab72857e08d

Comment 23 Mohammad Rizwan 2021-11-25 07:48:51 UTC
version:
certmonger-0.79.13-5.el8.x86_64

Steps:

[root@master ~]# systemctl stop certmonger

[root@master ~]# cat > /var/lib/certmonger/requests/20211125062617 << EOF
id=dogtag-ipa-renew-agent
key_type=UNSPECIFIED
key_gen_type=UNSPECIFIED
key_size=0
key_gen_size=0
key_next_type=UNSPECIFIED
key_next_gen_type=UNSPECIFIED
key_next_size=0
key_next_gen_size=0
key_preserve=0
key_storage_type=NONE
key_perms=0
key_requested_count=0
key_issued_count=0
cert_storage_type=FILE
cert_perms=0
cert_is_ca=0
cert_ca_path_length=0
cert_no_ocsp_check=0
last_need_notify_check=19700101000000
last_need_enroll_check=19700101000000
template_is_ca=0
template_ca_path_length=-1
template_no_ocsp_check=0
state=NEED_KEY_PAIR
autorenew=0
monitor=0
submitted=19700101000000
EOF

[root@master ~]# systemctl start certmonger
[root@master ~]# systemctl status certmonger
● certmonger.service - Certificate monitoring and PKI enrollment
   Loaded: loaded (/usr/lib/systemd/system/certmonger.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-11-25 02:02:30 EST; 7s ago
 Main PID: 27878 (certmonger)
    Tasks: 19 (limit: 23443)
   Memory: 559.8M
   CGroup: /system.slice/certmonger.service
           ├─27878 /usr/sbin/certmonger -S -p /run/certmonger.pid -n -d2
           ├─27933 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit
           ├─27939 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit
           ├─27940 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit
           ├─27941 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --reuse-existing
           ├─27942 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --reuse-existing
           ├─27944 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --reuse-existing
           ├─27945 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --reuse-existing
           ├─27946 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --reuse-existing
           ├─27947 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --reuse-existing
           ├─27948 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --reuse-existing
           ├─27949 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --reuse-existing
           ├─27953 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --force-self-signed
           ├─27954 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --force-self-signed
           ├─27955 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --force-self-signed
           ├─27956 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --force-self-signed
           ├─27957 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --force-self-signed
           ├─27958 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --force-self-signed
           └─27959 /usr/libexec/platform-python -I /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit --force-self-signed

Nov 25 02:02:33 master.testrelm.test certmonger[27878]: 2021-11-25 02:02:33 [27954] Running enrollment/cadata helper "/usr/lib>
Nov 25 02:02:33 master.testrelm.test certmonger[27878]: 2021-11-25 02:02:33 [27955] Running enrollment/cadata helper "/usr/lib>
[root@master ~]# 

[root@master ~]# getcert list -i dogtag-ipa-renew-agent
Request ID 'dogtag-ipa-renew-agent':
	status: NEED_KEY_PAIR
	stuck: no
	key pair storage: type=NONE
	certificate: type=FILE,location=''
	issuer: 
	subject: 
	issued: unknown
	expires: unknown
	pre-save command: 
	post-save command: 
	track: no
	auto-renew: no

[root@master ~]# ipa-getcert request -k /etc/pki/tls/private/test.key -f /etc/pki/tls/certs/test.pem 
New signing request "20211125070352" added.
[root@master ~]# getcert list -i 20211125070352
Number of certificates and requests being tracked: 11.
Request ID '20211125070352':
	status: MONITORING
	stuck: no
	key pair storage: type=FILE,location='/etc/pki/tls/private/test.key'
	certificate: type=FILE,location='/etc/pki/tls/certs/test.pem'
	CA: IPA
	issuer: CN=Certificate Authority,O=TESTRELM.TEST
	subject: CN=master.testrelm.test,O=TESTRELM.TEST
	issued: 2021-11-25 02:03:53 EST
	expires: 2023-11-26 02:03:53 EST
	dns: master.testrelm.test
	principal name: host/master.testrelm.test
	key usage: digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment
	eku: id-kp-serverAuth,id-kp-clientAuth
	pre-save command: 
	post-save command: 
	track: yes
	auto-renew: yes
[root@master ~]# 


Cert request succeed. Certmonger is working as expected. Hence marking the bug as verified.

Comment 27 errata-xmlrpc 2022-05-10 13:38:10 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 (certmonger 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-2022:1789


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