Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Description of problem:
It seems like the SELinux policy for Let's Encrypt (certbot) is missing or
incomplete.
Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.13.1-102.el7_3.16.noarch
certbot-0.13.0-1.el7.noarch
python2-certbot-0.13.0-1.el7.noarch
python2-certbot-apache-0.13.0-1.el7.noarch
How reproducible:
Install certbot with defaults for usage with Apache webserver including a
cronjob: 5 7,19 * * * root /usr/bin/certbot renew -q -n --rsa-key-size 4096
Actual results:
type=AVC msg=audit(1493485511.139:697789): avc: denied { getattr } for pid=397 comm="httpd" path="/var/lib/letsencrypt/65Z3fG09FSZuMGmYeWh-iuEv-nTzUW9k8ZVhmuWmX3I.crt" dev="dm-1" ino=266553 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:cron_var_lib_t:s0 tclass=file
type=SYSCALL msg=audit(1493485511.139:697789): arch=x86_64 syscall=stat success=no exit=EACCES a0=7f0cde100db0 a1=7fffab954cd0 a2=7fffab954cd0 a3=43 items=0 ppid=1 pid=397 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=httpd exe=/usr/sbin/httpd subj=system_u:system_r:httpd_t:s0 key=(null)
audit2allow reports the file in question as mislabeled. Given the file is
generated by certbot (and does not exist due to SELinux being enforced), it
seems to require some policy adaption?
Expected results:
No AVC denied messages when using Let's Encrypt (certbot).
It seems like the following makes Let's Encrypt (certbot) for renewals
happy, while I do not consider this as a good solution, more a workaround:
allow httpd_t cron_var_lib_t:file { getattr open read };
Following rule is missing:
type_transition unconfined_service_t var_lib_t : dir cert_t "letsencrypt";
As a result, /var/lib/letsencrypt is created with incorrect var_lib_t context.
# rpm -qa selinux\* | sort
selinux-policy-3.13.1-226.el7.noarch
selinux-policy-devel-3.13.1-226.el7.noarch
selinux-policy-doc-3.13.1-226.el7.noarch
selinux-policy-minimum-3.13.1-226.el7.noarch
selinux-policy-mls-3.13.1-226.el7.noarch
selinux-policy-sandbox-3.13.1-226.el7.noarch
selinux-policy-targeted-3.13.1-226.el7.noarch
#
For what it's worth, two paths are missing the `cert_t` context in the selinux-policy package:
1. /etc/(letsencrypt|certbot)/(live|archive)(/.*)?
This is added via `semanage` in the postinstall script of the EPEL package
2. /var/log/letsencrypt(/.*)?
This must currently be added manually
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, 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-2019:2127
Description of problem: It seems like the SELinux policy for Let's Encrypt (certbot) is missing or incomplete. Version-Release number of selected component (if applicable): selinux-policy-targeted-3.13.1-102.el7_3.16.noarch certbot-0.13.0-1.el7.noarch python2-certbot-0.13.0-1.el7.noarch python2-certbot-apache-0.13.0-1.el7.noarch How reproducible: Install certbot with defaults for usage with Apache webserver including a cronjob: 5 7,19 * * * root /usr/bin/certbot renew -q -n --rsa-key-size 4096 Actual results: type=AVC msg=audit(1493485511.139:697789): avc: denied { getattr } for pid=397 comm="httpd" path="/var/lib/letsencrypt/65Z3fG09FSZuMGmYeWh-iuEv-nTzUW9k8ZVhmuWmX3I.crt" dev="dm-1" ino=266553 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:cron_var_lib_t:s0 tclass=file type=SYSCALL msg=audit(1493485511.139:697789): arch=x86_64 syscall=stat success=no exit=EACCES a0=7f0cde100db0 a1=7fffab954cd0 a2=7fffab954cd0 a3=43 items=0 ppid=1 pid=397 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=httpd exe=/usr/sbin/httpd subj=system_u:system_r:httpd_t:s0 key=(null) audit2allow reports the file in question as mislabeled. Given the file is generated by certbot (and does not exist due to SELinux being enforced), it seems to require some policy adaption? Expected results: No AVC denied messages when using Let's Encrypt (certbot).