<?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>ServerMcCarthy</title><revhistory><revision><revnumber>25</revnumber><date>2015-05-15 17:56:16</date><authorinitials>ClintonEbadi</authorinitials><revremark>system aliases are screwing up some hcoop.net addresses</revremark></revision><revision><revnumber>24</revnumber><date>2015-05-15 06:38:06</date><authorinitials>ClintonEbadi</authorinitials><revremark>suexec does not like the mailman uid, but we're getting somewhere</revremark></revision><revision><revnumber>23</revnumber><date>2015-05-15 00:15:35</date><authorinitials>ClintonEbadi</authorinitials><revremark>Poor mccarthy, filled with hack: yes, we're reverting to an un-config-packaged apache</revremark></revision><revision><revnumber>22</revnumber><date>2015-05-14 23:12:36</date><authorinitials>ClintonEbadi</authorinitials><revremark>some sins of the past will not be repeated</revremark></revision><revision><revnumber>21</revnumber><date>2015-05-14 22:48:36</date><authorinitials>ClintonEbadi</authorinitials><revremark>mailman</revremark></revision><revision><revnumber>20</revnumber><date>2015-05-14 20:22:57</date><authorinitials>ClintonEbadi</authorinitials><revremark>almost there, I think</revremark></revision><revision><revnumber>19</revnumber><date>2015-05-14 18:05:02</date><authorinitials>ClintonEbadi</authorinitials><revremark>modifying init script is not cool</revremark></revision><revision><revnumber>18</revnumber><date>2015-05-14 13:28:46</date><authorinitials>ClintonEbadi</authorinitials><revremark>something is up with system mail, made some tweaks but we'll see</revremark></revision><revision><revnumber>17</revnumber><date>2015-05-14 06:37:33</date><authorinitials>ClintonEbadi</authorinitials><revremark>also need to check configs</revremark></revision><revision><revnumber>16</revnumber><date>2015-05-14 06:30:38</date><authorinitials>ClintonEbadi</authorinitials><revremark>mailman should be quick</revremark></revision><revision><revnumber>15</revnumber><date>2015-05-14 02:21:48</date><authorinitials>ClintonEbadi</authorinitials><revremark>sasl was easy and the deleuze pam stuff was a red herring, but we have to patch exim so it balances out</revremark></revision><revision><revnumber>14</revnumber><date>2015-05-13 23:59:49</date><authorinitials>ClintonEbadi</authorinitials><revremark>I guess we have to use sasl, gsasl sucks</revremark></revision><revision><revnumber>13</revnumber><date>2015-05-13 22:54:08</date><authorinitials>ClintonEbadi</authorinitials><revremark>more exim nonsense</revremark></revision><revision><revnumber>12</revnumber><date>2015-05-13 21:47:57</date><authorinitials>ClintonEbadi</authorinitials><revremark>fail2ban needs to be made persistent to restore</revremark></revision><revision><revnumber>11</revnumber><date>2015-05-13 21:13:25</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>10</revnumber><date>2015-05-13 21:04:38</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>9</revnumber><date>2015-05-13 06:13:59</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>8</revnumber><date>2015-05-13 06:10:35</date><authorinitials>ClintonEbadi</authorinitials><revremark>here's the part where I realize domtool doesn't actually support multiple mailservers.</revremark></revision><revision><revnumber>7</revnumber><date>2015-05-13 05:04:42</date><authorinitials>ClintonEbadi</authorinitials><revremark>userdb stuff</revremark></revision><revision><revnumber>6</revnumber><date>2015-05-13 04:42:41</date><authorinitials>ClintonEbadi</authorinitials></revision><revision><revnumber>5</revnumber><date>2015-05-13 04:39:37</date><authorinitials>ClintonEbadi</authorinitials><revremark>crazy idea: storing files generated by domtool for exim inone directory might make sense</revremark></revision><revision><revnumber>4</revnumber><date>2015-05-13 04:35:05</date><authorinitials>ClintonEbadi</authorinitials><revremark>more things done</revremark></revision><revision><revnumber>3</revnumber><date>2015-05-13 02:25:47</date><authorinitials>ClintonEbadi</authorinitials><revremark>the exim config makes me unhappy, as it has ages. Writing it down might do something about it. Later.</revremark></revision><revision><revnumber>2</revnumber><date>2015-05-13 01:03:47</date><authorinitials>ClintonEbadi</authorinitials><revremark>note things done to get exim up</revremark></revision><revision><revnumber>1</revnumber><date>2015-04-19 19:48:26</date><authorinitials>ClintonEbadi</authorinitials><revremark>&quot;hcoop works on jessie&quot; proves to be half of a lie</revremark></revision></revhistory></articleinfo><para><code>mccarthy.hcoop.net</code> is our first Debian Jessie VM, and is intended to run mail services and the member portal. </para><section><title>The Ugly</title><para><ulink url="https://wiki.hcoop.net/ServerMcCarthy/ServerDeleuze#">ServerDeleuze</ulink> decided to start dying one day so a few evils were committed in moving services. </para><section><title>Courier</title><para>There was insufficient time to do a proper switch to dovecot, but courier seems to work with our patches at least for normal users. </para><para><code>/var/local/lib/spamd</code> is symlinked to spamd's openafs home for legacy purposes -- shared index file is updated, but existing index files based on the template will have the old location. </para><para><code>/etc/pam.d/imap</code> is ugly as hell though. We need to kill courier with fire asap, or see if we can customize using krb5.conf: </para><screen><![CDATA[#@include common-auth
#@include common-account
#@include common-password
#@include common-session
]]><![CDATA[
session         required       pam_afs_session.so debug nopag always_aklog
auth            required       pam_krb5.so debug
auth            required       pam_afs_session.so debug nopag always_aklog
account         required       pam_krb5.so]]></screen></section><section><title>Exim</title><para>Installed <code>exim4-daemon-heavy procmail spf-tools-perl courier-authlib-userdb sasl2-bin</code>, merged deleuze's config onto the current Debian base exim4 config. No config package has been created. History is lost from deleuze at the moment (diff -ur ...). </para><para>Added <code>/etc/ferm/service.{in,out}.d/exim</code> to allow connecting to spamd on hopper and open smtp generally. </para><para><code>adduser Debian-exim mail hcoop-tlscert sasl</code> to allow it to read <code>/etc/courier/exim.dat</code> and hcoop tls cert, and auth against sasld </para><para><code>mkdir /etc/courier /etc/spamassassin</code> for userdb and spamd. <code>domtool-publish</code> should at least make the spamassassin dir... </para><para><code>touch /var/domtool/{local,relay,mailman}_domains.cfg</code> -- but <code>domtool-publish</code>'s <code>redo_exim</code> function procedure should test if these exist before using (it is non-fatal for a mail node to not be relaying for anything, but currently requires creating empty files to actually work) </para><section><title>SASL Setup</title><para><code>sasl2-bin</code>, default options except for setting <code>START=yes</code> in <code>/etc/default/saslauthd</code> worked for exim auth </para></section><section><title>Exim Notes</title><para>Blockers: </para><itemizedlist><listitem><para><emphasis role="strong">FIXED</emphasis> Exim now requires that <code>chown()</code> to the delivering user succeeds. This doesn't in afs, because we have tokens for <code>$USER.daemon</code> and not <code>$USER</code>. Need to update so that the chown call is permitted to fail, and then try to come up with a general upstream solution that does not compromise security by default. </para><itemizedlist><listitem><para>exim 4.68 (works) </para><screen><![CDATA[      (void)Uchown(filename, uid, gid);
      (void)Uchmod(filename, mode);]]></screen></listitem><listitem><para>exim 4.84 (doesn't work) </para><screen><![CDATA[      if(Uchown(filename, uid, gid) || Uchmod(filename, mode))
        {
        addr->basic_errno = errno;
        addr->message = string_sprintf("while setting perms on mailbox %s",
          filename);
        addr->transport_return = FAIL;
        goto RETURN;
        }]]></screen></listitem></itemizedlist></listitem><listitem><para>Delivery to mailman not on localhost does not work. Need a condition for checking if we are the mailman host, and using something like remote_smtp_smarthost to relay to the mailman host if needed (which is for now with deleuze). </para><itemizedlist><listitem><para>I think <code>conf.d/router/470_exim4-config_mailman</code> is the right place (set a different transport if we are not the mailman host) </para></listitem><listitem><para>mailmandb is not copied to host unless it is the mailman host, needs to be relayed to all hosts </para><itemizedlist><listitem><para>Let's not get stuck with only one mailman node going forward -- it should be possible to have multiple mailman nodes (but only one per domain) </para></listitem></itemizedlist></listitem></itemizedlist></listitem><listitem><para>Default hcoop firewall rules must be updated to allow smtp to mccarthy </para><itemizedlist><listitem><para>Actually, shouldn't -- firewall should be ok since it uses dns but double check (then just ferm reload after switching, done) </para></listitem></itemizedlist></listitem><listitem><para>check all .forward and .procmailrc for any programs run and ensure they are installed on mccarthy </para></listitem><listitem><para>check all domtool config for anyone setting deleuze as their mx or <ulink url="https://wiki.hcoop.net/ServerMcCarthy/MailNodes#">MailNodes</ulink> manually </para></listitem></itemizedlist><para>Things that need review in the config: </para><itemizedlist><listitem><para><code>dc_other_hostnames</code>, <code>dc_relay_nets</code>, <code>unix_domains</code> look like they could be unified, simplifying the config </para></listitem><listitem><para><ulink url="https://wiki.hcoop.net/ServerMcCarthy/DomTool#">DomTool</ulink> overrides <code>local_domains</code>, and we replace <code>local_domains</code> with <code>unix_domains</code> almost everywhere. domtool should probably generate another domainlist, and we should modify the few places where we need to check user hosted domains (idea for a descriptive name: <code>hosted_domains</code>). </para></listitem><listitem><para>I think we're doing sender verification wrong </para></listitem><listitem><para>Do we want to check <code>CHECK_RCPT_DOMAIN_DNSBLS</code> in addition to <code>IP_DNSBLS</code>? </para></listitem><listitem><para>Load limits do not appear to cause major problems, but review them because they were made for when deleuze was seriously overloaded </para><itemizedlist><listitem><para>Similarly, retry/30_exim4_config has weird retry times because afs used to time out on deleuze from overloaded. Revisit. </para></listitem></itemizedlist></listitem><listitem><para>We gain tokens in various places by setting an arbitrary environment variable and using side effects of <code>$run{}</code>. There has got to be a better way to grab afs tokens when needed. </para></listitem><listitem><para>Domtool created files in /etc/ (aliases.hosted + wildcard), /etc/exim4, ... perhaps move all domtool generated files into one directory to help make it immediately obvious what is generated by domtool? All of the files generated by domtool have their paths configured in the exim config afaict. </para></listitem></itemizedlist><para>Misc Changes from Debian: </para><itemizedlist><listitem><para>/etc/mailname to hcoop.net </para></listitem><listitem><para>We drop rather than warn for domains in <code>CHECK_RCPT_IP_DNSBLS</code> </para></listitem><listitem><para>Several important addresses <code>@hcoop.net</code> only routed because of <code>/etc/aliases</code> on deleuze. Put into domtool, and discovered that system aliases were interfering. We need <code>hcoop.net</code> to be a local domain for local user resolution, removed some aliases to allow domtool generated aliases to be used: </para><screen><![CDATA[abuse
