# 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
# "" and "/cgi-bin" 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 /usr/pkg/share/examples/xymon/www

Alias   "/usr/pkg/share/examples/xymon/www"
<Directory "/usr/pkg/share/examples/xymon/www">
    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 /cgi-bin/ "/usr/pkg/libexec/xymon/cgi-bin/"
<Directory "/usr/pkg/libexec/xymon/cgi-bin">
    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 /xymon-seccgi/ "/usr/pkg/libexec/xymon/cgi-secure/"
<Directory "/usr/pkg/libexec/xymon/cgi-secure">
    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 /usr/pkg/etc/xymon/xymonpasswd USERNAME
    #	chown apache:apache /usr/pkg/etc/xymon/xymonpasswd
    #	chmod 640 /usr/pkg/etc/xymon/xymonpasswd
    # Add more users / change passwords with: "htpasswd /usr/pkg/etc/xymon/xymonpasswd USERNAME"
    #
    AuthUserFile /usr/pkg/etc/xymon/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 /usr/pkg/etc/xymon/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 ^/bb.html /xymon.html [R=permanent,L]
RewriteRule ^/bb2.html /nongreen.html [R=permanent,L]
RewriteRule ^/bbnk.html /critical.html [R=permanent,L]

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

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

