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 1289778 - Let's Encrypt gets wrong selinux context on generated certificates
Summary: Let's Encrypt gets wrong selinux context on generated certificates
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 27
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1377312
TreeView+ depends on / blocked
 
Reported: 2015-12-08 23:22 UTC by James Hogarth
Modified: 2017-09-11 14:39 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-09-11 14:39:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description James Hogarth 2015-12-08 23:22:18 UTC
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 \
--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 23:31:15 UTC
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 15:00:01 UTC
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 14:04:50 UTC
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 16:49:14 UTC
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 12:54:56 UTC
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 14:56:50 UTC
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 14:59:02 UTC
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 15:00:06 UTC
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 15:00:18 UTC
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-07 01:50:14 UTC
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 05:53:33 UTC
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 10:00:36 UTC
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 10:01:21 UTC
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 17:52:56 UTC
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 19:11:28 UTC
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 14:52:46 UTC
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 14:53:54 UTC
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 16:17:16 UTC
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 21:17:51 UTC
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 22:20:55 UTC
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 20:18:25 UTC
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 07:47:46 UTC
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.