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 2066439 - certmonger SEGV during rekey in FIPS mode
Summary: certmonger SEGV during rekey in FIPS mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: certmonger
Version: 9.0
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: rc
: ---
Assignee: Rob Crittenden
QA Contact: ipa-qe
URL:
Whiteboard:
Depends On:
Blocks: 2150070
TreeView+ depends on / blocked
 
Reported: 2022-03-21 19:00 UTC by Rob Crittenden
Modified: 2022-12-01 18:54 UTC (History)
2 users (show)

Fixed In Version: certmonger-0.79.14-7.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2150070 (view as bug list)
Environment:
Last Closed: 2022-11-15 10:14:26 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-8039 0 None None None 2022-03-21 19:03:02 UTC
Red Hat Issue Tracker RHELPLAN-116311 0 None None None 2022-03-21 19:03:05 UTC
Red Hat Product Errata RHBA-2022:8059 0 None None None 2022-11-15 10:14:29 UTC

Description Rob Crittenden 2022-03-21 19:00:28 UTC
Description of problem:

Segmentation fault trying to rekey a request while in FIPS mode.

#0  util_NETSCAPE_SPKI_set_sig_alg (sig_alg=<optimized out>, 
    spki=<optimized out>)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/util-o.c:184
#1  cm_csrgen_o_main (fd=<optimized out>, ca=<optimized out>, 
    entry=<optimized out>, userdata=<optimized out>)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/csrgen-o.c:362
#2  0x0000563ab5ef05e1 in cm_subproc_start (
    cb=0x563ab5f1a660 <cm_csrgen_o_main>, parent=<optimized out>, ca=0x0, 
    entry=0x563ab7bae6e0, data=0x0)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/subproc.c:190
#3  0x0000563ab5f25599 in cm_csrgen_o_start (entry=0x563ab7bae6e0)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/csrgen-o.c:589
#4  cm_csrgen_start (entry=0x563ab7bae6e0)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/csrgen.c:106
#5  cm_iterate_entry (get_ca_by_index=<optimized out>, 
    get_n_cas=<optimized out>, get_entry_by_index=<optimized out>, 
    get_n_entries=<optimized out>, emit_entry_saved_cert=<optimized out>, 
    emit_entry_changes=<optimized out>, readfd=<synthetic pointer>, 
    delay=<synthetic pointer>, when=<synthetic pointer>, 
    cm_iterate_state=<optimized out>, context=0x563ab7b78000, 
    ca=<optimized out>, entry=0x563ab7bae6e0)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/iterate.c:815
#6  cm_service_entry.constprop.0 (context=0x563ab7b78000, i=<optimized out>, 
    current_time=0x0)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/cm.c:434
#7  0x0000563ab5ee25e6 in cm_timer_h (ec=<optimized out>, te=0x563ab7bd2430, 
    current_time=..., pvt=0x563ab7b78000)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/cm.c:208
#8  0x00007f572361664e in tevent_common_invoke_timer_handler ()
   from /lib64/libtevent.so.0
#9  0x00007f5723616810 in tevent_common_loop_timer_delay ()
   from /lib64/libtevent.so.0
#10 0x00007f57236172e9 in epoll_event_loop_once () from /lib64/libtevent.so.0
#11 0x00007f572360f69b in std_event_loop_once () from /lib64/libtevent.so.0
#12 0x00007f5723611da8 in _tevent_loop_once () from /lib64/libtevent.so.0
#13 0x0000563ab5edfc93 in main (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/main.c:413

The trace points to util_NETSCAPE_SPKI_set_sig_alg but the gdb output is

#0  util_NETSCAPE_SPKI_set_sig_alg (sig_alg=<optimized out>, 
    spki=<optimized out>)
    at /usr/src/debug/certmonger-0.79.14-5.el9.x86_64/src/util-o.c:184
184             return ASN1_BIT_STRING_new();

Version-Release number of selected component (if applicable):
certmonger-0.79.14-5.el9.x86_64

How reproducible:

Every time

Steps to Reproduce:
0. install IPA server
1. kinit admin
2. ipa service-add test/master.testrealm.test
3. getcert request -f /etc/pki/tls/certs/test.pem -k /etc/pki/tls/private/test.key -K test/master.testrealm.test -I test
4. getcert rekey -i test -g 3072 -G DSA

Note that changing the key type to DSA appears to be unrelated.

Comment 1 Rob Crittenden 2022-03-21 19:25:50 UTC
valgrind is detecting a couple of errors. The return value of malloc() is checked but it isn't enforced and a variable may be re-used later. It doesn't seem entirely related.

