Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1385167
Summary: | Httpd can't read files created by certbot when started from /etc/crontab | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Göran Uddeborg <goeran> |
Component: | selinux-policy-targeted | Assignee: | Lukas Vrabec <lvrabec> |
Status: | CLOSED EOL | QA Contact: | Ben Levenson <benl> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 25 | CC: | dominik, dwalsh, james.hogarth, laurent.rineau__fedora, milan.kerslager, olchansk, olle, urkle |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2017-12-12 10:57:02 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: | |||
Bug Blocks: | 1377312 |
Description
Göran Uddeborg
2016-10-14 20:40:31 UTC
Reproducible on F24 as well: $ rpm -qa \*certbot\* selinux-policy\* |sort certbot-0.9.3-1.fc24.noarch python2-certbot-0.9.3-1.fc24.noarch python2-certbot-apache-0.9.3-1.fc24.noarch selinux-policy-3.13.1-191.21.fc24.noarch selinux-policy-targeted-3.13.1-191.21.fc24.noarch FYI this is the local policy module that I'm running to work around this: # cat certbot-local.cil (typeattributeset cil_gen_require httpd_t) (typeattributeset cil_gen_require cron_var_lib_t) (allow httpd_t cron_var_lib_t (file (getattr open read))) I guess it's equivalent to what the original reporter posted. certbot stores the certificates that have been signed in /etc/letsencrypt/live/ with archives of previous certificates in /etc/letsencrypt/archive/ You really should be using the /etc/.../live/ directory to point httpd to. This doesn't have the right selinux label yet, but a PR is in place (and the certbot package will be updated to handle this as well if need be soon) to label everything in those directories as cert_t ... which httpd can read with no additional selinux module needed. On my personal server I have: /etc/letsencrypt/(live|archive)(/.*)? all files system_u:object_r:cert_t:s0 This works fine for a systemd timer based renewal (coming soon to a certbot package near you!) james I am also having this issue on CentOS 7.. It is a stock install from EPEL.. It seems that /var/lib/letsencrypt is used by default as it's the "working directory" that letencrypt is using. So the issue is not for the final "live" location of the certs, but the temporary location while things are being negotiated w/ letencrypt. Now, by me adding this context to my selinux setup the issue is fully resolved. semanage fcontext -a '/var/lib/letsencrypt(/.*)?' -t cert_t Perhaps the default setup of certbot RPM should be configure to either A) include that fcontext or B) use a different folder for it's working directory? Also, I tried the timer service, and it just simply doesn't work. there are issues with how it's passing the command line parameters in so it NEVER runs. I've been trying `systemctrl start certbot-renew.service` and this is the output that spews forth. Apr 13 14:08:16 iis systemd: Starting This service automatically renews any certbot certificates found... Apr 13 14:08:17 iis certbot: usage: Apr 13 14:08:17 iis certbot: certbot [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ... Apr 13 14:08:17 iis certbot: Certbot can obtain and install HTTPS/TLS/SSL certificates. By default, Apr 13 14:08:17 iis certbot: it will attempt to use a webserver both for obtaining and installing the Apr 13 14:08:17 iis certbot: cert. Apr 13 14:08:17 iis certbot: certbot: error: argument --pre-hook: expected one argument Apr 13 14:08:17 iis systemd: certbot-renew.service: main process exited, code=exited, status=2/INVALIDARGUMENT Apr 13 14:08:17 iis systemd: Failed to start This service automatically renews any certbot certificates found. Apr 13 14:08:17 iis systemd: Unit certbot-renew.service entered failed state. Apr 13 14:08:17 iis systemd: certbot-renew.service failed. The problem is still there. I have in /var/log/audit/audit.log denied write for /etc/letsencrypt/.certbot.lock and /var/log/letsencrypt/.certbot.lock This is possible to run "certbot renew" as root, but it is not possible to run this command by cronjob as suggested by certbot page when SELinux is enforcing. But you don't need to run it as a cronjob any more. The package maintainer worked around this problem with the systemd style certbot-renew.timer instead. It will trigger the certbot renew task regularly. At least it works fine for me. Certbot is run once each night, and successfully renewed my certificates some weeks ago. Ah, thanx. So the workaround is: systemctl enable certbot-renew systemctl start certbot-renew Now, I'm not 100% sure about the systemd motions I did, but I believe the important step is to enable the timer: systemctl enable certbot-renew.timer On my machine, it looks like this currently: 23:32 mimmi$ systemctl status certbot-renew.service certbot-renew.timer ● certbot-renew.service - This service automatically renews any certbot certificates found Loaded: loaded (/usr/lib/systemd/system/certbot-renew.service; static; vendor preset: disabled) Active: inactive (dead) ● certbot-renew.timer - This is the timer to set the schedule for automated renewals Loaded: loaded (/usr/lib/systemd/system/certbot-renew.timer; enabled; vendor preset: disabled) Active: inactive (dead) Do a "journalctl -u certbot-renew" the next day and verify. This message is a reminder that Fedora 25 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 25. 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 '25'. 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 25 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. Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 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 bug. Thank you for reporting this bug and we are sorry it could not be fixed. |