LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-23-2016, 06:03 PM   #1
Likeless
LQ Newbie
 
Registered: May 2009
Posts: 21

Rep: Reputation: 0
Question SELinux keeps blocking my Apache instance


I am using CentOS 7 and have set up a duplicate Apache instance using the systemd structure there.

I can get both Apaches to run if I use setenforce 0. However, when I setenforce 1, the new Apache won't start.

I did my best to go through all the files I created and I have copied the SELinux type across using "ls -Z" and then chcon to the same as httpd.

The failure message I am getting is:

Code:
[Thu Jun 23 23:51:24.123185 2016] [core:notice] [pid 24944] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Thu Jun 23 23:51:24.124434 2016] [suexec:notice] [pid 24944] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Jun 23 23:51:24.146830 2016] [auth_digest:notice] [pid 24944] AH01757: generating secret for digest authentication ...
[Thu Jun 23 23:51:24.147901 2016] [lbmethod_heartbeat:notice] [pid 24944] AH02282: No slotmem from mod_heartmonitor
[Thu Jun 23 23:51:24.147983 2016] [core:error] [pid 24944] (13)Permission denied: AH00099: could not create /etc/httpd-bobby/httpd-bobby.pid
[Thu Jun 23 23:51:24.148000 2016] [core:error] [pid 24944] AH00100: httpd-bobby: could not log pid to file /etc/httpd-bobby/httpd-bobby.pid
But the location has the httpd context:

Code:
[root~]# ls -Z /etc | grep httpd
drwxr-xr-x. root root system_u:object_r:httpd_config_t:s0 httpd
drwxr-xr-x. root root unconfined_u:object_r:httpd_config_t:s0 httpd-bobby
I know it is SELinux because it works with setenforce 0. What am I doing wrong?
 
Old 06-24-2016, 02:31 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
PID files should be created in /run or /var/run. What does 'grep httpd /var/log/messages /var/log/audit/audit.log | sort -u | audit2allow' return?
 
Old 06-24-2016, 08:58 AM   #3
Likeless
LQ Newbie
 
Registered: May 2009
Posts: 21

Original Poster
Rep: Reputation: 0
Code:
[root~]# grep httpd /var/log/messages /var/log/audit/audit.log | sort -u | audit2allow


#============= httpd_t ==============
allow httpd_t httpd_config_t:dir write;
[root~]#
 
Old 06-24-2016, 09:02 AM   #4
Likeless
LQ Newbie
 
Registered: May 2009
Posts: 21

Original Poster
Rep: Reputation: 0
Okay. I changed it to:

Code:
PidFile /run/httpd-bobby/httpd-bobby.pid
and now it works. Thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is SELinux blocking my FTP uploads? fakefake Linux - Server 26 10-13-2017 08:16 PM
SElinux blocking printer gatliffe CentOS 4 03-11-2016 04:06 PM
selinux is blocking apache and causing a 403 daemon_byte Linux - Security 9 08-15-2011 02:30 PM
SELinux is blocking Webalizer on RHEL5.2 Install BeauSanders Linux - Security 1 10-01-2008 02:17 PM
Help, Selinux blocking append to named.log. mysteron Linux - Security 2 07-15-2008 07:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration