This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1289778 - Let's Encrypt gets wrong selinux context on generated certificates
Let's Encrypt gets wrong selinux context on generated certificates
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
27
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Lukas Vrabec
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks: 1377312
  Show dependency treegraph
 
Reported: 2015-12-08 18:22 EST by James Hogarth
Modified: 2017-09-11 10:39 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-09-11 10:39:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James Hogarth 2015-12-08 18:22:18 EST
Description of problem:
Let's Encrypt client writes its certificates to /etc/letsencrypt/(archive|live)(/.*)? (symlink from live into archive).

This currently gets the standard etc_t type which httpd/nginx is not permitted to read.

For now I'm going to advise users in the configuration docs for LE to add this context to this path but to have things working out of the box it'd be beneficial to label that regex as cert_t

Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-155.fc23.noarch


How reproducible:
Every time

Steps to Reproduce:
1. Install letsencrypt
2. Request a certificate for a domain (note this step requires a public facing webserver): 
letsencrypt --text --email recovery@example.com \
--domains www.example.com,example.com,foo.example.com \
--agree-tos --webroot  --renew-by-default  --webroot-path/var/www/html certonly
3. ls -lZ /etc/letsencrypt/{archive,live}/

Actual results:
[root@server ~]# ls -lZ /etc/letsencrypt/{archive,live}/*
/etc/letsencrypt/archive/www.example.com:
total 16
-rw-r--r--. 1 root root unconfined_u:object_r:etc_t:s0 1801 Dec  8 16:46 cert1.pem
-rw-r--r--. 1 root root unconfined_u:object_r:etc_t:s0 1675 Dec  8 16:46 chain1.pem
-rw-r--r--. 1 root root unconfined_u:object_r:etc_t:s0 3476 Dec  8 16:46 fullchain1.pem
-rw-r--r--. 1 root root unconfined_u:object_r:etc_t:s0 1704 Dec  8 16:46 privkey1.pem

/etc/letsencrypt/live/www.example.com:
total 0
lrwxrwxrwx. 1 root root unconfined_u:object_r:etc_t:s0 41 Dec  8 16:46 cert.pem -> ../../archive/www.example.com/cert1.pem
lrwxrwxrwx. 1 root root unconfined_u:object_r:etc_t:s0 42 Dec  8 16:46 chain.pem -> ../../archive/www.example.com/chain1.pem
lrwxrwxrwx. 1 root root unconfined_u:object_r:etc_t:s0 46 Dec  8 16:46 fullchain.pem -> ../../archive/www.example.com/fullchain1.pem
lrwxrwxrwx. 1 root root unconfined_u:object_r:etc_t:s0 44 Dec  8 16:46 privkey.pem -> ../../archive/www.example.com/privkey1.pem


Expected results:
[root@server ~]# ls -lZ /etc/letsencrypt/{archive,live}/*
/etc/letsencrypt/archive/www.example.com:
total 16
-rw-r--r--. 1 root root unconfined_u:object_r:cert_t:s0 1801 Dec  8 16:46 cert1.pem
-rw-r--r--. 1 root root unconfined_u:object_r:cert_t:s0 1675 Dec  8 16:46 chain1.pem
-rw-r--r--. 1 root root unconfined_u:object_r:cert_t:s0 3476 Dec  8 16:46 fullchain1.pem
-rw-r--r--. 1 root root unconfined_u:object_r:cert_t:s0 1704 Dec  8 16:46 privkey1.pem

/etc/letsencrypt/live/www.example.com:
total 0
lrwxrwxrwx. 1 root root unconfined_u:object_r:cert_t:s0 41 Dec  8 16:46 cert.pem -> ../../archive/www.example.com/cert1.pem
lrwxrwxrwx. 1 root root unconfined_u:object_r:cert_t:s0 42 Dec  8 16:46 chain.pem -> ../../archive/www.example.com/chain1.pem
lrwxrwxrwx. 1 root root unconfined_u:object_r:cert_t:s0 46 Dec  8 16:46 fullchain.pem -> ../../archive/www.example.com/fullchain1.pem
lrwxrwxrwx. 1 root root unconfined_u:object_r:cert_t:s0 44 Dec  8 16:46 privkey.pem -> ../../archive/www.example.com/privkey1.pem


Additional info:
This of course affects rawhide as well 

