Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SELinux module draft #1452

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added SELinux module draft #1452

wants to merge 2 commits into from

Conversation

stdevel
Copy link

@stdevel stdevel commented May 27, 2016

Hey folks,
great that you're offering a Nagios / Icinga plugin for fail2ban.

On CentOS I had some problems getting this plugin running in combination with SELinux in Enforcing mode. There was no pre-existing SELinux module for the check_fail2ban utility - so I created one. Works like a charm in my lab.
Maybe this can help somebody out there - took some time for troubleshooting and fixing.

Christian Stankowic added 2 commits May 28, 2016 00:18
Added SELinux module draft - to use the plugin in Enforcing mode
Fixed markup
@coveralls
Copy link

coveralls commented May 27, 2016

Coverage Status

Coverage remained the same at 91.645% when pulling c7ff13a on stdevel:master into e01cd8a on fail2ban:master.

@codecov-io
Copy link

codecov-io commented May 27, 2016

Current coverage is 89.36%

Merging #1452 into master will not change coverage

  1. 3 files (not in diff) in fail2ban were modified. more
@@             master      #1452   diff @@
==========================================
  Files            68         68          
  Lines          7217       7217          
  Methods           0          0          
  Messages          0          0          
  Branches        997        997          
==========================================
  Hits           6449       6449          
  Misses          601        601          
  Partials        167        167          

Powered by Codecov. Last updated by e01cd8a...c7ff13a

}

#============= nrpe_t ==============
allow nrpe_t admin_home_t:file execute;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

admin_home_t is the label for /root , does it really require access to /root ? isn't this because the script was copied to /root where it should really not be there?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I missed restoring the SELinux file context after moving the script to the Nagios plugins directory.. 😞
Removing the admin_home_t lines and restoring the context did the trick - now, the TE looks like this:

module nrpe_fail2ban 1.0;

require {
    type nrpe_t;
    class unix_dgram_socket sendto;
    class file execute;
    class file getattr;
    class file { read getattr open };
    class file execute_no_trans;
    type fail2ban_client_exec_t;
    class file { ioctl getattr };
    class file { read open };
    class file execute_no_trans;
    type fail2ban_var_run_t;
    class sock_file write;
    class file ioctl;
    type fail2ban_t;
    class unix_stream_socket connectto;
}

#============= nrpe_t ==============
allow nrpe_t self:unix_dgram_socket sendto;
allow nrpe_t fail2ban_client_exec_t:file getattr;
allow nrpe_t fail2ban_client_exec_t:file execute;
allow nrpe_t fail2ban_client_exec_t:file { read open };
allow nrpe_t fail2ban_client_exec_t:file execute_no_trans;
allow nrpe_t fail2ban_client_exec_t:file ioctl;
allow nrpe_t fail2ban_var_run_t:sock_file write;
allow nrpe_t fail2ban_t:unix_stream_socket connectto;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think your policy could just be:

module nrpe_fail2ban 1.0;

fail2ban_run_client(nrpe_t)

and should be added to upstream tresys/repolicy-contrib/fail2ban.te

@vinzent
Copy link

vinzent commented May 28, 2016

maybe the finaly fix could even be added to upstream (https://github.com/TresysTechnology/refpolicy-contrib/blob/master/fail2ban.te) directly

@sebres sebres force-pushed the master branch 5 times, most recently from fe8a9d2 to 9d77fb2 Compare November 3, 2020 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants