Bug 1267913 - SELinux prevents service httpd restart when mod_ssl is installed
SELinux prevents service httpd restart when mod_ssl is installed
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
25
Unspecified Unspecified
high Severity high
: ---
: ---
Assigned To: Lukas Vrabec
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-01 07:42 EDT by Alexander Todorov
Modified: 2017-12-12 06:12 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-12-12 06:12:39 EST
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 Alexander Todorov 2015-10-01 07:42:41 EDT
Description of problem:

On a Rawhide system I had httpd running. Then I installed mod_ssl and did:

# service httpd restart which failed with:

Redirecting to /bin/systemctl restart  httpd.service
Failed to restart httpd.service: Access denied


journalctl -f gave me:

Oct 01 07:37:08 hp-bl480c-01.rhts.eng.bos.redhat[1994482.719885] audit: type=1107 audit(1443699428.885:3542): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=0 uid=0 gid=0 path="/usr/lib/systemd/system/httpd.service" cmdline="/bin/systemctl restart httpd.service" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=system_u:object_r:httpd_unit_file_t:s0 tclass=service
[1994482.719885]  exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
.com polkitd[941]: Registered Authentication Agent for unix-process:14874:199448266 (system bus name :1.407 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale bg_BG.utf8)
Oct 01 07:37:08 hp-bl480c-01.rhts.eng.bos.redhat.com audit[1]: USER_AVC pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=0 uid=0 gid=0 path="/usr/lib/systemd/system/httpd.service" cmdline="/bin/systemctl restart httpd.service" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=system_u:object_r:httpd_unit_file_t:s0 tclass=service
                                                                exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Oct 01 07:37:08 hp-bl480c-01.rhts.eng.bos.redhat.com kernel: audit: type=1107 audit(1443699428.885:3542): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc:  denied  { start } for auid=0 uid=0 gid=0 path="/usr/lib/systemd/system/httpd.service" cmdline="/bin/systemctl restart httpd.service" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=system_u:object_r:httpd_unit_file_t:s0 tclass=service
                                                              exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
Oct 01 07:37:08 hp-bl480c-01.rhts.eng.bos.redhat.com polkitd[941]: Unregistered Authentication Agent for unix-process:14874:199448266 (system bus name :1.407, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale bg_BG.utf8) (disconnected from bus)

Version-Release number of selected component (if applicable):
httpd-2.4.16-1.fc24.x86_64


Disabling selinux allowed me to restart httpd. Both http and https are working.
Comment 1 Jan Kurik 2016-02-24 10:46:22 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
Comment 2 Joe Orton 2016-03-18 07:09:05 EDT
Is this still reproducible?
Comment 3 Fedora Admin XMLRPC Client 2016-09-27 11:10:40 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 4 Ronald L Humble 2016-12-01 09:20:14 EST
I reported this issue in the past. Upgrade of Fedora 23 to fc25 via dnf plugin. Still reproducible. New for me is failure of adjustment to local selinux policy.

Snippets from journalctl -xe:
failed to retrieve rpm info for /var/log/ssl_error_log
SELinux is preventing httpd from open access on the file /var/log/ssl_error_log
Plugin catchall (100. confidence) suggests


Running: ausearch -c 'httpd' --raw | audit2allow -M my-httpd
  succeeds.

# semodule -i my-httpd.pp (Fails)
libsemanage.semanage_direct_get_module_info: Unable to read BackupPC module lang ext file.
libsemanage.semanage_direct_get_module_info: Unable to read BackupPC module lang ext file.
libsemanage.semanage_direct_get_module_info: Unable to read BackupPC module lang ext file.
semodule:  Failed on my-httpd.pp!

Disabling selinux allows httpd to start.
Comment 5 Lukas Vrabec 2016-12-08 07:34:32 EST
Could run:
# restorecon -Rv / 

Please, let me know if it fixed your issue.
Thanks.
Comment 6 Ronald L Humble 2016-12-08 09:26:09 EST
Had done a restorecon on /var earlier. restorecon -Rv /
 and an attempted start of httpd failed. Behavior is unchanged from Comment 4. 
semanage fcontext -l
/var/log/ssl_access_log                            all files          system_u:object_r:var_log_t:s0 
/var/log/ssl_error_log                             all files          system_u:object_r:var_log_t:s0 

# ls -alZ /var/log/ssl*
-rw-------. 1 root root system_u:object_r:var_log_t:s0         140 Dec  7 06:36 /var/log/ssl_access_log
-rw-r--r--. 1 root root system_u:object_r:var_log_t:s0     1380011 Dec  5 07:19 /var/log/ssl_error_log
Comment 7 Ronald L Humble 2017-01-26 11:14:37 EST
Regarding Comment #4, off topic, but perhaps useful. Appears /.autorelabel and/or adding autorelabel to the GRUB kernel line fails for me. I had two directories (BackupPC, mypol) in /var/lib/selinux/targeted/active/modules/400/ which contained zero byte files: cil hll lang_ext. I deleted these two directories. SElinux relabel works and I am able to create a local policy for this bug as directed by sealert.
Comment 8 Fedora End Of Life 2017-11-16 13:44:59 EST
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.
Comment 9 Fedora End Of Life 2017-12-12 06:12:39 EST
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.

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