postmaster]]></screen></listitem><listitem><para>Added <code>logs</code> to <code>/etc/aliases</code>. May try using <code>domain &quot;mccarthy.hcoop.net&quot; where DNS = noDns with emailAlias ... end</code> (do not want to override zone settings from hcoop.net, just want to add new aliases) </para></listitem></itemizedlist><para>Major changes of note from deleuze: </para><itemizedlist><listitem><para>Using default of /etc/mailman for visible name instead of dc_visiblename </para></listitem><listitem><para>SPF checking will deny and not just warn </para></listitem><listitem><para>DKIM checking is on </para></listitem><listitem><para><code>dev_null</code> router not included (unused) </para></listitem><listitem><para><code>trouble_user</code> log </para></listitem></itemizedlist><para>ic not included (one time problem, years ago...) </para><itemizedlist><listitem><para>Using official hcoop cert </para></listitem><listitem><para>not listening on smtps port -- looks deprecated? </para></listitem><listitem><para>lowuid router used to send mail for lowuids to <ulink url="mailto:logs@hcoop.net">logs@hcoop.net</ulink>. Still requires domtool to have a <ulink url="mailto:logs@hcoop.net">logs@hcoop.net</ulink> alias to function. Set /etc/mailname to mccarthy.hcoop.net. </para></listitem><listitem><para><code>/etc/exim4/get-token</code> stores tokens in <code>/var/local/mail-tokens</code> instead of <code>/tmp/exim4</code> and is shared with courier instead of courier having its own script. Also attempts to krenew a ticket, only kiniting a new ticket if it cannot be renewed for at least another 30 minutes. </para></listitem><listitem><para>mailman transport can be configured to forward to another host (copied back to deleuze for transition) </para></listitem></itemizedlist></section></section><section><title>Mailman Setup</title><para>Installed <code>mailman</code> which brought in <code>apache2.4</code>. We do not yet have a config package due to waklog not building, punting for now since mailman is on the local file system. </para><itemizedlist><listitem><para>Copied <code>/etc/mailman</code> from deleuze, plus one new bit for review later  </para><itemizedlist><listitem><para>Add <code>/etc/mailman</code> to path for <code>vhosts_cfg</code> instead of symlinking into <code>/usr/lib/mailman/Mailman</code>. </para></listitem><listitem><screen><![CDATA[-#-------------------------------------------------------------
-# Uncomment if you want to filter mail with SpamAssassin. For
-# more information please visit this website:
-# http://www.jamesh.id.au/articles/mailman-spamassassin/
-# GLOBAL_PIPELINE.insert(1, 'SpamAssassin')
-]]></screen></listitem></itemizedlist></listitem><listitem><para>Cloned vhosts_cfg.py from deleuze to test things </para></listitem><listitem><para>Mailman defaults to setgid for programs. This is terrible. See if it just needs a dpkg-reconfigure. </para></listitem></itemizedlist><para>Installed <code>/etc/cron.d/hcoop-mailman-update-exim-db</code> from deleuze </para><para>Stock apache suexec will not suexec as users with UID &lt; 100, bumped to 113:116. </para><para>todo:  </para><itemizedlist><listitem><para><ulink url="http://wiki.list.org/DOC/How%20do%20I%20move%20a%20list%20to%20a%20different%20server-Mailman%20installation"/>. should be really quick </para></listitem><listitem><para>switch mailman host in domtool </para></listitem><listitem><para>/pipermail is broken, apache won't suexec to <code>list</code> and perms are broken. Adjust <code>list</code> user ID later, and use suexec. </para></listitem></itemizedlist></section><section><title>Apache 2.4</title><para>fastcgi php support is not yet ready and suphp is gone in jessie with non-trivial work required to support it. Config is base apache, + vhosts dir (just enough to work for now). </para><para>todo: </para><itemizedlist><listitem><para>apache sync logs cron job so members can see their list vhost traffic </para></listitem></itemizedlist></section></section><section><title>Setup Issues</title><itemizedlist><listitem><para>Fix fail2ban </para><itemizedlist><listitem><para>ferm resets rules ever time it reloads. <emphasis role="strikethrough">Add a ferm hook to reload fail2ban on firewall reload</emphasis> fail2ban configuration needs to be updated to store a persistent database </para></listitem></itemizedlist></listitem><listitem><para><code>sudo $command &gt; file</code> does not work, piping does however. Probably a new sudo option to detect output redirection and squelch output. </para></listitem><listitem><para>systemd work: </para><itemizedlist><listitem><para>domtool unit files seem to work OK so far </para></listitem><listitem><para>ferm is likely starting earlier than it should be, and may fail if the generated config references any pts users </para></listitem><listitem><para>dnscache-run starts very late by virtue of daemontools starting late. Either hack daemontools to be <code>WantedBy=nss-lookup.target</code> (systemd equiv of LSB <code>$named</code> service), or make dnscache-run a native systemd service. </para><itemizedlist><listitem><para>Hacked momentarily by adding Google DNS servers as backups </para></listitem></itemizedlist></listitem></itemizedlist></listitem></itemizedlist><!--rule (<hr>) is not applicable to DocBook--><para> <ulink url="https://wiki.hcoop.net/ServerMcCarthy/CategorySystemAdministration#">CategorySystemAdministration</ulink> </para></section></article>