Bug 11703

Summary: mailing list posts are not ARC signed
Product: Infrastructure Reporter: Peter Müller <peter.mueller>
Component: Mail & Mailing ListsAssignee: Peter Müller <peter.mueller>
Status: CLOSED FIXED QA Contact: Peter Müller <peter.mueller>
Severity: Major Usability    
Priority: Will affect most users CC: jonatan.schlag, michael.tremer
Version: unspecified   
Hardware: all   
OS: All   
See Also: https://bugzilla.ipfire.org/show_bug.cgi?id=11676
Bug Depends on:    
Bug Blocks: 11634    

Description Peter Müller 2018-04-21 18:18:14 UTC
As far as I understood ARC, posts to mailing lists, for example, should be signed with it so obligatory DMARC failures will not matter.

rspamd currently does not do this since it only looks at the "From"-header. I am not sure what to do about this, worse, the documentation is somewhat unintentional (https://rspamd.com/doc/modules/arc.html).
Comment 1 Peter Müller 2018-04-29 09:47:38 UTC
This needs some extra work (understanding details of ARC, generic mail signing with rspamd, ...), setting status to ON_DEV.
Comment 2 Peter Müller 2018-04-29 12:31:23 UTC
Signing forwarded mails with ARC is implemented (but not documented):
- https://github.com/vstakhov/rspamd/issues/1993
- https://github.com/vstakhov/rspamd/pull/2018

However, the situation is more complex since f*cking Mailman rewrites header, breaking DKIM/ARC signatures. Actually, we need to go as follows:
(a) A mail is received by mail01.ipfire.org.
(b) rspamd on mail01.ipfire.org performs ARC checks and adds ARC signature
(c) mail is relayed through mailman and then delivered to recipients.

But since mailman modifies the mail, we need to switch steps (b) and (c). However, in that case, we cannot use the destination addresses for ARC signatures anymore, since these are remote domains we do not have keys for.

@Michael: Can you switch off the mail modification (subject tags, ...) for the test list?
Comment 3 Michael Tremer 2018-04-30 12:22:37 UTC
(In reply to Peter Müller from comment #2)
> However, the situation is more complex since f*cking Mailman rewrites
> header, breaking DKIM/ARC signatures.

It *is* supposed to do that. I clearly think that this is a horrible horrible failure in designing DMARC.

> @Michael: Can you switch off the mail modification (subject tags, ...) for
> the test list?

Subject is switched off for Test, but we have lists that modify the Subject header and body. That is something we want.
Comment 4 Peter Müller 2018-04-30 19:26:05 UTC
(In reply to Michael Tremer from comment #3)
> (In reply to Peter Müller from comment #2)
> > However, the situation is more complex since f*cking Mailman rewrites
> > header, breaking DKIM/ARC signatures.
> 
> It *is* supposed to do that. I clearly think that this is a horrible
> horrible failure in designing DMARC.
Sorry, I think this is not a problem with DMARC after all. Mailman rewrites the header lines of an incoming mail (I never found anyone with a satisfying idea why the software is doing that), and all DKIM/ARC signatures are broken afterwards.

We need to add the ARC signature _afterwards_, after all content manipulation has been applied. Further, it seems like we sign messages delivered via ESMTPSA.
> 
> > @Michael: Can you switch off the mail modification (subject tags, ...) for
> > the test list?
> 
> Subject is switched off for Test, but we have lists that modify the Subject
> header and body. That is something we want.
I see. Thanks.

For a test mail via mailman, my rspamd results look like:
X-Spamd-Result: default: False [-3.16 / 11.00];
	 FORGED_SENDER_MAILLIST(0.00)[];
	 DKIM_TRACE(0.00)[link38.eu:-];
	 HAS_LIST_UNSUB(-0.01)[];
	 FORGED_RECIPIENTS_MAILLIST(0.00)[];
	 DMARC_POLICY_SOFTFAIL(0.10)[link38.eu : SPF not aligned (relaxed), No valid DKIM,none];
	 ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US];
	 IP_SCORE(-3.64)[ip: (-9.54), ipnet: 2001:470::/32(-4.77), asn: 6939(-3.82), country: US(-0.09)];
	 MX_GOOD(-0.01)[cached: mail01.ipfire.org];
	 HAS_ATTACHMENT(0.00)[];
	 TO_DN_NONE(0.00)[];
	 MIME_GOOD(-0.20)[multipart/mixed,multipart/signed,text/plain];
	 RCVD_IN_DNSWL_MED(-2.00)[1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.5.2.0.0.3.8.1.7.0.7.4.0.1.0.0.2.list.dnswl.org : 127.0.9.2];
	 FROM_HAS_DN(0.00)[];
	 ARC_REJECT(2.00)[signature check failed: fail, {[1] = sig:ipfire.org:reject}];
	 FROM_NEQ_ENVFROM(0.00)[peter.mueller@link38.eu,test-bounces@lists.ipfire.org];
	 R_DKIM_REJECT(1.00)[link38.eu];
	 R_SPF_ALLOW(-0.20)[+ip6:2001:470:7183:25::1];
	 ARC_SIGNED(0.00)[i=2];
	 RCPT_COUNT_ONE(0.00)[1];
	 MID_RHS_MATCH_FROM(0.00)[];
	 RCVD_COUNT_THREE(0.00)[3];
	 RCVD_TLS_LAST(0.00)[];
	 MAILLIST(-0.20)[mailman]
X-Spam-Status: No, score=-3.16
X-Rspamd-Server: mx-nbg.link38.eu

The ARC_REJECT symbol is the problem here...

As long as I haven't figured out how to solve this, are you OK with disabling ARC? I consider a missing signature better than a broken one. Sorry for all the rush here. :-(
Comment 5 Michael Tremer 2018-04-30 21:14:06 UTC
Yes, please disable it so far.

How do we fix this?
Comment 6 Peter Müller 2018-05-03 16:55:02 UTC
ARC signing disabled for now.

The solution is rather complex:
First, we only need to ARC sign incoming mails (destination mail equals signing key, see links to github above). That way, we have a signature especially useful for mailing lists and similar stuff.

Second, since Mailman messes with mails (rewrites Subject, body and breaks signatures), we need to inject the signature _after_ the mail is delivered back to Postfix. Certainly, this could be done via running a second instance of Postfix and maybe rspamd, but I hate this idea.

Currently, I am looking for better ways to go here. Unfortunately, things are busy here, so please be patient.
Comment 7 Peter Müller 2018-08-06 22:32:46 UTC
This is still alive. Sorry for being so sloppy.
Comment 8 Peter Müller 2018-08-11 18:19:09 UTC
We need to update Mailman for this. There seems to be no other way, since the current version breaks all DKIM signatures, which applies to ARC as well.
Comment 9 Michael Tremer 2018-08-14 10:15:49 UTC
There is no updated version available. I have no idea if RH has any interest in
updating it.

The only way would be to fork the RPM and manually add patches that we need.
Comment 10 Peter Müller 2018-10-11 19:33:07 UTC
rspamd included the feature, it will be released with 1.8.1 .
Comment 11 Peter Müller 2018-10-17 17:05:14 UTC
rspamd 1.8.1 released, updating...
Comment 12 Peter Müller 2018-11-05 17:52:32 UTC
Enabling ARC destiation to MIME was not possible (or I am too stupid), waiting for vstakhov's response...
Comment 13 Peter Müller 2020-04-01 12:25:13 UTC
This is fixed by now.
Comment 14 Michael Tremer 2020-04-01 13:19:27 UTC
Yay. \o/