<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[iRedMail — Possible bug in the Amavis config, breaking DKIM]]></title>
	<link rel="self" href="https://forum.iredmail.org/feed-atom-topic21123.xml" />
	<updated>2026-04-09T01:51:33Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.iredmail.org/topic21123-possible-bug-in-the-amavis-config-breaking-dkim.html</id>
		<entry>
			<title type="html"><![CDATA[Re: Possible bug in the Amavis config, breaking DKIM]]></title>
			<link rel="alternate" href="https://forum.iredmail.org/post91865.html#p91865" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>ZhangHuangbin wrote:</cite><blockquote><p>Not sure whether it&#039;s modified by amavisd, but Postfix might handle this by default since it has &quot;disable_mime_input_processing = no&quot; and &quot;disable_mime_output_conversion = no&quot; (both are set to &quot;no&quot; by default which means Postfix will do mime processing / conversion), it modifies MIME if it&#039;s not RFC-compliant, it&#039;s good in your case since you don&#039;t have correct &quot;Date:&quot;, but it might break DKIM signature too if it happens after signing. Anyway, you already found the solution and it&#039;s easy: generate RFC-compliant mime at the very beginning. <img src="https://forum.iredmail.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p></blockquote></div><p>No, that actually fixes the symptom, which is failing DKIM signatures.&nbsp; Fixing the <em>problem</em> would be changing the configuration slightly so that it does the DKIM-signing <em>last</em> and subsequently doesn&#039;t wind up changing fields that are protected by the DKIM signature.</p><p>I mean, what good is it if the thing DKIM failing was indicating was that the mail was tampered with by an overly-pedantic anti-virus program?</p>]]></content>
			<author>
				<name><![CDATA[paul.roberts]]></name>
				<uri>https://forum.iredmail.org/user157471.html</uri>
			</author>
			<updated>2026-04-09T01:51:33Z</updated>
			<id>https://forum.iredmail.org/post91865.html#p91865</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Possible bug in the Amavis config, breaking DKIM]]></title>
			<link rel="alternate" href="https://forum.iredmail.org/post91864.html#p91864" />
			<content type="html"><![CDATA[<p>Not sure whether it&#039;s modified by amavisd, but Postfix might handle this by default since it has &quot;disable_mime_input_processing = no&quot; and &quot;disable_mime_output_conversion = no&quot; (both are set to &quot;no&quot; by default which means Postfix will do mime processing / conversion), it modifies MIME if it&#039;s not RFC-compliant, it&#039;s good in your case since you don&#039;t have correct &quot;Date:&quot;, but it might break DKIM signature too if it happens after signing. Anyway, you already found the solution and it&#039;s easy: generate RFC-compliant mime at the very beginning. <img src="https://forum.iredmail.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[ZhangHuangbin]]></name>
				<uri>https://forum.iredmail.org/user2.html</uri>
			</author>
			<updated>2026-04-09T01:08:46Z</updated>
			<id>https://forum.iredmail.org/post91864.html#p91864</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Possible bug in the Amavis config, breaking DKIM]]></title>
			<link rel="alternate" href="https://forum.iredmail.org/post91863.html#p91863" />
			<content type="html"><![CDATA[<p>==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====<br />- iRedMail version (check /etc/iredmail-release): 1.7.4 MARIADB edition<br />- Deployed with iRedMail Easy or the downloadable installer?&nbsp; The installer<br />- Linux/BSD distribution name and version: Debian Trixie<br />- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL<br />- Web server (Apache or Nginx): Apache (but not even used)<br />- Manage mail accounts with iRedAdmin-Pro?&nbsp; Nope.<br />- [IMPORTANT] Related original log or error message is required if you&#039;re experiencing an issue.<br />====</p><p>This is just <em>super</em> fun.&nbsp; I do b&#039;leev I&#039;ve found a bug in the Amavis configuration.&nbsp; We&#039;ve been using iRedMail for a few years now, have SPF and DKIM and all that good stuff working, but are walking away from the previous distribution because reasons.&nbsp; A brand new box was built with Trixie as the base, DKIM keys were just copied over into Amavis, and everything seemed good.&nbsp; All the legacy devices&nbsp; we&#039;ve got sending mail were sending mail, and then while testing sending authenticated mail from a new internal host that I was spinning up, I started seeing signature failures.&nbsp; WTF.</p><p>Mind you this program worked just fine from the old host and nine or ten others (going through the server running a much older version of iRedMail), and it&#039;s literally just a shell script so it&#039;s not like I could really have screwed up scp-ing it over, and it just hands the mail to sendmail (which I&#039;ve been doing for like 20+ years) so... not fancy.&nbsp; As I started digging into the issue I noticed something in the headers that caught my eye.&nbsp; The &quot;Date:&quot; header showed -0000 as the timezone which won the stink-eye because the test program just calls $(date) which produces something not quite RFC-compliant (&quot;Wed Apr&nbsp; 8 02:51:27 PM CDT 2026&quot;) but it&#039;s close enough for testing...<em>or so I thought</em>.&nbsp; I thought there really <em>should</em> have been a CDT there or something to indicate the time zone wasn&#039;t UTC (because I hate converting those in my head).</p><p>It turns out that if Amavis doesn&#039;t like your date string, it will apparently replace it with a form that <em>is</em> RFC-compliant.&nbsp; It didn&#039;t seem to care at all about my message ID that I forgot to wrap in angle-brackets and just passed that on through but whatevs...</p><p>Relevant information: h=message-id:subject:<span style="color:#ff0000">date</span>:from:to;</p><p>The kicker is that this configuration apparently &quot;corrects&quot; the date string <strong>after</strong> it has generated the DKIM signature (which kinda breaks it).&nbsp; Changing my date generator to using $(date +&#039;%a, %d %b %Y %H:%M:%S %z&#039;) made the mails start passing DKIM checks.&nbsp; That one change.&nbsp; &lt;&lt;sigh&gt;&gt;</p><br /><p>The other &quot;clues&quot; (blatantly fishing for Google with this on behalf of future admins) would be seeing Tests: [ALL_TRUSTED=-1,INVALID_DATE=0.432,INVALID_MSGID=1.167] showing up in the logs.&nbsp; Again, it won&#039;t bother changing the message ID (most MTAs will just generate their own if you didn&#039;t specify one) to include &lt;&gt;&#039;s, but it <em>does</em> replace your Date: string.&nbsp; Heck, until today I didn&#039;t even know postfix or Amavis would bother altering the date string.</p>]]></content>
			<author>
				<name><![CDATA[paul.roberts]]></name>
				<uri>https://forum.iredmail.org/user157471.html</uri>
			</author>
			<updated>2026-04-08T20:12:07Z</updated>
			<id>https://forum.iredmail.org/post91863.html#p91863</id>
		</entry>
</feed>
