<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Denie&#039;s Tech Blog &#187; Sendmail</title>
	<atom:link href="http://blog.nataprawira.com/tech/category/sendmail/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nataprawira.com/tech</link>
	<description>Information Technology for Life!</description>
	<lastBuildDate>Tue, 13 Dec 2011 05:17:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HOWTO: Deletes mailqueue files using matched keywords</title>
		<link>http://blog.nataprawira.com/tech/2011/12/13/howto-deletes-mailqueue-files-using-matched-keywords/</link>
		<comments>http://blog.nataprawira.com/tech/2011/12/13/howto-deletes-mailqueue-files-using-matched-keywords/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 05:17:04 +0000</pubDate>
		<dc:creator>Denie</dc:creator>
				<category><![CDATA[BASH]]></category>
		<category><![CDATA[Sendmail]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.nataprawira.com/tech/?p=203</guid>
		<description><![CDATA[

#!/bin/bash
# Programmed by Denie Nataprawira (nataprawira@gmail.com)
# (c) 2011 &#8212; www.ayodiet.com  
#
# Purposes:
#	Deletes mailqueue files using matched keywords.
#
cd /var/spool/mqueue
if test -z $1
then
        echo &#8220;The required parameter was empty. Please try again!&#8221;
        echo &#8220;Format: delkeyw.sh [KEYWORDS]&#8220;
       [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2011%2F12%2F13%2Fhowto-deletes-mailqueue-files-using-matched-keywords%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2011%2F12%2F13%2Fhowto-deletes-mailqueue-files-using-matched-keywords%2F" height="61" width="51" /></a></div>
<!-- ALL ADSENSE ADS DISABLED -->
<p>#!/bin/bash</p>
<p># Programmed by Denie Nataprawira (nataprawira@gmail.com)<br />
# (c) 2011 &#8212; www.ayodiet.com <img src='http://blog.nataprawira.com/tech/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <br />
#<br />
# Purposes:<br />
#	Deletes mailqueue files using matched keywords.<br />
#</p>
<p>cd /var/spool/mqueue</p>
<p>if test -z $1<br />
then<br />
        echo &#8220;The required parameter was empty. Please try again!&#8221;<br />
        echo &#8220;Format: delkeyw.sh [KEYWORDS]&#8220;<br />
        echo &#8221; &#8220;<br />
        exit<br />
fi</p>
<p>        echo &#8221;  SEARCHING: \&#8221;$1\&#8221; from all files&#8230;&#8221;</p>
<p>find . -type f -exec grep -il &#8216;$1&#8242; {} \; -exec rm -f {} \;</p>
<p>        echo &#8221;  DONE: \&#8221;$1\&#8221; has been checked and deleted (if found).&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nataprawira.com/tech/2011/12/13/howto-deletes-mailqueue-files-using-matched-keywords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sendmail Multiple Queues</title>
		<link>http://blog.nataprawira.com/tech/2011/01/13/sendmail-multiple-queues/</link>
		<comments>http://blog.nataprawira.com/tech/2011/01/13/sendmail-multiple-queues/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 09:32:42 +0000</pubDate>
		<dc:creator>Denie</dc:creator>
				<category><![CDATA[BASH]]></category>
		<category><![CDATA[Sendmail]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[multiple]]></category>
		<category><![CDATA[queue]]></category>

		<guid isPermaLink="false">http://blog.nataprawira.com/tech/?p=200</guid>
		<description><![CDATA[

Source:
http://www.ducea.com/2008/08/19/sendmail-multiple-queues/
Sendmail will use by default a single mail queue. This is what most users will need, and if you don’t have any special requirement you will not care about this. Still for high traffic mail servers it might be useful to split the queue over several directories, as thousands of files in a single directory [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2011%2F01%2F13%2Fsendmail-multiple-queues%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2011%2F01%2F13%2Fsendmail-multiple-queues%2F" height="61" width="51" /></a></div>
<!-- ALL ADSENSE ADS DISABLED -->
<p>Source:<br />
<a href="http://www.ducea.com/2008/08/19/sendmail-multiple-queues/">http://www.ducea.com/2008/08/19/sendmail-multiple-queues/</a></p>
<p>Sendmail will use by default a single mail queue. This is what most users will need, and if you don’t have any special requirement you will not care about this. Still for high traffic mail servers it might be useful to split the queue over several directories, as thousands of files in a single directory will become a performance penalty at some point and also processing the queue sequentially will become very slow.</p>
<p>This post will show how we can implement multiple mail queues with modern sendmail versions.<br />
Let’s start by assuming we want to use 8 mail queues. First thing is to create the actual directories as sendmail will not do this by default:</p>
<p><code>mkdir /var/spool/mqueue/q{1,2,3,4,5,6,7,8}</code></p>
<p>And fix the permissions to the ones of the original folder /var/spool/mqueue. For ex. this might look like:</p>
<p><code>chown -R root:smmsp /var/spool/mqueue/q*</code></p>
<p>using a default sendmail install running on debian. Fix the users to the specific ones found on your system (ls -al /var/spool/mqueue if you are uncertain of this).</p>
<p>Next, we need to enable the multiple queues in the sendmail configuration. For this we will edit sendmail.mc (normally found under /etc/mail) and append one line:</p>
<p><code>define(`QUEUE_DIR', `/var/spool/mqueue/q*')dnl</code></p>
<p>and now regenerate sendmail.cf; this is done normally running:</p>
<p><code>m4 sendmail.mc &gt; /etc/mail/sendmail.cf</code></p>
<p>(fix your paths appropriately), or if you are using debian sendmail you can just run make all in /etc/mail.</p>
<p>After restarting sendmail, it will start using the multiple queues we defined. Running mailq will output each of the queues:</p>
<p><code>#mailq<br />
/var/spool/mqueue/q6 is empty<br />
/var/spool/mqueue/q4 is empty<br />
/var/spool/mqueue/q3 is empty<br />
/var/spool/mqueue/q2 is empty<br />
/var/spool/mqueue/q5 is empty<br />
/var/spool/mqueue/q1 is empty<br />
/var/spool/mqueue/q7 is empty<br />
/var/spool/mqueue/q8 is empty<br />
Total requests: 0</code></p>
<p>Note: if you want to add more folders to the configuration all you have to do is to create the respective folders, set the appropriate permissions and restart sendmail.</p>
<p>If you had existing mails in the queue (most likely if you were looking for this solution), if you want them still processed, move them from /var/spool/mqueue in one of the newly created queues (q1 for ex).</p>
<p>Individual queue directories can be symbolic links to other partitions to spreads load among multiple disks. Queue IDs are unique across queues so you can move the items among queues if you have to.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nataprawira.com/tech/2011/01/13/sendmail-multiple-queues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fully Optimized Sendmail.mc</title>
		<link>http://blog.nataprawira.com/tech/2010/12/24/fully-optimized-sendmail-mc/</link>
		<comments>http://blog.nataprawira.com/tech/2010/12/24/fully-optimized-sendmail-mc/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 17:54:13 +0000</pubDate>
		<dc:creator>Denie</dc:creator>
				<category><![CDATA[BASH]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sendmail]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[optimize]]></category>

		<guid isPermaLink="false">http://blog.nataprawira.com/tech/?p=185</guid>
		<description><![CDATA[

This is what I&#8217;m currently using on &#8220;sendmail.mc&#8221;. So far quite good and I can blast around 100K emails within few hours. Enjoy!
divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4&#8242;)dnl
VERSIONID(`setup for linux&#8217;)dnl
OSTYPE(`linux&#8217;)dnl
define(`confDEF_USER_ID&#8217;, &#8220;8:12&#8221;)dnl
dnl define(`confAUTO_REBUILD&#8217;)dnl
define(`confTO_CONNECT&#8217;, `1m&#8217;)dnl
define(`confTRY_NULL_MX_LIST&#8217;, `True&#8217;)dnl
define(`confDONT_PROBE_INTERFACES&#8217;, `True&#8217;)dnl
define(`PROCMAIL_MAILER_PATH&#8217;, `/usr/bin/procmail&#8217;)dnl
define(`ALIAS_FILE&#8217;, `/etc/aliases&#8217;)dnl
define(`STATUS_FILE&#8217;, `/var/log/mail/statistics&#8217;)dnl
define(`UUCP_MAILER_MAX&#8217;, `2000000&#8242;)dnl
define(`confUSERDB_SPEC&#8217;, `/etc/mail/userdb.db&#8217;)dnl
define(`confPRIVACY_FLAGS&#8217;, `authwarnings,novrfy,noexpn,restrictqrun&#8217;)dnl
define(`confAUTH_OPTIONS&#8217;, `A&#8217;)dnl
define(`confCHECKPOINTINTERVAL&#8217;,`0&#8242;)dnl
define(`confCONNECTION_RATE_THROTTLE&#8217;,`0&#8242;)dnl
define(`confDF_BUFFER_SIZE&#8217;,`16384&#8242;)dnl
define(`confMAX_DAEMON_CHILDREN&#8217;,`0&#8242;)dnl
define(`confMAX_QUEUE_RUN_SIZE&#8217;,`0&#8242;)dnl
define(`confMCI_CACHE_SIZE&#8217;,`4&#8242;)dnl
define(`confMCI_CACHE_TIMEOUT&#8217;,`120s&#8217;)dnl
define(`confMIN_QUEUE_AGE&#8217;,`0&#8242;)dnl
define(`confSAFE_QUEUE&#8217;,`false&#8217;)dnl
define(`confTO_IDENT&#8217;,`0&#8242;)dnl
define(`confXF_BUFFER_SIZE&#8217;,`16384&#8242;)dnl
define(`confQUEUE_LA&#8217;,`1000&#8242;)dnl
define(`confREFUSE_LA&#8217;,`500&#8242;)dnl
FEATURE(`nocanonify&#8217;, `canonify_hosts&#8217;)dnl
FEATURE(`no_default_msa&#8217;, `dnl&#8217;)dnl
FEATURE(`mailertable&#8217;, `hash -o /etc/mail/mailertable.db&#8217;)dnl
FEATURE(`virtusertable&#8217;, `hash -o /etc/mail/virtusertable.db&#8217;)dnl
FEATURE(redirect)dnl
dnl # FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(local_procmail, `&#8217;, `procmail -t -Y -a $h -d $u&#8217;)dnl
FEATURE(`access_db&#8217;, [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2010%2F12%2F24%2Ffully-optimized-sendmail-mc%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2010%2F12%2F24%2Ffully-optimized-sendmail-mc%2F" height="61" width="51" /></a></div>
<!-- ALL ADSENSE ADS DISABLED -->
<p><strong>This is what I&#8217;m currently using on &#8220;sendmail.mc&#8221;. So far quite good and I can blast around 100K emails within few hours. Enjoy!<span id="more-185"></span></strong></p>
<p>divert(-1)dnl<br />
include(`/usr/share/sendmail-cf/m4/cf.m4&#8242;)dnl<br />
VERSIONID(`setup for linux&#8217;)dnl<br />
OSTYPE(`linux&#8217;)dnl<br />
define(`confDEF_USER_ID&#8217;, &#8220;8:12&#8221;)dnl<br />
dnl define(`confAUTO_REBUILD&#8217;)dnl<br />
define(`confTO_CONNECT&#8217;, `1m&#8217;)dnl<br />
define(`confTRY_NULL_MX_LIST&#8217;, `True&#8217;)dnl<br />
define(`confDONT_PROBE_INTERFACES&#8217;, `True&#8217;)dnl<br />
define(`PROCMAIL_MAILER_PATH&#8217;, `/usr/bin/procmail&#8217;)dnl<br />
define(`ALIAS_FILE&#8217;, `/etc/aliases&#8217;)dnl<br />
define(`STATUS_FILE&#8217;, `/var/log/mail/statistics&#8217;)dnl<br />
define(`UUCP_MAILER_MAX&#8217;, `2000000&#8242;)dnl<br />
define(`confUSERDB_SPEC&#8217;, `/etc/mail/userdb.db&#8217;)dnl<br />
define(`confPRIVACY_FLAGS&#8217;, `authwarnings,novrfy,noexpn,restrictqrun&#8217;)dnl<br />
define(`confAUTH_OPTIONS&#8217;, `A&#8217;)dnl<br />
define(`confCHECKPOINTINTERVAL&#8217;,`0&#8242;)dnl<br />
define(`confCONNECTION_RATE_THROTTLE&#8217;,`0&#8242;)dnl<br />
define(`confDF_BUFFER_SIZE&#8217;,`16384&#8242;)dnl<br />
define(`confMAX_DAEMON_CHILDREN&#8217;,`0&#8242;)dnl<br />
define(`confMAX_QUEUE_RUN_SIZE&#8217;,`0&#8242;)dnl<br />
define(`confMCI_CACHE_SIZE&#8217;,`4&#8242;)dnl<br />
define(`confMCI_CACHE_TIMEOUT&#8217;,`120s&#8217;)dnl<br />
define(`confMIN_QUEUE_AGE&#8217;,`0&#8242;)dnl<br />
define(`confSAFE_QUEUE&#8217;,`false&#8217;)dnl<br />
define(`confTO_IDENT&#8217;,`0&#8242;)dnl<br />
define(`confXF_BUFFER_SIZE&#8217;,`16384&#8242;)dnl<br />
define(`confQUEUE_LA&#8217;,`1000&#8242;)dnl<br />
define(`confREFUSE_LA&#8217;,`500&#8242;)dnl<br />
FEATURE(`nocanonify&#8217;, `canonify_hosts&#8217;)dnl<br />
FEATURE(`no_default_msa&#8217;, `dnl&#8217;)dnl<br />
FEATURE(`mailertable&#8217;, `hash -o /etc/mail/mailertable.db&#8217;)dnl<br />
FEATURE(`virtusertable&#8217;, `hash -o /etc/mail/virtusertable.db&#8217;)dnl<br />
FEATURE(redirect)dnl<br />
dnl # FEATURE(always_add_domain)dnl<br />
FEATURE(use_cw_file)dnl<br />
FEATURE(use_ct_file)dnl<br />
FEATURE(local_procmail, `&#8217;, `procmail -t -Y -a $h -d $u&#8217;)dnl<br />
FEATURE(`access_db&#8217;, `hash -T&lt;TMPF&gt; -o /etc/mail/access.db&#8217;)dnl<br />
EXPOSED_USER(`root&#8217;)dnl<br />
DAEMON_OPTIONS(`Name=MTA-v4, Family=inet&#8217;)<br />
LOCAL_DOMAIN(`localhost.localdomain&#8217;)dnl<br />
MODIFY_MAILER_FLAGS(`PROCMAIL&#8217;, `+m&#8217;)dnl<br />
dnl # INPUT_MAIL_FILTER(`dk-filter&#8217;, `S=inet:8891@localhost&#8217;)dnl<br />
FEATURE(`dnsbl&#8217;,`bl.spamcop.net&#8217;,`554 Mail from $&amp;{client_addr} rejected by bl.spamcop.net&#8217;)dnl<br />
FEATURE(`dnsbl&#8217;,`rbl-plus.mail-abuse.org&#8217;,`&#8221;MAPS-listed host: http://mail-abuse.org/cgi-bin/lookup?&#8221;$&amp;{client_addr}&#8217;)dnl<br />
FEATURE(`dnsbl&#8217;,`sbl-xbl.spamhaus.org&#8217;,`554 Mail from $&amp;{client_addr} has been rejected by the Spamhaus Blackhole List&#8217;)dnl<br />
FEATURE(`dnsbl&#8217;,`dnsbl.sorbs.net&#8217;,`554 Mail from $&amp;{client_addr} has been rejected by the SORBS&#8217;)dnl<br />
MAILER(smtp)dnl<br />
MAILER(procmail)dnl</p>
<hr />[root@edm mail]# cat /proc/meminfo<br />
MemTotal:        8455500 kB</p>
<hr />[root@edm mail]# cat /proc/cpuinfo<br />
processor       : 0<br />
vendor_id       : AuthenticAMD<br />
cpu family      : 16<br />
model           : 2<br />
model name      : Quad-Core AMD Opteron(tm) Processor 2350 HE<br />
stepping        : 3<br />
cpu MHz         : 1995.000<br />
cache size      : 512 KB<br />
fpu             : yes<br />
fpu_exception   : yes<br />
cpuid level     : 5<br />
wp              : yes<br />
flags           : fpu de tsc msr pae cx8 apic cmov pat clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc pni cx16 popcnt lahf_lm cmp_legacy extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch<br />
bogomips        : 3999.51<br />
TLB size        : 1024 4K pages<br />
clflush size    : 64<br />
cache_alignment : 64<br />
address sizes   : 48 bits physical, 48 bits virtual<br />
power management: ts ttp tm stc 100mhzsteps hwpstate</p>
<p>processor       : 1<br />
vendor_id       : AuthenticAMD<br />
cpu family      : 16<br />
model           : 2<br />
model name      : Quad-Core AMD Opteron(tm) Processor 2350 HE<br />
stepping        : 3<br />
cpu MHz         : 1995.000<br />
cache size      : 512 KB</p>
<p>processor       : 2<br />
vendor_id       : AuthenticAMD<br />
cpu family      : 16<br />
model           : 2<br />
model name      : Quad-Core AMD Opteron(tm) Processor 2350 HE<br />
stepping        : 3<br />
cpu MHz         : 1995.000<br />
cache size      : 512 KB</p>
<p>processor       : 3<br />
vendor_id       : AuthenticAMD<br />
cpu family      : 16<br />
model           : 2<br />
model name      : Quad-Core AMD Opteron(tm) Processor 2350 HE<br />
stepping        : 3<br />
cpu MHz         : 1995.000<br />
cache size      : 512 KB</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nataprawira.com/tech/2010/12/24/fully-optimized-sendmail-mc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tuning Sendmail</title>
		<link>http://blog.nataprawira.com/tech/2010/12/24/tuning-sendmail/</link>
		<comments>http://blog.nataprawira.com/tech/2010/12/24/tuning-sendmail/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 17:20:01 +0000</pubDate>
		<dc:creator>Denie</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sendmail]]></category>
		<category><![CDATA[Tricks]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Tuning]]></category>

		<guid isPermaLink="false">http://blog.nataprawira.com/tech/?p=183</guid>
		<description><![CDATA[

# Copyright (c) 2001 Sendmail, Inc. and its suppliers.
#	All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#	$Id: TUNING,v 1.16 2001/08/19 21:03:38 gshapiro Exp $
#
********************************************
** This is a DRAFT, comments are welcome! **
********************************************
If [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2010%2F12%2F24%2Ftuning-sendmail%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2010%2F12%2F24%2Ftuning-sendmail%2F" height="61" width="51" /></a></div>
<!-- ALL ADSENSE ADS DISABLED -->
<p># Copyright (c) 2001 Sendmail, Inc. and its suppliers.<br />
#	All rights reserved.<br />
#<br />
# By using this file, you agree to the terms and conditions set<br />
# forth in the LICENSE file which can be found at the top level of<br />
# the sendmail distribution.<br />
#<br />
#	$Id: TUNING,v 1.16 2001/08/19 21:03:38 gshapiro Exp $<br />
#<span id="more-183"></span></p>
<p>********************************************<br />
** This is a DRAFT, comments are welcome! **<br />
********************************************</p>
<p>If the default configuration of sendmail does not achieve the<br />
required performance, there are several configuration options that<br />
can be changed to accomplish higher performance.  However, before<br />
those options are changed it is necessary to understand why the<br />
performance is not as good as desired.  This may also involve hardware<br />
and software (OS) configurations which are not extensively explored<br />
in this document.  We assume that your system is not limited by<br />
network bandwidth because optimizing for this situation is beyond<br />
the scope of this guide.  In almost all other cases performance will<br />
be limited by disk I/O.</p>
<p>This text assumes that all options which are mentioned here are<br />
familiar to the reader, they are explained in the Sendmail Installation<br />
and Operations Guide; doc/op/op.txt.</p>
<p>There are basically three different scenarios which are treated<br />
in the following:<br />
* Mailing Lists and Large Aliases (1-n Mailing)<br />
* 1-1 Mass Mailing<br />
* High Volume Mail</p>
<p>Depending on your requirements, these may need different options<br />
to optimize sendmail for the particular purpose.  It is also possible<br />
to configure sendmail to achieve good performance in all cases, but<br />
it will not be optimal for any specific purpose.  For example, it<br />
is non-trivival to combine low latency (fast delivery of incoming<br />
mail) with high overall throughput.</p>
<p>Before we explore the different scenarios, a basic discussion about<br />
disk I/O, delivery modes, and queue control is required.</p>
<p>* Disk I/O<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>In general mail will be written to disk up before a delivery attempt<br />
is made.  This is required for reliability and should only be changed<br />
in a few specific cases that are mentioned later on.  To achieve<br />
better disk I/O performance the queue directories can be spread<br />
over several disks to distribute the load.  This is some basic tuning<br />
that should be done in all cases where the I/O speed of a single<br />
disk is exceeded, which is true for almost every high-volume<br />
situation except if a special disk subsystem with large (NV)RAM<br />
buffer is used.</p>
<p>Depending on your OS there might be ways to speed up I/O, e.g.,<br />
using softupdates or turning on the noatime mount option.  If this<br />
is done make sure the filesystem is still reliable, i.e., if fsync()<br />
returns without an error, the file has really been committed to<br />
disk.</p>
<p>* Queueing Strategies and DeliveryMode<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>There are basically three delivery modes:</p>
<p>background: incoming mail will be immediately delivered by a new process<br />
interactive: incoming mail will be immediately delivered by the same process<br />
queue: incoming mail will be queued and delivered by a queue runner later on</p>
<p>The first offers the lowest latency without the disadvantage of the<br />
second, which keep the connection from the sender open until the<br />
delivery to the next hop succeeded or failed.  However, it does not<br />
allow for a good control over the number of delivery processes other<br />
than limiting the total number of direct children of the daemon<br />
processes (MaxChildren) or by load control options (RefuseLA,<br />
DelayLA).  Moreover, it can&#8217;t make as good use as &#8216;queue&#8217; mode can<br />
for connection caching.</p>
<p>Interactive DeliveryMode should only be used in rare cases, e.g.,<br />
if the delivery time to the next hop is a known quantity or if the<br />
sender is under local control and it does not matter if it has to<br />
wait for delivery.</p>
<p>Queueing up e-mail before delivery is done by a queue runner allows<br />
the best load control but does not achieve as low latency as the<br />
other two modes.  However, this mode is probably also best for<br />
concurrent delivery since the number of queue runners can be specified<br />
on a queue group basis.  Persistent queue runners (-qp) can be used<br />
to minimize the overhead for creating processes because they just<br />
sleep for the specified interval (which shold be short) instead of<br />
exiting after a queue run.</p>
<p>* Queue Groups<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>In most situations disk I/O is a bottleneck which can be mitigated<br />
by spreading the load over several disks.  This can easily be achieved<br />
with different queue directories.  sendmail 8.12 introduces queue<br />
groups which are collections of queue directories with similar<br />
properties, i.e., number of processes to run the queues in the<br />
group, maximum number of recipients within an e-mail (envelope),<br />
etc.  Queue groups allow control over the behaviour of different<br />
queues.  Depending on the setup, it is usually possible to have<br />
several queue runners delivering mails concurrently which should<br />
increase throughput.  The number of queue runners can be controlled<br />
per queue group (Runner=) and overall (MaxQueueChildren).</p>
<p>* DNS Lookups<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>sendmail performs by default host name canonifications by using<br />
host name lookups.  This process is meant to replace unqualified<br />
host name with qualified host names, and CNAMEs with the non-aliased<br />
name.  However, these lookups can take a while for large address<br />
lists, e.g., mailing lists.  If you can assure by other means that<br />
host names are canonical, you should use</p>
<p>FEATURE(`nocanonify&#8217;, `canonify_hosts&#8217;)</p>
<p>in your .mc file.  For further information on this feature and<br />
additional options see cf/README.  If sendmail is invoked directly<br />
to send e-mail then either the -G option should be used or</p>
<p>define(`confDIRECT_SUBMISSION_MODIFIERS&#8217;, `C&#8217;)</p>
<p>should be added to the .mc file.</p>
<p>* Mailing Lists and Large Aliases (1-n Mailing)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Before 8.12 sendmail delivers an e-mail sequentially to all its<br />
recipients.  For mailing lists or large aliases the overall delivery<br />
time can be substantial, especially if some of the recipients are located<br />
at hosts that are slow to accept e-mail.  Some mailing list software<br />
therefore &#8220;split&#8221; up e-mails into smaller pieces with fewer recipients.<br />
sendmail 8.12 can do this itself, either across queue groups or<br />
within a queue directory.  For the former the option SplitAcrossQueueGroups<br />
option must be set, the latter is controlled by the &#8216;r=&#8217; field of<br />
a queue group declaration.</p>
<p>Let&#8217;s assume a simple example: a mailing lists where most of<br />
the recipients are at three domains: the local one (local.domain)<br />
and two remotes (one.domain, two.domain) and the rest is splittered<br />
over several other domains.  For this case it is useful to specify<br />
three queue groups:</p>
<p>QUEUE_GROUP(`local&#8217;, `P=/var/spool/mqueue/local, F=f, R=2, I=1m&#8217;)dnl<br />
QUEUE_GROUP(`one&#8217;, `P=/var/spool/mqueue/one, F=f, r=50, R=3&#8242;)dnl<br />
QUEUE_GROUP(`two&#8217;, `P=/var/spool/mqueue/two, F=f, r=30, R=4&#8242;)dnl<br />
QUEUE_GROUP(`remote&#8217;, `P=/var/spool/mqueue/remote, F=f, r=5, R=8, I=2m&#8217;)dnl<br />
define(`ESMTP_MAILER_QGRP&#8217;, `remote&#8217;)dnl<br />
define(`confSPLIT_ACROSS_QUEUEGROUPS&#8217;, `True&#8217;)dnl<br />
define(`confDELIVERY_MODE&#8217;, `q&#8217;)dnl<br />
define(`confMAX_QUEUE_CHILDREN&#8217;, `50&#8242;)dnl<br />
define(`confMIN_QUEUE_AGE&#8217;, `27m&#8217;)dnl</p>
<p>and specify the queuegroup ruleset as follows:</p>
<p>LOCAL_RULESETS<br />
Squeuegroup<br />
R$* @ local.domain	$# local<br />
R$* @ $* one.domain	$# one<br />
R$* @ $* two.domain	$# two<br />
R$* @ $*		$# remote<br />
R$*			$# mqueue</p>
<p>Now it is necessary to control the number of queue runners, which<br />
is done by MaxQueueChildren.  Starting the daemon with the option<br />
-q5m assures that the first delivery attempt for each e-mail is<br />
done within 5 minutes, however, there are also individual queue<br />
intervals for the queue groups as specified above.  MinQueueAge<br />
is set to 27 minutes to avoid that entries are run too often.</p>
<p>Notice: if envelope splitting happens due to alias expansion, and<br />
DeliveryMode is not &#8216;i&#8217;nteractive, then only one envelope is sent<br />
immediately.  The rest (after splitting) are queued up and queue<br />
runners must come along and take care of them.  Hence it is essential<br />
that the queue interval is very short.</p>
<p>* 1-1 Mass Mailing<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>In this case some program generates e-mails which are sent to<br />
individual recipients (or at most very few per e-mail).  A simple<br />
way to achieve high throughput is to set the delivery mode to<br />
&#8216;interactive&#8217;, turn off the SuperSafe option and make sure that the<br />
program that generates the mails can deal with mail losses if the<br />
server loses power.  In no other case should SuperSafe be set to<br />
&#8216;false&#8217;.  If these conditions are met, sendmail does not need to<br />
commit mails to disk but can buffer them in memory which will greatly<br />
enhance performance, especially compared to normal disk subsystems, e.g.,<br />
non solid-state disks.</p>
<p>* High Volume Mail<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>For high volume mail it is necessary to be able to control the load<br />
on the system.  Therefore the &#8216;queue&#8217; delivery mode should be used,<br />
and all options related to number of processes and the load should<br />
be set to reasonable values.  It is important not to accept mail<br />
faster than it can be delivered otherwise the system will be<br />
overwhelmed.  Hence RefuseLA should be lower than QueueLA, the number<br />
of daemon children should probably be lower than the number of queue<br />
runnners (MaxChildren vs. MaxQueueChildren).  DelayLA is a new option<br />
in 8.12 which allows delaying connections instead of rejecting them.<br />
This may result in a smoother load distribution depending on how<br />
the mails are submitted to sendmail.</p>
<p>* Miscellaneous<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Other options that are interesting to tweak performance are<br />
(in no particular order):</p>
<p>SuperSafe: if interactive DeliveryMode is used, then this can<br />
be set to the new value &#8220;interactive&#8221; in 8.12 to save some disk<br />
synchronizations which are not really necessary in that mode.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Source:<br />
http://luxio.us/gXwyLu</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nataprawira.com/tech/2010/12/24/tuning-sendmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up DomainKeys on Centos</title>
		<link>http://blog.nataprawira.com/tech/2010/03/09/setting-up-domainkeys-on-centos/</link>
		<comments>http://blog.nataprawira.com/tech/2010/03/09/setting-up-domainkeys-on-centos/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 14:30:22 +0000</pubDate>
		<dc:creator>Denie</dc:creator>
				<category><![CDATA[BASH]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sendmail]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[DKIM]]></category>
		<category><![CDATA[DomainKeys]]></category>

		<guid isPermaLink="false">http://blog.nataprawira.com/tech/?p=140</guid>
		<description><![CDATA[

This is a quick walk through on how to set up domain keys on Centos 5 using sendmail. It should also be very similar for Redhat or Fedora.

Domainkeys is a method mostly used by yahoo to verify that the sender of an email is valid. I did notice that gmail changes the domainkeys header line [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2010%2F03%2F09%2Fsetting-up-domainkeys-on-centos%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2010%2F03%2F09%2Fsetting-up-domainkeys-on-centos%2F" height="61" width="51" /></a></div>
<!-- ALL ADSENSE ADS DISABLED -->
<h2><span style="font-weight: normal;font-size: 13px">This is a quick walk through on how to set up domain keys on Centos 5 using sendmail. It should also be very similar for Redhat or Fedora.</span></h2>
<div>
<p>Domainkeys is a method mostly used by yahoo to verify that the sender of an email is valid. I did notice that gmail changes the domainkeys header line to a pass value but I don’t know if they block/accept mail based on that.<span id="more-140"></span></p>
<p>First install some dependencies.</p>
<blockquote><p><strong>yum install sendmail-devel openssl-devel</strong></p></blockquote>
<p>First download the latest version of dk-milter by going to http://sourceforge.net/projects/dk-milter/</p>
<blockquote><p><strong>cd /usr/src/<br />
wget http://downloads.sourceforge.net/dk-milter/dk-milter-1.0.0.tar.gz</strong></p></blockquote>
<p>Then extract it using the command</p>
<blockquote><p><strong>tar xzf dk-milter-1.0.0.tar.gz<br />
cd dk-milter-2.6.0</strong></p></blockquote>
<p>Start by copying the sample config file to the proper directory and the make/make installing</p>
<blockquote><p><strong>cp site.config.m4.dist devtools/Site/site.config.m4<br />
make; make install</strong></p>
<p><span> </span></p></blockquote>
<p>You may see a few errors during the install, as long as they are just about creating the man pages you should be alright. Now change back to a good working directory and create your new keys.</p>
<blockquote><p><strong>cd ~/ssl-gen<br />
openssl genrsa -out rsa.private 768<br />
openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM</strong></p></blockquote>
<p>Make the directory and move the private key into it.</p>
<blockquote><p><strong>mkdir -p /var/db/domainkeys/<br />
cp rsa.private /var/db/domainkeys/mail.key.pem</strong></p></blockquote>
<p>Now we should set up our DNS TXT records with our public key. This is how it should look in a bind zone file. Put the public key only and not the “BEGIN RSA PRIVATE…” or “END RSA…” parts of the key with out parenthesis.</p>
<blockquote><p><strong>mail._domainkey.jkurtzman.com.         IN TXT  “k=rsa; t=y; p=(Paste the public key here)”<br />
_domainkey.jkurtzman.com.                 IN TXT  “t=y; o=~”</strong></p></blockquote>
<p>You can use the following command to verify that your TXT record was set up correctly.</p>
<blockquote><p><strong>dig +short mail._domainkey.jkurtzman.com TXT</strong></p></blockquote>
<p>Now we will need to make the init script so the it starts when the computer reboots. Put the following into a file called <strong>/etc/init.d/domainkeys</strong>. Of course be sure to change the domain to your own domain. Remember to fix any lines that have wrapped when copying. Especially the COMMAND line.</p>
<blockquote><p><strong>#!/bin/sh<br />
#<br />
# “/etc/rc.d/init.d/dk-filter”<br />
# Start/stop script for the dk-filter daemon on RedHat Linux<br />
#<br />
# chkconfig: – 79 31<br />
# description: Acts as the “dk-filter” InputMailFilter (milter) for the \<br />
# Sendmail MTA to provide DomainKeys service</strong></p>
<p><strong>############################################################<br />
#<br />
# Be sure to edit these values:<br />
#<br />
KEYFILE=”/var/db/domainkeys/mail.key.pem”<br />
DOMAIN=”jkurtzman.com”<br />
SELECTOR=”mail”<br />
USER=”domainkeys”<br />
#<br />
############################################################</strong></p>
<p><strong>PIDFILE=”/var/run/dk-milter/pid”<br />
SUBMISSION_DAEMON=”smtp”<br />
PORT=8891</strong></p>
<p><strong># Source function library. Provides the “status” option<br />
. /etc/init.d/functions</strong></p>
<p><strong>test -x `which dk-filter` || exit 0</strong></p>
<p><strong>RETVAL=0</strong></p>
<p><strong>start() {<br />
echo -n $”Starting dk-filter: ”<br />
COMMAND=”dk-filter -u $USER -b s -p inet:$PORT@localhost -l -P $PIDFILE -s $KEYFILE -d $DOMAIN -S $SELECTOR -m$SUBMISSION_DAEMON -c nofws”<br />
# echo -e “Now executing\n”$COMMAND”&#8221;<br />
daemon $COMMAND<br />
RETVAL=$?<br />
echo<br />
[ $RETVAL -eq 0 ] &amp;&amp; touch /var/lock/subsys/dk-filter<br />
return $RETVAL<br />
}</strong></p>
<p><strong>stop() {<br />
echo -n $”Stopping dk-filter: ”<br />
killproc dk-filter<br />
RETVAL=$?<br />
echo<br />
[ $RETVAL -eq 0 ] &amp;&amp; rm -f $PIDFILE /var/lock/subsys/dk-filter<br />
return $RETVAL<br />
}</strong></p>
<p><strong>restart() {<br />
stop<br />
start<br />
}</strong></p>
<p><strong>case “$1″ in<br />
start)<br />
start<br />
;;<br />
stop)<br />
stop<br />
;;<br />
status)<br />
status dk-filter<br />
;;<br />
restart)<br />
restart<br />
;;<br />
*)<br />
echo $”Usage: $0 {start|stop|status|restart}”<br />
exit 1<br />
esac</strong></p>
<p><strong>exit $?</strong></p></blockquote>
<p>Give your new file execute permisions, create a user for domain keys to run as, and start it</p>
<blockquote><p><strong>chmod +x /etc/init.d/domainkeys<br />
useradd domainkeys<br />
service domainkeys start</strong></p></blockquote>
<p>If everything work you should see that the dk-filter has started.<br />
Now run chkconfig so the service starts when you reboot.</p>
<blockquote><p><strong>chkconfig domainkeys on</strong></p></blockquote>
<p>Now add this to your /etc/mail/sendmail.mc file.</p>
<blockquote><p><strong>INPUT_MAIL_FILTER(`dk-filter’, `S=inet:8891@localhost’)</strong></p></blockquote>
<p>And make and restart sendmail.</p>
<blockquote><p><strong>cd /etc/mail<br />
make<br />
service sendmail restart</strong></p></blockquote>
<p>You should now be able to send email and be domainkey verified. If you are relaying mail through the mail server you will need to make sure you are using SMTP Authentication otherwise the  dk-filter will not add the header information.</p>
<p>Try sending an email to a yahoo account and see if you get secure icon.</p>
<p><span style="font-family: 'Trebuchet MS';font-size: x-small"> </span></p>
<h1><span style="font-family: 'Trebuchet MS'">Source:</span></h1>
<h1><span style="font-family: 'Trebuchet MS'"><a href="http://luxio.us/cMZ11e" target="_blank">http://luxio.us/cMZ11e </a></span></h1>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.nataprawira.com/tech/2010/03/09/setting-up-domainkeys-on-centos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimizing Sendmail</title>
		<link>http://blog.nataprawira.com/tech/2009/12/09/optimizing-sendmail/</link>
		<comments>http://blog.nataprawira.com/tech/2009/12/09/optimizing-sendmail/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 15:14:12 +0000</pubDate>
		<dc:creator>Denie</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sendmail]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[optimize]]></category>

		<guid isPermaLink="false">http://blog.nataprawira.com/tech/?p=125</guid>
		<description><![CDATA[

Most of them involve changing the daemon&#8217;s configuration in /etc/sendmail.mc and rebuilding sendmail.cf
Specific things that can affect performance:
dnl # Sendmail, Chap 24.9.13, Page 955
dnl # Disable re-write of queue control file (will result in duplicates
dnl #   if the daemon is interrupted during a delivery)
define(`confCHECKPOINTINTERVAL&#8217;,`0&#8242;)dnl
dnl # Sendmail, Chap 24.9.21, Page 960
dnl # Disable throttling the acceptance [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2009%2F12%2F09%2Foptimizing-sendmail%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2009%2F12%2F09%2Foptimizing-sendmail%2F" height="61" width="51" /></a></div>
<!-- ALL ADSENSE ADS DISABLED -->
<p>Most of them involve changing the daemon&#8217;s configuration in <strong>/etc/sendmail.mc</strong> and <span style="text-decoration: underline">rebuilding</span> <strong>sendmail.cf</strong></p>
<p><span style="text-decoration: underline">Specific things that can affect performance</span>:</p>
<p>dnl # Sendmail, Chap 24.9.13, Page 955<br />
dnl # Disable re-write of queue control file (will result in duplicates<br />
dnl #   if the daemon is interrupted during a delivery)<br />
<strong>define(`confCHECKPOINTINTERVAL&#8217;,`0&#8242;)dnl<span id="more-125"></span></strong></p>
<p>dnl # Sendmail, Chap 24.9.21, Page 960<br />
dnl # Disable throttling the acceptance of new connections<br />
<strong>define(`confCONNECTION_RATE_THROTTLE&#8217;,`0&#8242;)dnl</strong></p>
<p>dnl # Sendmail, Chap 24.9.25, Page 967<br />
dnl # Specify the maximum size, in bytes, of buffered df* files (default is<br />
dnl #   4096 bytes; 0 turns this off and is not recommended)<br />
<strong>define(`confDF_BUFFER_SIZE&#8217;,`16384&#8242;)dnl</strong></p>
<p>dnl # Sendmail, Chap 24.9.60, Page 1011<br />
dnl # Disable limit on the daemon spawning new children<br />
<strong>define(`confMAX_DAEMON_CHILDREN&#8217;,`0&#8242;)dnl </strong></p>
<p>dnl # Sendmail, Chap 24.9.66, Page 1016<br />
dnl # Disbale limit on the number of messages that may be processed<br />
dnl #  during any one queue run<br />
<strong>define(`confMAX_QUEUE_RUN_SIZE&#8217;,`0&#8242;)dnl</strong></p>
<p>dnl # Sendmail, Chap 24.9.19, Page 959<br />
dnl # Turn on connection caching and set maximum number of simultaneous<br />
dnl #  outbound connections kept open to 4; default is 2; this option also<br />
dnl #  depends on MCI_CACHE_TIMEOUT (below)<br />
<strong>define(`confMCI_CACHE_SIZE&#8217;,`4&#8242;)dnl </strong></p>
<p>dnl # Sendmail, Chap 24.9.19, Page 959<br />
dnl # Set time limit on how long a cached outbound connection may be<br />
dnl #  kept open to 120 seconds (2 minutes) &#8211; see MCI_CACHE_SIZE above<br />
<strong>define(`confMCI_CACHE_TIMEOUT&#8217;,`120s&#8217;)dnl</strong></p>
<p>dnl # Sendmail, Chap 24.9.72, Page 1022<br />
dnl # Disable time delay for queued messages not delivered on the first try<br />
<strong>define(`confMIN_QUEUE_AGE&#8217;,`0&#8242;)dnl </strong></p>
<p>dnl # Sendmail, Chapter 24.9.107, Page 1057<br />
dnl # Disable MTA setting that forces MTA to queue each message and to sync<br />
dnl #   to disk before forking (a system crash may result in lost mail)<br />
<strong>define(`confSAFE_QUEUE&#8217;,`false&#8217;)dnl</strong></p>
<p>dnl # Sendmail, Chap 24.9.109.13, Page 1065<br />
dnl # Disable IDENT (RFC 1413) calls/turn off sending user-host verification<br />
<strong>define(`confTO_IDENT&#8217;,`0&#8242;)dnl</strong></p>
<p>dnl # Sendmail, Chap 24.9.120, Page 1077<br />
dnl # Specify the maximum size, in bytes, of buffered xf* files (default is<br />
dnl #   4096 bytes; 0 turns this off and is not recommended)<br />
<strong>define(`confXF_BUFFER_SIZE&#8217;,`16384&#8242;)dnl</strong></p>
<p>dnl # Sendmail, Chap 4.8.28, Page 192<br />
dnl # Turn off E-Mail canonization (should be done by MSA, and this<br />
dnl #     is a mail relay with no local users)<br />
<strong>FEATURE(`nocanonify&#8217;)dnl</strong></p>
<p>I&#8217;m assuming you&#8217;re using a modern version of sendmail &#8211; v8.12.10 or later. These settings may be different, or not exist at all, for older versions.</p>
<p><em><strong><a title="http://www.experts-exchange.com/Software/Server_Software/Email_Servers/SendMail/Q_21598211.html" href="http://www.experts-exchange.com/Software/Server_Software/Email_Servers/SendMail/Q_21598211.html" target="_blank">Source</a></strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nataprawira.com/tech/2009/12/09/optimizing-sendmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to manually install DKIM-Filter with Sendmail</title>
		<link>http://blog.nataprawira.com/tech/2009/08/15/how-to-manually-install-dkim-filter-with-sendmail/</link>
		<comments>http://blog.nataprawira.com/tech/2009/08/15/how-to-manually-install-dkim-filter-with-sendmail/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 19:32:32 +0000</pubDate>
		<dc:creator>Denie</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sendmail]]></category>
		<category><![CDATA[DKIM]]></category>
		<category><![CDATA[Filter]]></category>

		<guid isPermaLink="false">http://blog.nataprawira.com/tech/?p=89</guid>
		<description><![CDATA[

Source: [click here]

Max 30 mins work.

However, life is rarely so simple.
yum search dkim didn't find anything.

So, based on what I could find, I ended up here. Downloaded dkim-filter
2.4.1 and went on an epic voyage of discovery into the RFCs and other stuff.
I just want to install, configure and run the thing!

Anyway. I thought compilation would [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2009%2F08%2F15%2Fhow-to-manually-install-dkim-filter-with-sendmail%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.nataprawira.com%2Ftech%2F2009%2F08%2F15%2Fhow-to-manually-install-dkim-filter-with-sendmail%2F" height="61" width="51" /></a></div>
<!-- ALL ADSENSE ADS DISABLED -->
<pre>Source: [<a href="http://www.mail-archive.com/dkim-milter-discuss@lists.sourceforge.net/msg00535.html" target="_blank">click here</a>]

Max 30 mins work.

However, life is rarely so simple.
yum search dkim didn't find anything.

So, based on what I could find, I ended up here. Downloaded dkim-filter
2.4.1 and went on an epic voyage of discovery into the RFCs and other stuff.
I just want to install, configure and run the thing!
<span id="more-89"></span>
Anyway. I thought compilation would be straightforward, but no. More
unfamiliar stuff to read. I dutifully read the site.config.m4.dist, copied
to devtools/Site/site.config.m4 and hoped to make some intelligent decisions
on what options to enable.

 # ./Build
...
&gt;Making all in:
&gt;/etc/mail/dkim/dkim-milter-2.4.1/dkim-filter
&gt;Configuration: pfx=, os=Linux, rel=2.6.23.1-10.fc7, rbase=2,
&gt;rroot=2.6.23.1-10, arch=x86_64, sfx=, variant=optimized
&gt;Using M4=/usr/bin/m4
&gt;Creating
&gt;/etc/mail/dkim/dkim-milter-2.4.1/obj.Linux.2.6.23.1-10.fc7.x86_64/dkim-filter
&gt;using /etc/mail/dkim/dkim-milter-2.4.1/devtools/OS/Linux
&gt;Making dependencies in
&gt;/etc/mail/dkim/dkim-milter-2.4.1/obj.Linux.2.6.23.1-10.fc7.x86_64/dkim-filter
&gt;make[1]: Entering directory
&gt;`/etc/mail/dkim/dkim-milter-2.4.1/obj.Linux.2.6.23.1-10.fc7.x86_64/dkim-filter'
&gt;rm -f sm_os.h
&gt;ln -f -s ../../include/sm/os/sm_os_linux.h sm_os.h
&gt;cc -M -I. -I../../include  -I../libdkim/   -D_REENTRANT config.c dkim-ar.c
&gt;dkim-filter.c stats.c test.c util.c   dkim-testkey.c   dkim-testssp.c    &gt;&gt;
&gt;Makefile
&gt;In file included from config.h:23,
&gt;                 from config.c:20:
&gt;dkim-filter.h:22:29: error: libmilter/mfapi.h: No such file or directory
&gt;In file included from dkim-ar.h:19,
&gt;                 from dkim-ar.c:23:
&gt;dkim-filter.h:22:29: error: libmilter/mfapi.h: No such file or directory
&gt;dkim-filter.c:59:29: error: libmilter/mfapi.h: No such file or directory
&gt;In file included from config.h:23,
&gt;                 from dkim-filter.c:78:
&gt;dkim-filter.h:22:29: error: libmilter/mfapi.h: No such file or directory
&gt;In file included from test.c:31:
&gt;test.h:24:29: error: libmilter/mfapi.h: No such file or directory
&gt;In file included from util.c:49:
&gt;dkim-filter.h:22:29: error: libmilter/mfapi.h: No such file or directory
&gt;make[1]: *** [depend] Error 1
&gt;make[1]: Leaving directory
&gt;`/etc/mail/dkim/dkim-milter-2.4.1/obj.Linux.2.6.23.1-10.fc7.x86_64/dkim-filter'
&gt;Making in
&gt;/etc/mail/dkim/dkim-milter-2.4.1/obj.Linux.2.6.23.1-10.fc7.x86_64/dkim-filter
&gt;make[1]: Entering directory
&gt;`/etc/mail/dkim/dkim-milter-2.4.1/obj.Linux.2.6.23.1-10.fc7.x86_64/dkim-filter'
&gt;cc -O2 -I. -I../../include  -I../libdkim/   -D_REENTRANT -DXP_MT   -c -o
&gt;config.o config.c
&gt;In file included from config.h:23,
&gt;                 from config.c:20:
&gt;dkim-filter.h:22:29: error: libmilter/mfapi.h: No such file or directory
&gt;In file included from config.h:23,
&gt;                 from config.c:20:
&gt;dkim-filter.h:86: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
&gt;before ‘mlfi_connect’
&gt;dkim-filter.h:87: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
&gt;before ‘mlfi_envfrom’
&gt;dkim-filter.h:88: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
&gt;before ‘mlfi_header’
&gt;dkim-filter.h:89: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
&gt;before ‘mlfi_eoh’
&gt;dkim-filter.h:90: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
&gt;before ‘mlfi_body’
&gt;dkim-filter.h:91: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
&gt;before ‘mlfi_eom’
&gt;dkim-filter.h:92: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
&gt;before ‘mlfi_abort’
&gt;dkim-filter.h:93: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
&gt;before ‘mlfi_close’
&gt;make[1]: *** [config.o] Error 1
&gt;make[1]: Leaving directory
&gt;`/etc/mail/dkim/dkim-milter-2.4.1/obj.Linux.2.6.23.1-10.fc7.x86_64/dkim-filter'
&gt;make: *** [all] Error 2

After some googling, a "yum install sendmail-devel" fixed this problem, and
a ./Build -c completed successfully.
I copied /devtools/OS/Linux to /devtools/Site/site.Linux.m4

./Build install was successful after manually creating dirs /usr/man/man15
and /usr/man/man18
Fedora manuals are in /usr/share/man
The files /usr/bin/dk* should have ownership root:root instead of bin.

Sendmail of Fedora 7 is currently 8.14.1:
# sendmail -d0.1
Version 8.14.1
Compiled with: DNSMAP HESIOD HES_GETMAILHOST LDAPMAP LOG MAP_REGEX
 MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6
 NETUNIX NEWDB NIS PIPELINING SASLv2 SCANF SOCKETMAP STARTTLS
 TCPWRAPPERS USERDB USE_LDAP_INIT

I created the keys, updated the dns zone files and decided to use user smmsp
instead of creating yet another user.

I created:
/var/db/dkim :
-rw-r----- 1 smmsp smmsp 887 2008-01-01 08:30 jan2008.admin.key.pem
-rw-r--r-- 1 smmsp smmsp 272 2008-01-01 08:30 jan2008.admin.public.pem

/var/run :
drwxr-xr-x 2 smmsp   smmsp   4096 2008-01-04 09:23 milter

and created this basic start/stop init script:
/etc/init.d/dkim-filter
then:
chkconfig --add dkim-filter
chkconfig dkim-filter on

contents:
&gt;#
&gt;# dkim-filter        Starts /usr/bin/dkim-filter
&gt;#
&gt;# chkconfig: 2345 67 33
&gt;#
&gt;# description: Domain Keys Milter
&gt;# processname: dkim-filter
&gt;#
&gt;# Source function library.
&gt;. /etc/init.d/functions
&gt;
&gt;[ -f /usr/bin/dkim-filter ] || exit 0
&gt;RETVAL=0
&gt;
&gt;umask 077
&gt;
&gt;start() {
&gt;        echo -n $"Starting dkim-filter: "
&gt;        /usr/bin/dkim-filter -x /etc/mail/dkim.conf
&gt;        RETVAL=$?
&gt;        if [ $RETVAL -eq 0 ]
&gt;        then
&gt;                echo_success
&gt;                touch /var/lock/subsys/dkim-filter
&gt;        else
&gt;                echo_failure
&gt;        fi
&gt;        echo
&gt;}
&gt;stop() {
&gt;        echo -n $"Shutting down dkim-filter: "
&gt;        /bin/kill `cat /var/run/milter/dkim-filter.pid 2&gt; /dev/null ` &gt;
&gt; /dev/null 2&gt;&amp;1
&gt;        RETVAL=$?
&gt;        sleep 3
&gt;        if [ $RETVAL -eq 0 ]
&gt;        then
&gt;                echo_success
&gt;                rm -f /var/lock/subsys/dkim-filter
&gt;                rm -f /var/run/milter/dkim-filter.pid
&gt;        else
&gt;                echo_failure
&gt;        fi
&gt;        echo
&gt;}
&gt;rhstatus() {
&gt;        status dkim-filter
&gt;}
&gt;restart() {
&gt;        stop
&gt;        start
&gt;}
&gt;
&gt;case "$1" in
&gt;  start)
&gt;        start
&gt;        ;;
&gt;  stop)
&gt;        stop
&gt;        ;;
&gt;  status)
&gt;        rhstatus
&gt;        ;;
&gt;  restart|reload)
&gt;        restart
&gt;        ;;
&gt;  condrestart)
&gt;        [ -f /var/lock/subsys/dkim-filter ] &amp;&amp; restart || :
&gt;        ;;
&gt;  *)
&gt;        echo $"Usage: $0 {start|stop|status|restart|condrestart}"
&gt;        exit 1
&gt;esac
&gt;
&gt;exit $?

Now for configuration files:

/etc/mail/dkim.conf :
Canonicalization        relaxed/simple
Domain                  /etc/mail/domains
KeyFile                 /var/db/dkim/jan2008.admin.key.pem
#MTA                    MTA
Selector                jan2008.admin
SignatureAlgorithm      rsa-sha256
Socket                  inet:[EMAIL PROTECTED]
#Socket                 /var/run/milter/dkim-filter.sock
Syslog                  Yes
SyslogSuccess           Yes
Userid                  smmsp
PidFile                 /var/run/milter/dkim-filter.pid
SubDomains              Yes
X-Header                No
SendReports             No

/etc/mail/domains contains just one domain on one line.

and added to sendmail.rc:
INPUT_MAIL_FILTER(`dkim-filter', `S=inet:[EMAIL PROTECTED]')

I started the script with
/etc/init.d/dkim-filter start
and it worked, eg:
&gt;Jan  4 10:58:10 gaia dkim-filter[6033]: Sendmail DKIM Filter v2.4.1 starting
&gt;(args: -x /etc/mail/dkim.conf)

It even adds signatures to my messages (hopefully to this one), but silently
crashes regularly without any indication on processing a simple locally
generated mail from a perl script and/or/exor from logwatch or virus
notification from MailScanner. eg:

DKIMDEBUG=ct :
&gt;Jan  3 02:57:18 gaia sendmail[12260]: m031vIL6012260: from=&lt;[EMAIL
&gt;PROTECTED]&gt;, size=1780,, nrcpts=1, msgid=&lt;[EMAIL PROTECTED]&gt;,
&gt;proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
&gt;Jan  3 02:57:18 gaia dkim-filter[6926]: thread 0x41e02950 header
&gt;Jan  3 02:57:18 gaia last message repeated 6 times
&gt;Jan  3 02:57:18 gaia dkim-filter[6926]: thread 0x41e02950 eoh
&gt;Jan  3 02:57:18 gaia sendmail[12260]: m031vIL6012260:
&gt;milter_sys_read(dkim-filter): cmd read returned 0, expecting 5
&gt;Jan  3 02:57:18 gaia sendmail[12260]: m031vIL6012260: Milter (dkim-filter): to
&gt;error state
&gt;Jan  3 02:57:18 gaia sendmail[12260]: m031vIL6012260: to=&lt;[EMAIL PROTECTED]&gt;,
&gt;delay=00:00:00, mailer=esmtp, pri=31780, stat=queued

I have spent the last couple of days trying to solve this
The only relevant information I found was Jim Hermann's useful message and
thread last month
<a rel="nofollow" href="http://www.mail-archive.com/dkim-milter-discuss@lists.sourceforge.net/msg00409.html">http://www.mail-archive.com/dkim-milter-discuss@lists.sourceforge.net/msg00409.html</a>

I'm disappointed, disillusioned and frustrated in trying to nail jelly to a
wall... This doesn't say anything useful at all!
&gt;milter_sys_read(dkim-filter): cmd read returned 0, expecting 5

It only seems to happen by locally generated mail, sometimes it even seemed
as if having a Reply-To: field influenced its crash frequency, but without
real diagnostic tools, skills and a lot of time, I can't solve it. I'm an
experienced sysadmin, not a C programmer! Programmers should try to make all
our lives easier! <img src='http://blog.nataprawira.com/tech/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> 

I want to get this working reliably and dependably on a few production
systems, and know what options to compile with and what settings to use for
Fedora, but I'm now stumped.

When it does work, another gripe is this padding too short error, which may
or may not be a reason for the verification failure:
&gt;Jan  4 08:14:35 gaia dkim-filter[8389]: m047EY6O010080 SSL error:04067069:rsa
&gt;routines:RSA_EAY_PUBLIC_DECRYPT:pkcs1 padding too short; error:04077068:rsa
&gt;routines:RSA_verify:bad signature
&gt;Jan  4 08:14:35 gaia dkim-filter[8389]: m047EY6O010080: bad signature data
&gt;Jan  4 08:14:35 gaia sendmail[10080]: m047EY6O010080: Milter insert (1):
&gt;header: Authentication-Results:  gaia.haveland.com; dkim=neutral (verification
&gt;failed) [EMAIL PROTECTED]

How can a gmail signature fail verification? What did it fail on? What is
the "i" in  "header.i" ?
It was a mysql mailing list, so perhaps other headers got in the way, but
this isn't what I would call a robust solution! Omitheaders command in
dkim.conf seems to be a blanket fudge.

If we are to stand a chance of defeating spammers, then we have to make DKIM
easier to install and configure so mere mortals can install and use it, and
encourage adoption.  I'm sure many would like to see dkim-filter available
in rpm for various distros.

However, Network Solutions, amongst others need to wake up and allow people
to modify their DNS TXT attributes... Here's what their completely
ridiculous FAQ says on the subject:
<a rel="nofollow" href="http://customersupport.networksolutions.com/article.php?id=369">http://customersupport.networksolutions.com/article.php?id=369</a>

&gt;"Can I Make Changes To The TXT Record
&gt;
&gt; Network Solutions does not currently support changes to the
&gt; TXT record for a domain name registration.
&gt;
&gt; The TXT Record is strictly informational, not functional."

What planet are they living on?

Cheers,
Andy.</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.nataprawira.com/tech/2009/08/15/how-to-manually-install-dkim-filter-with-sendmail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

