# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file.  Customize the paths, etc. as
# needed to fit your system.

ScriptAlias /nagios/cgi-bin/ "/usr/lib/nagios/cgi-bin/"

<Directory "/usr/lib/nagios/cgi-bin/">
#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None
   Order <%= node['nagios']['web']['Order'] %>
<% node['nagios']['web']['Deny'].each do |from_where| -%>
   Deny <%= from_where %>
<% end -%>
<% node['nagios']['web']['Allow'].each do |from_where| -%>
   Allow <%= from_where %>
<% end -%>

   AuthName "Nagios Access"
<%
case node['nagios']['web']['AuthType']
  when 'Basic'
-%>
   AuthType Basic
   AuthUserFile <%= node['nagios']['web']['mod_auth_basic']['AuthUserFile'] %>
   Require valid-user
<%
  when 'Kerberos'
-%>
   AuthType Kerberos
   KrbAuthRealms <%= node['nagios']['web']['mod_auth_kerb']['KrbAuthRealms'] %>
   KrbServiceName <%= node['nagios']['web']['mod_auth_kerb']['KrbServiceName'] %>
   Krb5Keytab <%= node['nagios']['web']['mod_auth_kerb']['Krb5Keytab'] %>
   KrbMethodNegotiate <%= node['nagios']['web']['mod_auth_kerb']['KrbMethodNegotiate'] %>
   KrbMethodK5Passwd <%= node['nagios']['web']['mod_auth_kerb']['KrbMethodK5Passwd'] %>
   Require valid-user
<% end -%>
</Directory>

Alias /nagios "/usr/share/nagios/html"

<Directory "/usr/share/nagios/html">
#  SSLRequireSSL
   Options None
   AllowOverride None
   Order <%= node['nagios']['web']['Order'] %>
<% node['nagios']['web']['Deny'].each do |from_where| -%>
   Deny <%= from_where %>
<% end -%>
<% node['nagios']['web']['Allow'].each do |from_where| -%>
   Allow <%= from_where %>
<% end -%>

   AuthName "Nagios Access"
<%
case node['nagios']['web']['AuthType']
  when 'Basic'
-%>
   AuthType Basic
   AuthUserFile <%= node['nagios']['web']['mod_auth_basic']['AuthUserFile'] %>
   Require valid-user
<%
  when 'Kerberos'
-%>
   AuthType Kerberos
   KrbAuthRealms <%= node['nagios']['web']['mod_auth_kerb']['KrbAuthRealms'] %>
   KrbServiceName <%= node['nagios']['web']['mod_auth_kerb']['KrbServiceName'] %>
   Krb5Keytab <%= node['nagios']['web']['mod_auth_kerb']['Krb5Keytab'] %>
   KrbMethodNegotiate <%= node['nagios']['web']['mod_auth_kerb']['KrbMethodNegotiate'] %>
   KrbMethodK5Passwd <%= node['nagios']['web']['mod_auth_kerb']['KrbMethodK5Passwd'] %>
   Require valid-user
<% end -%>
</Directory>