==19083== Invalid read of size 1
==19083==    at 0x1268C0: cm_store_hex_from_bin (store-gen.c:498)
==19083==    by 0x144D3E: cm_keyiread_o_main.lto_priv.0 (keyiread-o.c:190)
==19083==    by 0x12A5E0: cm_subproc_start (subproc.c:190)
==19083==    by 0x11D58C: UnknownInlinedFun (keyiread-o.c:341)
==19083==    by 0x11D58C: cm_keyiread_start (keyiread.c:41)
==19083==    by 0x11D61E: cm_iterate_entry_init (iterate.c:479)
==19083==    by 0x119247: UnknownInlinedFun (cm.c:146)
==19083==    by 0x119247: main (main.c:286)
==19083==  Address 0x6a71a8e is 0 bytes after a block of size 270 alloc'd
==19083==    at 0x484486F: malloc (vg_replace_malloc.c:381)
==19083==    by 0x144D17: cm_keyiread_o_main.lto_priv.0 (keyiread-o.c:187)
==19083==    by 0x12A5E0: cm_subproc_start (subproc.c:190)
==19083==    by 0x11D58C: UnknownInlinedFun (keyiread-o.c:341)
==19083==    by 0x11D58C: cm_keyiread_start (keyiread.c:41)
==19083==    by 0x11D61E: cm_iterate_entry_init (iterate.c:479)
==19083==    by 0x119247: UnknownInlinedFun (cm.c:146)
==19083==    by 0x119247: main (main.c:286)
==19083== 
==19083== Invalid read of size 1
==19083==    at 0x1268D4: cm_store_hex_from_bin (store-gen.c:499)
==19083==    by 0x144D3E: cm_keyiread_o_main.lto_priv.0 (keyiread-o.c:190)
==19083==    by 0x12A5E0: cm_subproc_start (subproc.c:190)
==19083==    by 0x11D58C: UnknownInlinedFun (keyiread-o.c:341)
==19083==    by 0x11D58C: cm_keyiread_start (keyiread.c:41)
==19083==    by 0x11D61E: cm_iterate_entry_init (iterate.c:479)
==19083==    by 0x119247: UnknownInlinedFun (cm.c:146)
==19083==    by 0x119247: main (main.c:286)
==19083==  Address 0x6a71a8e is 0 bytes after a block of size 270 alloc'd
==19083==    at 0x484486F: malloc (vg_replace_malloc.c:381)
==19083==    by 0x144D17: cm_keyiread_o_main.lto_priv.0 (keyiread-o.c:187)
==19083==    by 0x12A5E0: cm_subproc_start (subproc.c:190)
==19083==    by 0x11D58C: UnknownInlinedFun (keyiread-o.c:341)
==19083==    by 0x11D58C: cm_keyiread_start (keyiread.c:41)
==19083==    by 0x11D61E: cm_iterate_entry_init (iterate.c:479)
==19083==    by 0x119247: UnknownInlinedFun (cm.c:146)
==19083==    by 0x119247: main (main.c:286)

Comment 2 Rob Crittenden 2022-03-21 21:42:05 UTC
This isn't related to rekeying. It is failing trying to generate a DSA CSR whether a new or rekey.

The key is generating ok, it seems only related to the CSR. The key file exists, contains a DSA key of the right size and openssl dsa can parse it without complaint (other than not being able to write PEM files on output).

certmonger-0.79.9 removed the test csrgen-003-dsa with the message:

    Remove DSA testing for NSS which disables it in crypto policy
    
    DSA is disabled in DEFAULT crypto policy in F30+

Simo tells me that DSA is forcibly disabled in FIPS and not relying on policy. That explains why I didn't see a policy to kill it.

I'll investigate further to see if I should disable DSA key type by passing --disable-dsa to configure in the build.

Comment 3 Rob Crittenden 2022-03-28 18:48:37 UTC
Note that when not in FIPS mode a DSA key can be generated but the CA will not issue a certificate for it, logging:

SEVERE: Unable to create enrollment request: Invalid Request
Invalid Request
[ snip backtrace ]
Caused by: java.security.NoSuchAlgorithmException: no such algorithm: OID.2.16.840.1.101.3.4.3.2 for provider Mozilla-JSS

So completely disabling DSA is not a reduction in functionality, more of an acceptance of reality.

Comment 9 errata-xmlrpc 2022-11-15 10:14:26 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:8059


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