disable SELinux

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
kostask
Posts: 4
Joined: Wed Oct 29, 2014 10:51 am

disable SELinux

Post by kostask »

Can you please verify if this is the rule... i.e. that in order for rsyslog to work and start sending messages from a Linux server to NLS we have to disable SELinux?
I am asking this because I've encountered such a case from a Red Hat Linux Server to NLS.
User avatar
lgroschen
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: disable SELinux

Post by lgroschen »

kostask,

The Nagios Log Server installer does disable SElinux on RHEL systems.


/Luke
/Luke
kostask
Posts: 4
Joined: Wed Oct 29, 2014 10:51 am

Re: disable SELinux

Post by kostask »

r we sure that disables SELinux or it just checks and warns in case SELinux for example is in enforcing mode? What I've encountered was that when I first run the "setup_linux.sh" script in the client (i.e. host to be added) the output was [OK]... But no logs were FWding to NLS. Then after several hours of troubleshooting still nothing so I restarted the server. Still nothing! Then I had the idea to rerun the setup_linux.sh script and I've got the output about the SELinux enforcing... I've manually disabled SELinux (setenforce 0) and imitatively the logs started to flow towards NLS! Then I altered the SELinux config file so to permanently disable SELinux in case of restarts.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: disable SELinux

Post by slansing »

Hmm, curious, we'll have to check that out on our end, thank you for the information!
User avatar
eloyd
Cool Title Here
Posts: 2188
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: disable SELinux

Post by eloyd »

I never had this problem running setup-linux multiple times on CentOS hosts.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: disable SELinux

Post by slansing »

Thanks for the input eloyd, I was about to say, this is the first I've heard of it reported. Are you sure you don't have a rogue-security_happy-sysadmin running around?
User avatar
lgroschen
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: disable SELinux

Post by lgroschen »

Here is that function inside the script:

Code: Select all

# Check if SELinux might cause problems, and notify the user if so.
check_for_selinux() {
	if ! which getenforce &> /dev/null; then
		echo "getenforce command not found, assuming SELinux is disabled."
		return
	fi
	SELinux_MODE=$(getenforce 2>/dev/null)

	if [ $SELinux_MODE = "Disabled" ]; then
		echo "SELinux is disabled."
	elif [ $SELinux_MODE = "Permissive." ]; then
		echo "SELinux is permissive."
	elif [ $SELinux_MODE = "Enforcing" ]; then
		cat <<-EOF
SELinux is enforcing. This may prevent $SYSLOG_TYPE from forwarding messages.
If log messages do not reach Log Server from this host, ensure SELInux is
configured to allow $SYSLOG_TYPE forwarding.
		EOF
	fi
}
The Dev who wrote it wanted to ensure that it wouldn't just turn off SELinux in case someone has a current configuration already set. Then it will tell the user after the script run that this part was skipped and you need to edit the file. This could potentially cause problems so we didn't want to force it.
/Luke
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: disable SELinux

Post by Box293 »

lgroschen wrote:Then it will tell the user after the script run that this part was skipped and you need to edit the file.
I think that the message should be make very obvious. Perhaps something like:

######################################
######################################
the message here
######################################
######################################
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
lgroschen
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: disable SELinux

Post by lgroschen »

Troy,

Good call mate. How's this look?:

Code: Select all

==============================! WARNING !====================================
SELinux is enforcing. This may prevent $SYSLOG_TYPE from forwarding messages.
If log messages do not reach Log Server from this host, ensure SELInux is
configured to allow $SYSLOG_TYPE forwarding.
=============================================================================
/Luke
User avatar
eloyd
Cool Title Here
Posts: 2188
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: disable SELinux

Post by eloyd »

I think it should be changed to:

Code: Select all

==============================! CRIKEY !====================================
SELinux is enforcing. This may prevent $SYSLOG_TYPE from forwarding messages.
If log messages do not reach Log Server from this host, ensure SELInux is
configured to allow $SYSLOG_TYPE forwarding.  Then she'll be right!
=============================================================================
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Locked