Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1365188 - AVC seen during IdM automatic cert renewal
Summary: AVC seen during IdM automatic cert renewal
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 24
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 1366915
TreeView+ depends on / blocked
Reported: 2016-08-08 14:54 UTC by Florence Blanc-Renaud
Modified: 2017-08-08 16:20 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1366915 (view as bug list)
Last Closed: 2017-08-08 16:20:01 UTC

Attachments (Terms of Use)
Output of journalctl -t renew_ca_cert (deleted)
2016-08-08 14:54 UTC, Florence Blanc-Renaud
no flags Details
Output of ausearch -m AVC (deleted)
2016-08-08 14:55 UTC, Florence Blanc-Renaud
no flags Details

Description Florence Blanc-Renaud 2016-08-08 14:54:29 UTC
Created attachment 1188818 [details]
Output of journalctl -t renew_ca_cert

Description of problem:

IdM is configured with an embedded Certificate Authority. With this configuration, it must automatically renew the certificates used internally by its components.
Certmonger is used to track the certificates stored in /etc/pki/pki-tomcat/alias, succeeds in cert renewal but fails when running the CA helper script because of SElinux policy preventing from updating the file 
/var/lib/pki/pki-tomcat/conf/ca/CS.cfg with the new cert.
This results in certmonger not having the right certificate.

Certmonger is running the script /usr/libexec/certmonger/dogtag-ipa-ca-renew-agent-submit => the script inherits certmonger context, which is certmonger_t

$ ps -efZ | grep certmonger
system_u:system_r:certmonger_t:s0 root     1670      1  0 14:59 ?        00:00:00 /usr/sbin/certmonger -S -p /var/run/ -n

The file that cannot be updated is /var/lib/pki/pki-tomcat/conf/ca/CS.cfg, with context pki_tomcat_etc_rw_t:
$ sudo ls -Z /var/lib/pki/pki-tomcat/conf/ca/CS.cfg
unconfined_u:object_r:pki_tomcat_etc_rw_t:s0 /var/lib/pki/pki-tomcat/conf/ca/CS.cfg

Version-Release number of selected component (if applicable):
Fedora release 24 (Twenty Four)
selinux-policy.noarch    3.13.1-191.fc24.2
selinux-policy-targeted.noarch 3.13.1-191.fc24.2

How reproducible:

Steps to Reproduce:
1. Install IDM with a self-signed CA:
sudo ipa-server-install --setup-dns \
--auto-forwarders \
--auto-reverse \
-n $DOMAIN \
-r $REALM \
-p Secret123 -a Secret123 \

2. check when the subsystemCert expires
$ sudo getcert list -d /etc/pki/pki-tomcat/alias -n 'subsystemCert cert-pki-ca' | grep expires

3. stop ntpd and change date to a few days before cert expiration
$ sudo systemctl stop ntpd
$ sudo date -s "2018-07-25 00:00"

4. Certmonger renews the certs, but we can find errors:
$ sudo journalctl -t renew_ca_cert --since "2018-07-25" > ~/journalctl.out
$ sudo ausearch -m avc --start today > ~/ausearch_certmonger.out

The file /var/lib/pki/pki-tomcat/conf/ca/CS.cfg has not been updated with the new cert (line ca.subsystem.cert=...)

Actual results:
AVC errors seen and journal errors for certmonger, file CS.cfg not updated.

Expected results:
No AVC error, file CS.cfg udpated.

Additional info:
Attaching output of journalctl and ausearch.

Comment 1 Florence Blanc-Renaud 2016-08-08 14:55:14 UTC
Created attachment 1188819 [details]
Output of ausearch -m AVC

Comment 2 Fedora End Of Life 2017-07-25 22:18:21 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2017-08-08 16:20:01 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.

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