<?xml version='1.0' encoding='iso-8859-1'?>

<!--
 ! Default/example admind configuration file
 !
 ! You will *have* to modify this to match your system.
 !
 !-->
<config>

  <!--
   ! One such section exists for each admind instance.
   !-->
  <admind key='bluebox'>
    <!-- Insert a full-fledged <net> section here if you need specialized
     ! settings -->
    <net idref='default'/>

    <!-- Insert a full-fledged <log> section here if you need specialized
     ! settings -->
    <log idref='default'/>
  </admind> <!-- bluebox -->


  <admind key='mirror'>
    <net>
      <!-- Important Note: If an admind instance should listen on localhost
	   in addition to a "public" IP, *always* put the public IP first
	   in the list. This is because other instances simply connect to
	   the first entry in the list, which obviously won't work if it's
	   localhost. -->
      <listen host='127.0.0.1' port='4712'/>

      <accept-from>192.168.10.3</accept-from>
      <accept-from>localhost</accept-from>
    </net>

    <log idref='default'/>
  </admind> <!-- mirror -->


  <!--
   ! Machine specific resources shared by the modules
   !-->
  <resources>
    <!--
     ! Paths of commonly used resources. Relative paths are relative to
     ! $INSTALL_DIR
     !-->
    <paths>
      <templates.root>
        <path>data/templates</path>
      </templates.root>

      <project>
        <on-hosts sticky='true'>loke</on-hosts>

        <home.base user='root' group='root' perm='drwxr-xr-x'>
          <path>/srv/project</path>
        </home.base>
        <www.base  user='root' group='root' perm='drwxr-xr-x'>
          <path>/srv/www</path>
        </www.base>
        <ftp.base  user='root' group='root' perm='drwxr-xr-x'>
          <path>/srv/ftp</path>
        </ftp.base>
        <tmp.base  user='root' group='root' perm='drwxr-xr-x'>
          <path>/srv/tmp</path>
        </tmp.base>
        <user.base user='root' group='root' perm='drwxr-xr-x'>
          <path>/srv/user</path>
        </user.base>
      </project>
    </paths>


    <!--
     ! Apache instances
     !
     ! IMPORTANT: All apache instances have to be managed by the same admind instance (i.e. have
     !            to have the same <on-hosts> entry). This restriction might be lifted in the
     !            future, but for now it's good enough.
     !-->
    <apache key='general.plain'>
      <on-hosts sticky='true'>loke</on-hosts>
      <dnstarget>general.plain</dnstarget>
      <vhost-cfgfiles user='root' group='root' perm='0644'>
        <path>/etc/apache2/vhosts-autogen/{HOSTNAME}</path>
      </vhost-cfgfiles>
      <reload-command user='root'>
        <cmdline>/etc/init.d/apache2 reload</cmdline>
      </reload-command>
    </apache> <!-- general.plain -->

    <apache key='general.php'>
      <on-hosts sticky='true'>loke</on-hosts>
      <dnstarget>general.php</dnstarget>
      <vhost-cfgfiles user='root' group='root' perm='0644'>
        <path>/etc/apache/vhosts-autogen/{HOSTNAME}</path>
      </vhost-cfgfiles>
      <reload-command user='root'>
        <cmdline>/etc/init.d/apache reload</cmdline>
      </reload-command>
    </apache> <!-- general.php -->


    <!--
     ! Virtual Host Types
     !-->
    <vhost-type key='forward'>
      <on-apache>general.plain</on-apache>
      <template>vhost_forward</template>
    </vhost-type>
    <vhost-type key='plain'>
      <on-apache>general.plain</on-apache>
      <template>vhost_plain</template>
    </vhost-type>
    <vhost-type key='php'>
      <on-apache>general.php</on-apache>
      <template>vhost_php</template>
    </vhost-type>
    <vhost-type key='jsp'>
      <on-apache>general.plain</on-apache>
      <template>vhost_jsp</template>
    </vhost-type>
  </resources>



  <globaldefs>
    <log id='default'>
      <!--
       ! Multiple targets can be specified.
       ! "kind" may be one of "file" ('dest' specifies filename),
       ! "syslog" ('dest' specifies facility), 
       ! "email" ('dest' specifies mail facility),
       ! "stdout" and "stderr".
       ! "format" may be one of "plain" and "xml"
       !
       ! A file name in the "dest" attribute may be parameterized
       ! (printf-style):
       !  * '%d' => current date (YYYY-MM-DD),
       !  * '%p' => current process id,
       !  * '%h' => hostname,
       !  * '%i' => instance ID,
       !  * '%t' => current time (%H:%M:%S)
       !-->
      <target kind='file' dest='/var/log/admind/%i-general' format='line'
              errors='true' warnings='true' notices='true'/>
      <target kind='file' dest='/var/log/admind/%i-bugs.%d.%t.xml' format='xml'
              bug='true'/>
      <access kind='file' dest='/var/log/admind/access'/>
    </log>

    <net id='default'>
      <listen host='127.0.0.1' port='4711'/>

      <accept-from>localhost</accept-from>
      <accept-from>127.0.0.1/255.255.255.240</accept-from>
      <accept-from>192.168.10.1/24</accept-from>
    </net>


    <!--
     ! This allows to override access permissions to certain controllers and/or
     ! actions. If the action= parameter is omitted, the rule matches
     ! all actions in the given controller. Last match wins(!). If nothing matched,
     ! authentication proceeds as usual (i.e. nothing is overridden).
     !-->
    <command-acls>
      <entry kind='allow' user='mirrortrigger' controlelr='mirror' action='triggerupdate'/>
      <!--
        <entry kind='deny' user='badadmin' controller='meta'/>
        -->
    </command-acls>


    <!--
     ! The ID of the admind instance serving as "master", i.e. accepting
     ! client connections, handling timed execution etc
     !-->
    <master-instance>bluebox</master-instance>

	<!--Name of the group that gets unrestricted access to dsadmin -->
    <group.superuser>staff</group.superuser>

    <!--
     ! Email settings.
     ! This defines a global "from" address and a number of "facilities",
     ! each defining one or more destination addresses ("to"), zero or
     ! more custom headers ("header") and optionally one subject prefix.
     ! Facilities are referenced via their keys - referential integrity
     ! is so far *not* checked before actual use, so be careful.
     !-->
    <mail>
      <from>root@somewhere.org</from>
      
      <facility key="admin">
        <to>root@somewhere.org</to>
        <header key='X-Spam-Status'>No</header>
        <subject-prefix>[Dsadmin] </subject-prefix>
      </facility>
      
      <facility key="mirror">
        <to>mirror@somewhere.org</to>
        <to>hqstaff@somewhere.org</to>
        <header key='X-Spam-Status'>No</header>
        <header key='X-No-Archive'>Yes</header>
        <subject-prefix>[Dsadmin-Mirror] </subject-prefix>
      </facility>
    </mail>
    
    <!--
     ! A String used to "authenticate" admind instances against each other
     ! (when forwarding requests etc). Can be anything - the longer and the
     ! more cryptic the better.
     !-->
    <internal-secret>
      In Soviet Russia, Slashdot readers serve the /§(§%+§$%ingly hot grits
      with Natalie Portman &amp; make enough profit with it to build a
      Beowulf cluster of iPods.
    </internal-secret>
  </globaldefs>


  <!--
   ! Configuration sections for all modules (independent of the admind
   ! instance they're active in)
   !-->
  <modules>

    <!--
     ! The "Meta" module is automatically present in the master instance
     ! (and only there). It handles things that affect the system as a
     ! whole, e.g. startup initialization, global shutdown, global status
     ! info gathering etc.
     !-->
    <meta>
      <!-- Requests that should be executed on startup of the system
       ! (or, more accurately: on startup of the master instance).
       ! Note: These requests are handled in the background, and the system
       ! does accept other requests in the meantime! -->
      <startup-request controller="mirror" action="scheduleall"/>
      <startup-request controller="dns"    action="init"/>

      <!-- The command to use for syncing dsadmin instances from the central
       ! repository. This is executed my *all* admind instances, including
       ! the master. Each instance uses the command with key == instanceid or,
       ! if that doesn't exist, the one with key == "default". -->
      <sync-command key='default' user='root'>
        <cmdline>/usr/sbin/cfagent -q --inform --file manual/cf.dsadmin_sync</cmdline>
      </sync-command>

      <sync-command key='sunsite' user='root'>
        <cmdline>/pack/cfengine/sbin/cfagent -q --inform --file /pack/cfengine/etc/manual/cf.dsadmin_sync</cmdline>
      </sync-command>

      <!-- Whether to restart all instances affter a sync. True values are
       ! "true", "yes", "1" (case insensitive), everything else is
       ! interpreted as false. -->
      <restart-after-sync>true</restart-after-sync>
    </meta>


    <!--
     ! Project database
     !-->
    <projectdb>
      <db>
        <host>server</host>
        <dbname>dotsrc</dbname>
        <type>mysql</type>
        <user>dotsrc</user>
        <passwd>secret</passwd>
      </db>

      <user.allowed_shells>
        <value>/bin/sh</value>
        <value>/bin/bash</value>
        <value>/bin/zsh</value>
        <value>/bin/tcsh</value>
        <value>/bin/false</value>
      </user.allowed_shells>
    </projectdb>


    <!--
     ! Project Websites
     !-->
    <!-- Prototype! Structure will most likely change significantly! -->
    <projectweb>
      <defaults>
        <vhost-name>%p.dotsrc.org</vhost-name>
        <cfg.user>apache</cfg.user>
        <cfg.group>apache</cfg.group>
        <docroot>/srv/www/%p/htdocs</docroot> <!-- neccessary?? -->
      </defaults>

      <vhost-types>
        <type key='plain'>
          <cfg.root>/etc/apache2/sites-enabled</cfg.root>
          <template>share/dsadmin/templates/admind/vhost-plain.cfg</template>
          <ip>130.225.147.92</ip>
        </type>
        <type key='php'>
          <cfg.root>/etc/apache1/sites-enabled</cfg.root>
          <template>share/dsadmin/templates/admind/vhost-php.cfg</template>
          <ip>130.225.247.90</ip>
        </type>
        <type key='jsp'> <!-- Not sure how to handle these yet -->
          <cfg.root>/etc/apache2/sites-enabled</cfg.root>
          <template>share/dsadmin/templates/admind/vhost-jsp.cfg</template>
          <ip>130.225.147.92</ip>
        </type>
        <type key='forward'>
          <cfg.root>/etc/apache2/sites-enabled</cfg.root>
          <template>share/dsadmin/templates/admind/vhost-forward.cfg</template>
          <ip>130.225.147.92</ip>
        </type>
      </vhost-types>

    </projectweb>


    <!--
     ! Subversion
     !-->
    <svn>
      <on-hosts sticky='true'>loke</on-hosts>

      <paths>
        <repo.base  user='svn_server' group='nogroup' perm='drwx------'>
          <path>/srv/svn</path>
        </repo.base>
        <access.authz_cfg user='svn_server' group='nogroup' perm='-rw-------'>
          <path>/srv/svn/.authz_access</path>
        </access.authz_cfg>
        <access.htpasswd  user='svn_server' group='nogroup' perm='-rw-------'>
          <path>/srv/svn/.htpasswd</path>
        </access.htpasswd>
      </paths>

      <commands>
        <apache.reload user='root'>
          <cmdline>/coll/local/bin/svc -h /service/apache</cmdline>
        </apache.reload>

        <repository.create user='svn_server'>
          <cmdline>svnadmin create $1</cmdline>
        </repository.create>
      </commands>
    </svn>



    <!--
     ! Mirror system
     !-->
    <mirror>
      <on-hosts sticky='true'>munin,mimer</on-hosts>

      <paths>
        <on-hosts sticky='true'>munin</on-hosts>

        <!-- Has to be an absolute path! -->
        <root user='mirror' group='mirror' perm='0755'>
          <on-hosts>munin, mimer</on-hosts>
          <path>/srv/mirror</path>
        </root>

        <update.logdir user='mirror' group='mirror' perm='0644'>
          <path>/srv/mirror/log/{MIRRORNAME}/debug.{TIMESTAMP}</path>
        </update.logdir>
      </paths>

      <commands>
        <update>
          <!-- WARNING: Only one single host may be specified here. Otherwise some internal
           ! data structures will go out of sync! -->
          <on-hosts sticky='true'>munin</on-hosts>
          <rsync user='mirror'>
            <cmdline>/usr/bin/rsync</cmdline>
          </rsync>
          <!--ftpcopy user='mirror'>
            <cmdline>/usr/bin/ftpcopy</cmdline>
          </ftpcopy-->
          <lftp_mirror user='mirror'>
            <cmdline>script/lftp-mirror.rb</cmdline>
          </lftp_mirror>
          <du user='mirror'>
            <cmdline>/usr/bin/du -B 1 -s</cmdline>
          </du>
        </update>
      </commands>

      <!-- Do not forget the trailing slash for these! -->
      <baseurls>
        <http>http://mirrors.dotsrc.org/</http>
        <ftp>ftp://mirrors.dotsrc.org/</ftp>
        <rsync>rsync://rsync.mirrors.dotsrc.org/</rsync>
      </baseurls>

      <ftp>
        <default-passwd>mirror@dotsrc.org</default-passwd>
      </ftp>

      <!-- Load level up to which mirror updates of the respective priority
           are permitted. abs-bonus is the value to be added for mirrors
           with absolute time specs. -->
      <loadlimit low='5' medium='10' high='20' abs-bonus='5'/>

      <!-- The maximum time any mirror update may take. Prevents runaway
           update processes to hog the system resources forever. -->
      <max-update-duration minutes='600'/>
    </mirror>



    <!--
     ! Domain Name Services
     !
     ! Currently geared towards tinydns (http://cr.yp.to/djbdns.html)
     !-->
    <dns>
      <!-- Domains served by us. DNS aliases etc that are not fully qualified
           are considered to "belong to" all of these domains.
           The first listed domain is considered the "canonical" one. For
           services that support it, requests to the other domains are
           redirected to that first one. -->
      <domain>dotsrc.org</domain>
      <domain>dotsource.org</domain>
      <domain>dotsrc.dk</domain>
      <domain>dotsource.dk</domain>
      <domain>sunsite.dk</domain>

      <aliases.zonefile user='root' group='root' perm='0644'>
        <on-hosts>blue</on-hosts>
        <path>/service/a.ns/root/tmp/dns.generated</path>
      </aliases.zonefile>

      <update-command user='root'>
        <on-hosts>blue</on-hosts>
        <cmdline>/bin/true</cmdline>
        <dir>/tmp</dir>
      </update-command>
    </dns>
  </modules>

</config>