Of course I could just add the semanage and restorecon in a %post in letsencrypt but it feels like it would be better to have it upstream and not as a local customization.
Comment 1 James Hogarth 2015-12-08 18:31:15 EST
Actually checking sesearch -A -s httpd_t -t etc_t on F23 I think it *can* read etc_t fine as a base type so this bug isn't quite right in it's specific initial thought process...

Rather the certificates should be cert_t to prevent *other* things from reading them incorrectly.

So the title is right and the end goal is the same  ;)
Comment 2 Fedora Admin XMLRPC Client 2016-09-27 11:00:01 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 3 Fedora End Of Life 2016-11-24 09:04:50 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. 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 '23'.

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 23 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 4 Fedora End Of Life 2016-12-20 11:49:14 EST
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 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.
Comment 5 James Hogarth 2017-03-06 07:54:56 EST
Policy to apply this is in this PR:

https://github.com/fedora-selinux/selinux-policy/pull/194
Comment 6 Fedora Update System 2017-03-06 09:56:50 EST
certbot-0.12.0-3.fc24 python-acme-0.12.0-3.fc24 python-certbot-apache-0.12.0-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0b35be64b3
Comment 7 Fedora Update System 2017-03-06 09:59:02 EST
certbot-0.12.0-3.fc25 python-acme-0.12.0-3.fc25 python-certbot-apache-0.12.0-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-e06b5ed81c
Comment 8 Fedora Update System 2017-03-06 10:00:06 EST
certbot-0.12.0-3.el7 python-acme-0.12.0-2.el7 python-certbot-apache-0.12.0-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-7036057408
Comment 9 Fedora Update System 2017-03-06 10:00:18 EST
certbot-0.12.0-3.el7 python-acme-0.12.0-2.el7 python-certbot-apache-0.12.0-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-7036057408
Comment 10 Fedora Update System 2017-03-06 20:50:14 EST
certbot-0.12.0-3.fc25, python-acme-0.12.0-3.fc25, python-certbot-apache-0.12.0-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-e06b5ed81c
Comment 11 Fedora Update System 2017-03-07 00:53:33 EST
certbot-0.12.0-3.el7, python-acme-0.12.0-2.el7, python-certbot-apache-0.12.0-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-7036057408
Comment 12 Fedora Update System 2017-03-07 05:00:36 EST
certbot-0.12.0-4.fc25 python-acme-0.12.0-3.fc25 python-certbot-apache-0.12.0-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2017-e06b5ed81c
Comment 13 Fedora Update System 2017-03-07 05:01:21 EST
certbot-0.12.0-4.el7 python-acme-0.12.0-2.el7 python-certbot-apache-0.12.0-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-7036057408
Comment 14 Fedora Update System 2017-03-07 12:52:56 EST
certbot-0.12.0-3.fc24, python-acme-0.12.0-3.fc24, python-certbot-apache-0.12.0-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-0b35be64b3
Comment 15 Fedora Update System 2017-03-07 14:11:28 EST
certbot-0.12.0-4.fc24 python-acme-0.12.0-3.fc24 python-certbot-apache-0.12.0-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0b35be64b3
Comment 16 Fedora Update System 2017-03-08 09:52:46 EST
certbot-0.12.0-4.fc24, python-acme-0.12.0-3.fc24, python-certbot-apache-0.12.0-1.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-0b35be64b3
Comment 17 Fedora Update System 2017-03-08 09:53:54 EST
certbot-0.12.0-4.fc25, python-acme-0.12.0-3.fc25, python-certbot-apache-0.12.0-1.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-e06b5ed81c
Comment 18 Fedora Update System 2017-03-08 11:17:16 EST
certbot-0.12.0-4.el7, python-acme-0.12.0-2.el7, python-certbot-apache-0.12.0-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2017-7036057408
Comment 19 Fedora Update System 2017-03-16 17:17:51 EDT
certbot-0.12.0-4.fc24, python-acme-0.12.0-3.fc24, python-certbot-apache-0.12.0-1.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.
Comment 20 Fedora Update System 2017-03-16 18:20:55 EDT
certbot-0.12.0-4.fc25, python-acme-0.12.0-3.fc25, python-certbot-apache-0.12.0-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.
Comment 21 Fedora Update System 2017-03-23 16:18:25 EDT
certbot-0.12.0-4.el7, python-acme-0.12.0-2.el7, python-certbot-apache-0.12.0-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.
Comment 22 Jan Kurik 2017-08-15 03:47:46 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 27 development cycle.
Changing version to '27'.

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