<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>DomTool/Plugins</title><revhistory><revision><revnumber>13</revnumber><date>2011-04-22 23:05:37</date><authorinitials>ClintonEbadi</authorinitials><revremark>Revert to revision 9.</revremark></revision><revision><revnumber>12</revnumber><date>2011-04-21 18:24:27</date><authorinitials>121.123.138.99</authorinitials><revremark>Hey, that's the gareetst! So with ll this brain power AWHFY?</revremark></revision><revision><revnumber>11</revnumber><date>2011-04-21 17:02:25</date><authorinitials>proxy.optimaxbd.net</authorinitials><revremark>efSL0a  &lt;a href=&quot;http://lnkxwvvczbbk.com/&quot;&gt;lnkxwvvczbbk&lt;/a&gt;</revremark></revision><revision><revnumber>10</revnumber><date>2011-04-21 07:27:50</date><authorinitials>cultureclub.travelrepublic.co.uk</authorinitials><revremark>AFAIC that's the best aneswr so far!</revremark></revision><revision><revnumber>9</revnumber><date>2008-07-07 04:28:17</date><authorinitials>localhost</authorinitials><revremark>converted to 1.6 markup</revremark></revision><revision><revnumber>8</revnumber><date>2008-04-30 14:55:17</date><authorinitials>AdamChlipala</authorinitials><revremark>deleuze -&gt; hcoop</revremark></revision><revision><revnumber>7</revnumber><date>2007-11-17 20:22:51</date><authorinitials>AdamChlipala</authorinitials><revremark>New Mailman plug-in output</revremark></revision><revision><revnumber>6</revnumber><date>2007-10-14 18:52:46</date><authorinitials>AdamChlipala</authorinitials><revremark>New Apache modules</revremark></revision><revision><revnumber>5</revnumber><date>2007-06-21 17:57:10</date><authorinitials>AdamChlipala</authorinitials><revremark>Update Exim details</revremark></revision><revision><revnumber>4</revnumber><date>2006-12-16 23:11:12</date><authorinitials>AdamChlipala</authorinitials><revremark>HCoop, Mailman, Webalizer</revremark></revision><revision><revnumber>3</revnumber><date>2006-12-16 23:03:48</date><authorinitials>AdamChlipala</authorinitials><revremark>Exim</revremark></revision><revision><revnumber>2</revnumber><date>2006-12-16 22:30:11</date><authorinitials>AdamChlipala</authorinitials></revision><revision><revnumber>1</revnumber><date>2006-12-16 22:25:00</date><authorinitials>AdamChlipala</authorinitials></revision></revhistory></articleinfo><para>This page is aimed at admins; that is, people with root privileges on our servers. Most members should probably consult <ulink url="https://wiki.hcoop.net/DomTool/Plugins/DomTool/UserGuide#">DomTool/UserGuide</ulink> instead. </para><para>This page documents the different <ulink url="https://wiki.hcoop.net/DomTool/Plugins/DomTool#">DomTool</ulink> <emphasis role="strong">plugins</emphasis>, which provide the primitive actions that can be used to configure particular &quot;real&quot; daemons. </para><section><title>Apache</title><para><emphasis role="strong">Modules:</emphasis> <ulink url="http://hcoop.net/domtool/apache.html">Apache</ulink>, <ulink url="http://hcoop.net/domtool/apache_auth.html">Apache_auth</ulink>, <ulink url="http://hcoop.net/domtool/apache_options.html">Apache_options</ulink>, <ulink url="http://hcoop.net/domtool/mod_autoindex.html">Mod_autoindex</ulink>, <ulink url="http://hcoop.net/domtool/mod_dav.html">Mod_dav</ulink>, <ulink url="http://hcoop.net/domtool/mod_env.html">Mod_env</ulink>, <ulink url="http://hcoop.net/domtool/mod_rewrite.html">Mod_rewrite</ulink>, <ulink url="http://hcoop.net/domtool/proxy.html">Proxy</ulink>, <ulink url="http://hcoop.net/domtool/urls.html">Urls</ulink> </para><para>Each <code>vhost &quot;$HOST&quot;</code> directive creates a <code>$HOST.vhost</code> file in <code>$DOMTOOL/nodes</code>. A change handler for <code>.vhost</code> files copies them to <code>/var/domtool/vhosts</code>. A post-handler runs <code>domtool-publish apache</code>, which rsyncs <code>/var/domtool/vhosts</code> to <code>/etc/apache2/vhosts</code> after any vhost has changed and runs <code>/etc/init.d/apache2 reload</code> to reload configuration. </para><para>The Apache plugin also manages creation and deletion of log directories. Each member should have an <code>apache/log</code> subdirectory of his AFS volume root, owned by domtool with read permissions for the member. The plugin creates a directory <code>/afs/hcoop/usr/$USER/apache/log/$NODE/$HOST</code> for each virtual host running on <code>$NODE</code> as <code>$USER</code> with full hostname <code>$HOST</code>. When a vhost is deleted, the plugin deletes its log directory. Since this can't be done while Apache is running, because the daemon maintains open file handles to logs, the plugin has to take Apache down until configuration is finished, reloading it afterward. Hopefully domains aren't deleted very often, so this shouldn't be much of a problem. </para><para>Apache also provides hooks that other plugins can use to request callbacks just before and/or after a vhost is configured. </para></section><section><title>BIND</title><para><emphasis role="strong">Modules:</emphasis> <ulink url="http://hcoop.net/domtool/bind.html">Bind</ulink> </para><para>BIND configuration directives are written to <code>dns</code> files in the <code>$DOMTOOL/nodes</code> directories of the appropriate nodes/domains. These <code>dns</code> files contain all of the contents of a BIND zonefile, with the exception of the SOA record. This is handled by main <ulink url="https://wiki.hcoop.net/DomTool/Plugins/DomTool#">DomTool</ulink> code and written in a stylized form to <code>soa</code> files. The BIND plugin registers a change handler looking for modifications to either <code>dns</code> or <code>soa</code> files. When any are found, <code>/var/domtool/zones/$DOMAIN.zone</code> is regenerated from them. </para><para>The BIND plugin also produces a <code>named.conf</code> file for each domain. A change handler notes when some <code>named.conf</code> has changed, and a post-handler concatenates all <code>named.conf</code> files in <code>$DOMTOOL/nodes/$NODE</code> into <code>/var/domtool/named.conf.local</code> and runs <code>domtool-publish bind</code>, which rsyncs <code>/var/domtool/zones</code> to <code>/etc/bind/zones</code>, copies <code>/var/domtool/named.conf.local</code> to <code>/etc/bind/</code>, and runs <code>/etc/init.d/bind9 reload</code>. </para></section><section><title>Exim</title><para><emphasis role="strong">Modules:</emphasis> <ulink url="http://hcoop.net/domtool/alias.html">Alias</ulink>, <ulink url="http://hcoop.net/domtool/exim.html">Exim</ulink> </para><para>The Exim plugin maintains three kinds of files in domain configuration directories: </para><itemizedlist><listitem><para><code>aliases</code>, e-mail aliases to be concatenated into <code>/etc/aliases.hosted</code> </para></listitem><listitem><para><code>mail</code> files that, if non-empty, should contain the current domain's name, indicating that the current node should accept mail for that domain for local delivery </para></listitem><listitem><para><code>mail.relay</code> files that, if non-empty, should contain the current domain's name, indicating that the current node should provide relaying for any mail addressed to that domain </para></listitem></itemizedlist><para>A post-handler performs the concatenation over all domains into <code>/var/domtool/aliases</code>, <code>/var/domtool/local_domains.cfg</code>, and <code>/var/domtool/relay_domains.cfg</code>, respectively; and then runs <code>domtool-publish exim</code>, which copies the first file to <code>/etc/aliases.hosted</code> and concatenates the rest to <code>/etc/exim4/conf.d/main/10_domtool-domains</code>, and then runs <code>/etc/init.d/exim4 reload</code>. </para></section><section><title>HCoop</title><para><emphasis role="strong">Modules:</emphasis> <ulink url="http://hcoop.net/domtool/hcoop.html">Hcoop</ulink> </para><para>This plug-in currently only provides useful HCoop-specific <code>extern</code> functions. </para></section><section><title>Mailman</title><para><emphasis role="strong">Modules:</emphasis> <ulink url="http://hcoop.net/domtool/mailman.html">Mailman</ulink> </para><para>The <code>mailmanWebHost</code> action writes a domain file <code>mailman</code>, recording the default Mailman vhost for that domain. A post-handler concatenates all of these into <code>/var/domtool/mailman.map</code> in a format suitable for a Python association list in Mailman configuration, and runs <code>domtool-publish mailman</code>, which uses that file to create <code>/etc/mailman/vhosts_cfg.py</code>, which defines an association list named <code>HCOOP_VHOSTS</code>.  A file <code>/var/domtool/mailman_domains.cfg</code> is also created to list which domains should be considered for Mailman list delivery, and this list is added to <code>/etc/exim4/conf.d/main/10_domtool-domains</code> upon publishing. </para></section><section><title>Webalizer</title><para><emphasis role="strong">Modules:</emphasis> none </para><para>This plugin works entirely through the before/after vhost hooks provided by the Apache plugin. For each vhost <code>$VHOST</code> on node <code>$NODE</code>, it writes to <code>$DOMTOOL/webalizer/config/$NODE/$VHOST.conf</code> Webalizer configuration that will generate statistics for that vhost. The output HTML and images are directed to <code>$DOMTOOL/webalizer/output/$NODE/$VHOST/</code>, which the plugin ensures exists. </para></section></article>