# apache configuration for icinga

ScriptAlias /cgi-bin/icinga2-classicui /usr/lib/cgi-bin/icinga2-classicui

# Where the stylesheets (config files) reside
Alias /icinga2-classicui/stylesheets /etc/icinga2/classicui/stylesheets

# Where the HTML pages live
Alias /icinga2-classicui /usr/share/icinga2/classicui

<LocationMatch "^/cgi-bin/icinga2-classicui">
    SetEnv ICINGA_CGI_CONFIG /etc/icinga2/classicui/cgi.cfg
</LocationMatch>

<DirectoryMatch "^(?:/usr/share/icinga2/classicui/htdocs|/usr/lib/cgi-bin/icinga2-classicui|/etc/icinga2/classicui/stylesheets)/">
        Options FollowSymLinks

        DirectoryIndex index.html

        AllowOverride AuthConfig
        Order Allow,Deny
        Allow From All

AuthType Basic
{% if icinga_ldap_auth == "true" %} 
AuthBasicProvider ldap file
AuthLDAPURL "{{icinga_ldap_url}}"
AuthLDAPBindDN "{{icinga_ldap_user}}"
AuthLDAPBindPassword {{icinga_ldap_pass}}
Require {{icinga_ldap_require}}
{% else %}
AuthBasicProvider file
Require valid-user
{% endif %}
AuthName "Icinga Access"
AuthUserFile /etc/icinga2/classicui/htpasswd.users
</DirectoryMatch>

