{"id":982,"date":"2011-04-24T21:02:07","date_gmt":"2011-04-24T13:02:07","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=982"},"modified":"2023-04-28T09:50:27","modified_gmt":"2023-04-28T09:50:27","slug":"how-to-configure-ldap-authentication-for-nagios-on-centos-5-5","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-configure-ldap-authentication-for-nagios-on-centos-5-5\/","title":{"rendered":"How to Configure LDAP Authentication for Nagios on CentOS 5.5"},"content":{"rendered":"<p>This article assume that you already installed the nagios server on LAMP CentOS server and also installed 389 directory server. On the previous tutorial, the user that allowed to manage nagios is nagiosadmin which has been created using htpasswd. In this article, i will show you on how configure LDAP authentication for Nagios on CentOS 5.5.<\/p>\n<p><strong>Prerequisites<\/strong><br \/>\n<a href=\"https:\/\/webhostinggeeks.com\/howto\/how-to-install-apache-httpd-web-server-on-linux\/\" rel=\"nofollow noopener\" target=\"_blank\">How to Install Apache Httpd Web Server on Linux<\/a>rel=&#8221;nofollow&#8221;<br \/>\n<a href=\"https:\/\/webhostinggeeks.com\/howto\/how-to-install-389-directory-server-on-centosrhel\/\" target=\"_blank\" rel=\"noopener\">How to Install 389 Directory Server on CentOS\/RHEL<\/a><\/p>\n<p>1. Configure nagios.conf and change it to your LDAP environment.\u00a0Assume the following info is valid on LDAP server:<\/p>\n<ol>\n<pre class=\"code\">\nServer ip = 192.168.2.5\nSuffix = dc=intranet, dc=local\nLDAP user : user1 ( most of the time, this user is sytem administrator)\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n[root@server ~]# vi \/etc\/httpd\/conf.d\/nagios.conf\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\nScriptAlias \/nagios\/cgi-bin &quot;\/usr\/lib\/nagios\/cgi&quot;\n\n&lt;Directory &quot;\/usr\/lib\/nagios\/cgi&quot;&gt;\n   Options ExecCGI\n   AllowOverride None\n   Order allow,deny\n   Allow from all\n   AuthBasicProvider ldap\n   AuthType Basic\n   AuthzLDAPAuthoritative on\n   AuthName &quot; LDAP Authentication for Nagios Monitoring&quot;\n   AuthLDAPURL &quot;ldap:\/\/192.168.2.5:389\/DC=intranet,DC=local?uid?sub?(objectClass=*)&quot; NONE\n   Require user\n&lt;\/Directory&gt;\n\nAlias \/nagios &quot;\/usr\/share\/nagios&quot;\n\n&lt;Directory &quot;\/usr\/share\/nagios&quot;&gt;\n   Options None\n   AllowOverride None\n   Order allow,deny\n   Allow from all\n   AuthBasicProvider ldap\n   AuthType Basic\n   AuthzLDAPAuthoritative on\n   AuthName &quot; LDAP Authentication for Nagios Monitoring&quot;\n   AuthLDAPURL &quot;ldap:\/\/192.168.2.5:389\/DC=intranet,DC=local?uid?sub?(objectClass=*)&quot; NONE\n   Require user\n&lt;\/Directory&gt;\n<\/pre>\n<\/ol>\n<p>2. Replace all of the &#8220;nagiosadmin&#8221; entries with &#8220;*&#8221; in \/etc\/nagios\/cgi.cfg. This is to prevent the error message in CGI authentication.<\/p>\n<ol>\n<pre class=\"code\">\nIt appears as though you do not have permission to view information for any of the hosts you requested...\n\nIf you believe this is an error, check the HTTP server authentication requirements for accessing this CGI\nand check the authorization options in your CGI configuration file.\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n\n[root@server ~]# grep \"nagiosadmin\" \/etc\/nagios\/cgi.cfg | grep -v \"#\"\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\nauthorized_for_system_information=nagiosadmin\nauthorized_for_configuration_information=nagiosadmin\nauthorized_for_system_commands=nagiosadmin\nauthorized_for_all_services=nagiosadmin\nauthorized_for_all_hosts=nagiosadmin\nauthorized_for_all_service_commands=nagiosadmin\nauthorized_for_all_host_commands=nagiosadmin\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n[root@server ~]# vi \/etc\/httpd\/conf.d\/nagios.conf\n<\/pre>\n<\/ol>\n<p>Replace nagiosadmin to * as below:<\/p>\n<ol>\n<pre class=\"code\">\nauthorized_for_system_information=*\nauthorized_for_configuration_information=*\nauthorized_for_system_commands=*\nauthorized_for_all_services=*\nauthorized_for_all_hosts=*\nauthorized_for_all_service_commands=*\nauthorized_for_all_host_commands=*\n<\/pre>\n<\/ol>\n<ol>\n<pre class=\"code\">\n[root@server ~]# grep \"*\" \/etc\/nagios\/cgi.cfg | grep -v \"#\"\nauthorized_for_system_information=*\nauthorized_for_configuration_information=*\nauthorized_for_system_commands=*\nauthorized_for_all_services=*\nauthorized_for_all_hosts=*\nauthorized_for_all_service_commands=*\nauthorized_for_all_host_commands=*\n<\/pre>\n<\/ol>\n<p>3. Restart the nagios service<\/p>\n<ol>\n<pre class=\"code\">\n[root@server ~]# \/etc\/init.d\/nagios restart\nStopping nagios:                                           [  OK  ]\nStarting nagios:                                           [  OK  ]\n<\/pre>\n<\/ol>\n<p>4. Restart apache server<\/p>\n<ol>\n<pre class=\"code\">[root@server ~]# \/etc\/init.d\/httpd restart\nStopping httpd:                                            [  OK  ]\nStarting httpd:                                            [  OK  ]\n<\/pre>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This article assume that you already installed the nagios server on LAMP CentOS server and also installed 389 directory server. On the previous tutorial, the user that allowed to manage&#8230;<\/p>\n","protected":false},"author":6,"featured_media":961,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1102,1065],"tags":[1246,1536,1591],"class_list":["post-982","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-389-directory-server","category-system-administration","tag-centos-5-5","tag-linux","tag-nagios"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/982","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=982"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/982\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/961"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}