Bug 825357

Summary: SELinux is not enforced when running httpd from the command line
Product: [Fedora] Fedora Reporter: Kevin Clevenger <kcleveng>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 17CC: dwalsh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-27 19:14:07 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:

Description Kevin Clevenger 2012-05-25 19:08:48 UTC
Description of problem:
When starting httpd with systemctl the httpd process runs with "system_u:system_r:httpd_t". When starting httpd from the command line the httpd process runs with "unconfined_u:unconfined_r:unconfined_t".

Version-Release number of selected component (if applicable):
selinux-policy-targeted-3.10.0-125.fc17.noarch
httpd-2.2.22-4.fc17.x86_64

How reproducible:
Run systemctl start httpd.service
Run httpd or httpd -X from the command line

Steps to Reproduce:
1. Run httpd or httpd -X from the command line 
2.
3.
  
Actual results:
httpd runs as unconfined_u:unconfined_r:unconfined_t

Expected results:
httpd runs as unconfined_u:system_r:httpd_t

Additional info:
Running httpd with FollowSymlinks and AllowOverride All. I'm symlinking a php webapp from ~/Sites/site to /var/www/html/site

Comment 1 Miroslav Grepl 2012-05-27 19:14:07 UTC
Yes, this is correct. You should not run httpd without the unit file. If you need this you can use runcon

# runcon -u system_u -r system_r -t initrc_t -- runcon -t httpd_t -- httpd -X