Bug 1033333
| Summary: | Certmonger crashes when trying to decode certificate with invalid data in header | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Nalin Dahyabhai <nalin> |
| Component: | certmonger | Assignee: | Nalin Dahyabhai <nalin> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Kaleem <ksiddiqu> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.0 | CC: | dpal, jr.aquino, kchamart |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| URL: | https://fedorahosted.org/certmonger/ticket/22 | ||
| Whiteboard: | |||
| Fixed In Version: | certmonger-0.69-1.el7 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 1032760 | Environment: | |
| Last Closed: | 2014-06-13 11:19:05 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | 1032760 | ||
| Bug Blocks: | |||
|
Description
Nalin Dahyabhai
2013-11-21 21:22:38 UTC
I'd like to pull this in, though starting under systemd should already avoid most of the complications of the first part, so it's not as urgent here. How QE should verify (steps) this? The root cause is that the environment isn't cleared when the enrollment helper is run. To verify that, we need to ensure that the TERM variable isn't set when the helper is run, so that it won't unexpectedly output a terminal initialization string. We can do that either by examining the process itself while it runs, or by comparing the normal behavior with the behavior we get when we ensure that it _is_ set (though this will only work so long as the helper itself behaves differently). For the first method, we need to find the helper which is invoked in an attempt to get a new certificate. Locate the file under /var/lib/certmonger/cas which includes the CA's name (as noted in the 'getcert' output for the certificate we're tracking) in its 'id' field. If that file also contains a 'ca_external_helper' value, that's the command that the daemon runs to handle interactions with the CA. Then, while that process is running (it may require a manual 'getcert resubmit' to run it again if it finishes quickly), run strings /proc/`pidof COMMAND`/environ | sort A fixed version of certmonger will always set TERM to "dumb". One that doesn't have that fix will just pass through the value it was started with. The second method will only work so long as the helper actually behaves differently. For example, if you run /usr/libexec/certmonger/dogtag-ipa-retrieve-agent-submit | od -t x1c and see it produce output, then bug #880393 is still present and we can observe what happens when we stop the certmonger service and edit the appropriate CA file so that the helper it invokes is preceded by "env TERM=xterm" or "env TERM=dumb". Verified IPA and certmonger version: =========================== [root@nec-em6 ~]# rpm -q ipa-server certmonger ipa-server-3.3.3-19.el7.x86_64 certmonger-0.70-2.el7.x86_64 [root@nec-em6 ~]# TERM variable is set to "dumb" by /usr/libexec/certmonger/dogtag-ipa-retrieve-agent-submit and "getcert resubmit" works fine. [root@nec-em6 ~]# cat /etc/sysconfig/certmonger TERM=xterm-256color [root@nec-em6 ~]# ps -eaf|grep agent root 5284 3429 3 03:36 ? 00:00:00 /usr/bin/python -E /usr/libexec/certmonger/dogtag-ipa-retrieve-agent-submit root 5286 5221 0 03:36 pts/1 00:00:00 grep --color=auto agent [root@nec-em6 ~]# strings /proc/5284/environ |grep TEMP [root@nec-em6 ~]# strings /proc/5284/environ |grep TERM TERM=dumb [root@nec-em6 ~]# strings /proc/5284/environ HOME=/var/run/certmonger PATH=/usr/bin:/bin:/usr/sbin:/sbin SHELL=/bin/sh TERM=dumb TMPDIR=/var/run/certmonger CERTMONGER_REQ_SUBJECT=CN=IPA RA,O=TESTRELM.TEST CERTMONGER_OPERATION=SUBMIT CERTMONGER_CSR=-----BEGIN NEW CERTIFICATE REQUEST----- MIIC+jCCAeICAQAwKTEWMBQGA1UEChMNVEVTVFJFTE0uVEVTVDEPMA0GA1UEAxMG SVBBIFJBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4EhxGXR5DzUo ATbyvsyBiiajsWzuJv2ex6KqOs1kc9CWjpJu4IBpNv6IoNBzXNERPgBUABKFz7M0 hb7+JvTV0AxvrogKBK1WdI5UNaPfHVR8i4smyA7YRZgtkfmGN55uJrea5XFL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ates and requests being tracked: 7. Request ID '20140304104507': status: MONITORING stuck: no key pair storage: type=NSSDB,location='/etc/httpd/alias',nickname='ipaCert',token='NSS Certificate DB',pinfile='/etc/httpd/alias/pwdfile.txt' certificate: type=NSSDB,location='/etc/httpd/alias',nickname='ipaCert',token='NSS Certificate DB' CA: dogtag-ipa-retrieve-agent-submit issuer: CN=Certificate Authority,O=TESTRELM.TEST subject: CN=IPA RA,O=TESTRELM.TEST expires: 2016-02-22 17:49:50 UTC key usage: digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment eku: id-kp-serverAuth,id-kp-clientAuth pre-save command: post-save command: /usr/lib64/ipa/certmonger/restart_httpd track: yes auto-renew: yes [root@nec-em6 ~]# getcert resubmit -i 20140304104507 Resubmitting "20140304104507" to "dogtag-ipa-retrieve-agent-submit". [root@nec-em6 ~]# [root@nec-em6 ~]# getcert list -i 20140304104507 Number of certificates and requests being tracked: 7. Request ID '20140304104507': status: MONITORING stuck: no key pair storage: type=NSSDB,location='/etc/httpd/alias',nickname='ipaCert',token='NSS Certificate DB',pinfile='/etc/httpd/alias/pwdfile.txt' certificate: type=NSSDB,location='/etc/httpd/alias',nickname='ipaCert',token='NSS Certificate DB' CA: dogtag-ipa-retrieve-agent-submit issuer: CN=Certificate Authority,O=TESTRELM.TEST subject: CN=IPA RA,O=TESTRELM.TEST expires: 2016-02-23 08:28:05 UTC key usage: digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment eku: id-kp-serverAuth,id-kp-clientAuth pre-save command: post-save command: /usr/lib64/ipa/certmonger/restart_httpd track: yes auto-renew: yes [root@nec-em6 ~]# This request was resolved in Red Hat Enterprise Linux 7.0. Contact your manager or support representative in case you have further questions about the request. |