How to configure htdigest in nagios server
As a security point of view I always prefer to go with htdigest rather than htpasswd method.The reason is htpaswd uses cleartext username and password whereas htdigest uses encryption method.
If you have already read my post “How to configure Nagios 3.4.4 in CentOS” there I use the htpasswd.
But suprisingly there is one more thing htpasswd is more popular than htdigest.
Ok lets start the configuration.
Step 1: create htdigest password file with user name nagiosadmin
(Replace the nagiosadmin username with your nagios admin user which you are using for accesing the nagios dashboard,same thing apply to nagios read only users).
htdigest -c /etc/nagios/.htdigestpasswd “Restricted Nagios Access Zone” nagiosadmin
chmod 600 /etc/nagios/.htdigestpasswd
Step 2: Now configure the /etc/httpd/conf.d/nagios.conf file.
And the edit the given below line
AuthType Digest
AuthUserFile /etc/nagios/.htdigestpasswd
AuthName “Restricted Nagios Access Zone”
require valid-user
Below is my nagios.conf configuration file for reference.
ScriptAlias /nagios/cgi-bin/ /usr/lib64/nagios/cgi-bin/
<Directory /usr/lib64/nagios/cgi-bin/>
Options ExecCGI
order deny,allow
deny from all
allow from 127.0.0.1
AuthType Digest
AuthUserFile /etc/nagios/.htdigestpasswd
AuthName “Restricted Nagios Access Zone”
require valid-user
</Directory>Alias /nagios/ /usr/share/nagios/html/
<Directory /usr/share/nagios/html/>
Options None
order deny,allow
deny from all
allow from 127.0.0.1
AuthType Digest
AuthUserFile /etc/nagios/.htdigestpasswd
AuthName “Restricted Nagios Access Zone”
require valid-user
</Directory>