<rdf:RDF
    xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
    xmlns:s='http://snipsnap.org/rdf/snip-schema#'
    xml:base='http://bliki.rimuhosting.com/rdf'>
    <s:Snip rdf:about='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/qmail+notes'
         s:cUser='retep'
         s:oUser=''
         s:mUser='kron'>
        <s:name>knowledgebase/linux/mail/qmail notes</s:name>
        <s:content>1 Where are the logs?&#xD;&#xA;&#xD;&#xA;For a typical qmail installation with Plesk, you can monitor the logs with the following command:&#xD;&#xA;{code:none}&#xD;&#xA;tail -f /usr/local/psa/var/log/maillog&#xD;&#xA;{code}&#xD;&#xA;1 Bounce Saying&#xD;&#xA;&#xD;&#xA;Qmail can send out an email when an email arrives for someone it does not know about.  (e.g. This is the default setup in Plesk&apos;s qmail setup).&#xD;&#xA;&#xD;&#xA;Typically these emails are from spammers.  And the spammers will not have provided their real address.&#xD;&#xA;&#xD;&#xA;So the &apos;bounce&apos; email will trigger an error message reply and qmail will queue up the bounce email for delivery later on.  Good luck with that qmail :)&#xD;&#xA;&#xD;&#xA;You can change the &apos;bounce saying ..blah..&apos; behavior to one where the email server just ignores any email arriving for an unknown user.&#xD;&#xA;&#xD;&#xA;Just edit /var/qmail/mailnames/$DOMAIN/.qmail-default and replace its contents with:&#xD;&#xA;{code}&#xD;&#xA;|true&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;i.e. a pipe (|) symbol and true (the command true which runs, does nothing and returns a success code). If there is no &quot;/var/qmail/mailnames&quot; directory, try &quot;/var/qmail/alias&quot;.&#xD;&#xA;&#xD;&#xA;To change all domains so they do not send bounces, run (on systems with Plesk):&#xD;&#xA;{code}&#xD;&#xA;find /var/qmail/mailnames/ |  grep .qmail-default | xargs replace &quot;|bouncesaying &apos;This address no longer accepts mail.&apos;&quot; &apos;|/bin/true&apos; --&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Or the (slightly more agressive):&#xD;&#xA;{code}&#xD;&#xA;for i in $(find /var/qmail/mailnames/ |  grep .qmail-default); do &#xD;&#xA;    echo &apos;|/bin/true&apos; &gt; $i&#xD;&#xA;done&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;This setup will send messages to the void. There will be no confirmation or feedback after ignoring this message. If you want to keep track of those messages being ignored, use this instead to send notifications to syslog:&#xD;&#xA;{code}&#xD;&#xA;for i in $(find /var/qmail/mailnames/ |  grep .qmail-default); do &#xD;&#xA;echo &quot;|$(which logger)&quot; &apos;-p mail.info -t qmail &quot;ignoring mail: invalid destination - &lt;\$SENDER&gt; &lt;\$RECIPIENT&gt;&quot;&apos; &gt; $i&#xD;&#xA;done&#xD;&#xA;{code}&#xD;&#xA;1 Managing a QMail Queue&#xD;&#xA;&#xD;&#xA;/var/qmail/bin/qmail-showctl will show info about qmail setup.&#xD;&#xA;&#xD;&#xA;/var/qmail/bin/qmail-qstat will show what is in the mail queue.&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;# to clear the queue&#xD;&#xA;{&#xD;&#xA;/etc/init.d/qmail stop&#xD;&#xA;cd /var/qmail/queue&#xD;&#xA;rm -rf info intd local mess remote todo&#xD;&#xA;mkdir mess&#xD;&#xA;for i in `seq 0 22`; do&#xD;&#xA;mkdir mess/$i&#xD;&#xA;done&#xD;&#xA;cp -r mess info&#xD;&#xA;cp -r mess intd&#xD;&#xA;cp -r mess local&#xD;&#xA;cp -r mess remote&#xD;&#xA;cp -r mess todo&#xD;&#xA;chmod -R 750 mess todo&#xD;&#xA;chown -R qmailq:qmail mess todo&#xD;&#xA;chmod -R 700 info intd local remote&#xD;&#xA;chown -R qmailq:qmail intd&#xD;&#xA;chown -R qmails:qmail info local remote&#xD;&#xA;/etc/init.d/qmail start&#xD;&#xA;}&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;1 qmHandle&#xD;&#xA;&#xD;&#xA;qmHandle is a handy tool for manipulating the qmail queue, and for gathering some basic statistics about it.&#xD;&#xA;&#xD;&#xA;To install it (to your current directory) run:&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;wget -O - &quot;http://easynews.dl.sourceforge.net/sourceforge/qmhandle/qmhandle-1.3.2.tar.gz&quot; | tar xzf -&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;If you&apos;re using qmHandle with Plesk&apos;s qmail, try an older version that doesn&apos;t attempt to stop qmail with &apos;svc&apos;:&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;wget -O - &quot;http://easynews.dl.sourceforge.net/sourceforge/qmhandle/qmhandle-1.2.0.tar.gz&quot; | tar xzf -&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;If you have a lot of bounce notices sitting in your queue, try running:&#xD;&#xA;&#xD;&#xA;{code:none}&#xD;&#xA;./qmHandle -S&apos;failure notice&apos;&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;The -S means &apos; delete all messages that have/contain text as Subject&apos;.&#xD;&#xA;&#xD;&#xA;1 Is QMail Evil?&#xD;&#xA;&#xD;&#xA;Quick answer: no.  But there are idiosyncracies with it that should make you think whether to choose it as your mail server or not:&#xD;&#xA;&#xD;&#xA;- DJB&apos;s license is non-free (in not allowing others to repackage it, along with other major restrictions). &#xD;&#xA;- Thus it is not present in most distros repositories (because of its licensing) making it more difficult to install than software that is included in the repositories&#xD;&#xA;- It launches itself via inittab which makes it difficult to stop/start the service&#xD;&#xA;- It supervises itself (typically) with svscan and often loses track of what is running (this causes processes to be respawned and can be a huge resource drain on your server)&#xD;&#xA;- It does not integrate easily with &apos;standard&apos; mail tools, like procmail making things like installing spamassassin or anti virus  filters difficult&#xD;&#xA;- It uses its own unique way of doing its config files.&#xD;&#xA;- It ignores the FHS by putting many, many unusual things such as binaries in /var.&#xD;&#xA;&#xD;&#xA;No email server (that I know of) is perfect.  Postfix is currently the one I&apos;m using by default on new setups.  The main reason being it has a &apos;regular&apos; linux setup (regular /etc/init.d entries, regular name=value config files, etc).&#xD;&#xA;&#xD;&#xA;1 Need to Track Who Sent an Email?&#xD;&#xA;&#xD;&#xA;Need to track who sent a particular email from your server?  e.g. if a user account is compromised and you need to see which user account?&#xD;&#xA;&#xD;&#xA;The email will have headers like:&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;Received: (qmail 13711 invoked from network); 26 Jun 2007 02:55:46 -0000&#xD;&#xA;Received: from hpbizway.com.ar (HELO User) (1.2.3.4)&#xD;&#xA;   by example.com with SMTP; 26 Jun 2007 02:55:46 -0000&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;The &apos;invoked from network&apos; means the email was received from an external host (e.g. it was not send from a program like apache on your server itself).&#xD;&#xA;&#xD;&#xA;The IP that sent the email was 1.2.3.4&#xD;&#xA;&#xD;&#xA;So run:&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;grep 1.2.3.4 /var/log/messages&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;(Use whatever IP you need to there).&#xD;&#xA;&#xD;&#xA;And you will find which user that IP was using.  e.g.&#xD;&#xA;&#xD;&#xA;{code}&#xD;&#xA;/var/log/messages:Jun 26 16:17:35 example smtp_auth: SMTP connect from unknown@hpbizway.com.ar [1.2.3.4]&#xD;&#xA;/var/log/messages:Jun 26 16:17:35 example smtp_auth: smtp_auth: SMTP user claudia &#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;In this case it is the &apos;claudia&apos; user.  And a suitable follow up would be to, say, change the password on that user account.&#xD;&#xA;&#xD;&#xA;1 QMail Maxing Out CPU&#xD;&#xA;&#xD;&#xA;Do you have lots of /var/qmail/bin/qmail-smtpd processes?  All using lots of CPU?&#xD;&#xA;&#xD;&#xA;Are you missing files named /var/qmail/control/dh512.pem and /var/qmail/control/dh1024.pem?&#xD;&#xA;&#xD;&#xA;Do you have /var/qmail/control/dhparams512.pem and /var/qmail/control/dhparams1024.pem?&#xD;&#xA;&#xD;&#xA;In this case it may be that your qmail process is generating a ssl key for each connection, rather than using a pre-prepared one.&#xD;&#xA;&#xD;&#xA;The fix is to run:&#xD;&#xA;{code}&#xD;&#xA;cp /var/qmail/control/dhparams512.pem /var/qmail/control/dh512.pem&#xD;&#xA;cp /var/qmail/control/dhparams1024.pem /var/qmail/control/dh1024.pem&#xD;&#xA;{code}&#xD;&#xA;&#xD;&#xA;Then you may also need to restart xinetd with {code}/etc/init.d/xinetd restart{code}&#xD;&#xA;</s:content>
        <s:mTime>2008-01-17 15:28:23.0</s:mTime>
        <s:cTime>2005-09-02 23:49:12.0</s:cTime>
        <s:comments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
        <s:snipLinks>
            <rdf:Bag>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail'/>
                <rdf:li rdf:resource='#snipsnap-search'/>
                <rdf:li rdf:resource='#knowledgebase'/>
                <rdf:li rdf:resource='#snipsnap-index'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/ruby on rails'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/plesk notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#KDE4 and the Plasma desktop'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfix notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/ajax autocomplete'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/networking/null route an attackers ip'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/accessing postgres via jdbc'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/mass emailing best practices'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/-Xmx settings'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin on debian sarge'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/bash'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/xen'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/auto-restart'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/phpmyadmin'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#john/2007-06-24/1'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/filtered webmin'/>
                <rdf:li rdf:resource='#jetty'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/postfixadmin on RHEL4'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/svn notes'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/maildrop with mysql support on debian sarge'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/setting up mysql replication'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/rpm based mysql5 install'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache/installing and using mod_fastcgi'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/custom vps image'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/argh my server was exploited'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/proxy servers: squid'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#A sysadmin&apos;s view of VoIP'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/squirrelmail'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/miscapplications/grub boot cd'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/moving imap folders between hosts'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/mail/Postfix mbox to Maildir conversion'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/tomcat on plesk'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/webserver/apache/php'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/troubleshooting performance issues in Linux'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/rimuhosting ssh access'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/java/liferay install on tomcat 5.5'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/rimuhosting/vps backups'/>
                <rdf:li rdf:resource='http://bliki.rimuhosting.com/rdf#knowledgebase/linux/misc/quick and dirty memory checker'/>
            </rdf:Bag>
        </s:snipLinks>
        <s:attachments
             rdf:type='http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag'/>
    </s:Snip>
</rdf:RDF>
