Sudo limitations in production - any workarounds please?
Posted: Fri Sep 18, 2020 10:33 am
I'm implementing XI for the first time in our production environment, and I'm getting push back from our security team on the sudoers entries that NagiosXI requires. I'm listing them at the bottom of this post, having removed the backwards compatibility entries (we're using a Centos 7 based scripted installation).
So far I've found that the self-monitoring status entries for monitoring engine and graphing engine give faults, that the Core Config utility is not functional because/and restarts from the web utility are not possible. I believe all of that is related to the last entry below (/usr/local/nagiosxi/scripts/manage_services.sh *). Is there anything I can do to work around the sudo access for these and other utilities that are relying on sudo? I tried (at security's suggestion) putting a bash script running simply $@ without permission elevation earlier in the $PATH - this worked for the status issues, but the Core Config utility still fails. If I had to run some sort of job command line as root to apply config, but could offer the option of modifying config through the Core Config utility that would be sufficient for my needs?
The crux of the issue is this; Enterprise security doesn't support the idea of running php with elevated privileges and is uncomfortable with running scripts that are user editable with elevated privileges - especially when they are configured to accept arguments. I've got to admit, I see their point - especially when one of those users is the web daemon owner. I have a meeting scheduled with them Monday afternoon to try and restate my case - and I'm going to try to make any concessions they require to get whatever subset of sudo entries in place that I can - but it would be exceedingly helpful to know what other people are doing to work around these security considerations before I walk into that meeting.
User_Alias NAGIOSXI=nagios
User_Alias NAGIOSXIWEB=apache
NAGIOSXI ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/scripts/components/autodiscover_new.php *
NAGIOSXI ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/scripts/send_to_nls.php *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/components/getprofile.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/upgrade_to_latest.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/change_timezone.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/reset_config_perms.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_ssl_config.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/backup_xi.sh *
NAGIOSXIWEB ALL = NOPASSWD:/etc/init.d/snmptt restart
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/messages
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/httpd/error_log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/mysqld.log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/scripts/components/autodiscover_new.php *
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/components/getprofile.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/repair_databases.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
So far I've found that the self-monitoring status entries for monitoring engine and graphing engine give faults, that the Core Config utility is not functional because/and restarts from the web utility are not possible. I believe all of that is related to the last entry below (/usr/local/nagiosxi/scripts/manage_services.sh *). Is there anything I can do to work around the sudo access for these and other utilities that are relying on sudo? I tried (at security's suggestion) putting a bash script running simply $@ without permission elevation earlier in the $PATH - this worked for the status issues, but the Core Config utility still fails. If I had to run some sort of job command line as root to apply config, but could offer the option of modifying config through the Core Config utility that would be sufficient for my needs?
The crux of the issue is this; Enterprise security doesn't support the idea of running php with elevated privileges and is uncomfortable with running scripts that are user editable with elevated privileges - especially when they are configured to accept arguments. I've got to admit, I see their point - especially when one of those users is the web daemon owner. I have a meeting scheduled with them Monday afternoon to try and restate my case - and I'm going to try to make any concessions they require to get whatever subset of sudo entries in place that I can - but it would be exceedingly helpful to know what other people are doing to work around these security considerations before I walk into that meeting.
User_Alias NAGIOSXI=nagios
User_Alias NAGIOSXIWEB=apache
NAGIOSXI ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/scripts/components/autodiscover_new.php *
NAGIOSXI ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/scripts/send_to_nls.php *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/components/getprofile.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/upgrade_to_latest.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/change_timezone.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/reset_config_perms.sh
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_ssl_config.sh *
NAGIOSXI ALL = NOPASSWD:/usr/local/nagiosxi/scripts/backup_xi.sh *
NAGIOSXIWEB ALL = NOPASSWD:/etc/init.d/snmptt restart
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/messages
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/httpd/error_log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/tail -100 /var/log/mysqld.log
NAGIOSXIWEB ALL = NOPASSWD:/usr/bin/php /usr/local/nagiosxi/scripts/components/autodiscover_new.php *
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/components/getprofile.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/repair_databases.sh
NAGIOSXIWEB ALL = NOPASSWD:/usr/local/nagiosxi/scripts/manage_services.sh *