LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 02-20-2017, 03:17 AM   #1
drillsar
Member
 
Registered: Jan 2017
Posts: 144

Rep: Reputation: Disabled
SELinux help


I have a question I am now in Permissive mode and I get some errors and tells me to do the following:

ausearch -c 'php-fpm' --raw |audit2allow -m my-phpfpm
semodule -I my-phpfpm.pp

I have a couple more errors in audit log

can't I use the command

grep denied /var/log/audit/audit.log mypolicy

or is it better to use individually with semodule

I am a little confused on SELinux and it's purpose. Thanks
 
Old 02-21-2017, 05:28 PM   #2
ericson007
Member
 
Registered: Sep 2004
Location: Japan
Distribution: CentOS 7.1
Posts: 735

Rep: Reputation: 154Reputation: 154
SElinux improves security by not allowing foreign programmes to run and gain access to upper level system resources. This basically makes it more difficult to be hacked because SElinux stops the programme from running as you see in the logs.

If the programme is legitimate and you want it to run, you have to tell SElinux to do it.

Most people say, just turn it off, but that in general i I feel is very bad advice. If that php thing you try running was malware or a rootkit, you would have been in some hot water. So SElinux aims to keep your server safe, and when something does get in, it puts up walls to limit damage done.

So with the commands you passed, you told selinux, hey this is safe, it is ok to run. After you did your audit to allow, you told the engine it is ok to run the files, but the actual files do not have labels allowing it yet. So after doing the above, relable the files with

Code:
restorecon -r /path to where php-fpm is installed
After doing that it should be able to run.

Now, in the case of your setting of permissive mode. SElinux is still running but it is not actively enforcing the rules. That means it will shout and scream in the logs and show where problems are, but it will not stop those programmes from running.

Permissive mode is really good for when you try something new and want to make sure it works after you set it up and investigate possible issues with SElinux.

My recommendation would be to create your allowed list as yu did. Restore the file contexts o they allign with the new configs. Check logstjat those alerts are not occur anew. If those things look fine, seit back to enforcing mode for protecting your system.

Last edited by ericson007; 02-21-2017 at 05:51 PM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
postfix and selinux [selinux updates broke postfix?] rjcroasdale Linux - Server 59 12-03-2019 11:17 PM
Implementing SeLinux on Debian 5 (Lenny) -- can't install "selinux-basics" bashFUL Linux - Security 3 10-17-2011 01:16 AM
SELinux errors, SELinux and wine ziphem Linux - Security 10 01-27-2011 04:15 PM
Selinux-how do i find out what domains have permissions on what type?(selinux policy) vishyc88 Linux - Security 2 11-22-2010 04:27 AM
"../system.h :selinux/selinux.h:no such file or directory" ashmita04 Linux From Scratch 4 02-05-2009 03:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 03:57 PM.

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