# This file is for Apache 1.3.x and Apache 2.x
#
# Add this to your Apache configuration, it makes
# the Xymon webpages and cgi-scripts available in the
# "@XYMONHOSTURL@" and "@XYMONCGIURL@" URLs.


# NB: The "Alias" line below must NOT be used if you have
#     the Xymon webfiles as the root URL. In that case,
#     you should instead set this:
#
#          DocumentRoot @INSTALLWWWDIR@

Alias @XYMONHOSTURL@  "@INSTALLWWWDIR@"
<Directory "@INSTALLWWWDIR@">
    Options Indexes FollowSymLinks Includes MultiViews
    <IfModule mod_authz_core.c>
        # Apache 2.4+
        Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Allow from all
    </IfModule>
</Directory>

ScriptAlias @XYMONCGIURL@/ "@CGIDIR@/"
<Directory "@CGIDIR@">
    AllowOverride None
    Options ExecCGI Includes
    <IfModule mod_authz_core.c>
        # Apache 2.4+
        Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Allow from all
    </IfModule>
</Directory>

ScriptAlias @SECUREXYMONCGIURL@/ "@SECURECGIDIR@/"
<Directory "@SECURECGIDIR@">
    AllowOverride None
    Options ExecCGI Includes
    <IfModule mod_authz_core.c>
        # Apache 2.4+
        Require all granted
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Allow from all
    </IfModule>

    # Password file where users with access to these scripts are kept.
    # Although expected in $XYMONHOME/etc/ by the useradm and chpasswd
    # scripts, files here can be read with the "config" message type, 
    # which allows status-privileged clients to read arbitrary regular files 
    # from the directory. 
    # 
    # This file should be owned and readable only by the apache server user,
    # and ideally merely a symlink to a location outside of $XYMONHOME/etc/
    # 
    # Create it with:
    #	htpasswd -c @INSTALLETCDIR@/xymonpasswd USERNAME
    #	chown apache:apache @INSTALLETCDIR@/xymonpasswd
    #	chmod 640 @INSTALLETCDIR@/xymonpasswd
    # Add more users / change passwords with: "htpasswd @INSTALLETCDIR@/xymonpasswd USERNAME"
    #
    AuthUserFile @INSTALLETCDIR@/xymonpasswd

    # You can also use a group file to restrict admin access to members of a
    # group, instead of anyone who is logged in. In that case you must setup
    # the "xymongroups" file, and change the "Require" settings to require
    # a specific group membership. See the Apache docs for more details.
    # You may also need to explicitly load the mod_authz_groupfile module
    # AuthGroupFile @INSTALLETCDIR@/xymongroups

    AuthType Basic
    AuthName "Xymon Administration"
    <RequireAll>
      # "valid-user" restricts access to anyone who is logged in.
      Require valid-user

      # "group admins" restricts access to users who have logged in, AND
      # are members of the "admins" group in xymongroups.
      # Require group admins
    </RequireAll>
</Directory>

# Rewrite-rules for migrating from the URL's used in Hobbit
RewriteEngine On

RewriteRule ^@XYMONHOSTURL@/bb.html @XYMONHOSTURL@/xymon.html [R=permanent,L]
RewriteRule ^@XYMONHOSTURL@/bb2.html @XYMONHOSTURL@/nongreen.html [R=permanent,L]
RewriteRule ^@XYMONHOSTURL@/bbnk.html @XYMONHOSTURL@/critical.html [R=permanent,L]

RewriteRule ^@XYMONCGIURL@/bb-hist.sh @XYMONCGIURL@/history.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/bb-eventlog.sh @XYMONCGIURL@/eventlog.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/bb-rep.sh @XYMONCGIURL@/report.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/bb-replog.sh @XYMONCGIURL@/reportlog.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/bb-snapshot.sh @XYMONCGIURL@/snapshot.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/bb-findhost.sh @XYMONCGIURL@/findhost.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/bb-csvinfo.sh @XYMONCGIURL@/csvinfo.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbitcolumn.sh @XYMONCGIURL@/columndoc.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/bb-datepage.sh @XYMONCGIURL@/datepage.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbitgraph.sh @XYMONCGIURL@/showgraph.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/bb-hostsvc.sh @XYMONCGIURL@/svcstatus.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/bb-histlog.sh @XYMONCGIURL@/historylog.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-confreport.sh @XYMONCGIURL@/confreport.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-confreport-critical.sh @XYMONCGIURL@/confreport-critical.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-nkview.sh @XYMONCGIURL@/criticalview.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-certreport.sh @XYMONCGIURL@/certreport.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-nongreen.sh @XYMONCGIURL@/nongreen.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-hostgraphs.sh @XYMONCGIURL@/hostgraphs.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-ghosts.sh @XYMONCGIURL@/ghostlist.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-notifylog.sh @XYMONCGIURL@/notifications.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-hostlist.sh @XYMONCGIURL@/hostlist.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-perfdata.sh @XYMONCGIURL@/perfdata.sh [R=permanent,L]
RewriteRule ^@XYMONCGIURL@/hobbit-topchanges.sh @XYMONCGIURL@/topchanges.sh [R=permanent,L]

RewriteRule ^@SECUREXYMONCGIURL@/bb-ack.sh @SECUREXYMONCGIURL@/acknowledge.sh [R=permanent,L]
RewriteRule ^@SECUREXYMONCGIURL@/hobbit-enadis.sh @SECUREXYMONCGIURL@/enadis.sh [R=permanent,L]
RewriteRule ^@SECUREXYMONCGIURL@/hobbit-nkedit.sh @SECUREXYMONCGIURL@/criticaleditor.sh [R=permanent,L]
RewriteRule ^@SECUREXYMONCGIURL@/hobbit-ackinfo.sh @SECUREXYMONCGIURL@/ackinfo.sh [R=permanent,L]
RewriteRule ^@SECUREXYMONCGIURL@/hobbit-useradm.sh @SECUREXYMONCGIURL@/useradm.sh [R=permanent,L]

