forked from trusteddomainproject/OpenDMARC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fully parse Received-SPF, and only use it if it includes the envelope
sender against which the result was calculated.
- Loading branch information
Murray S. Kucherawy
committed
Apr 5, 2021
1 parent
187397d
commit 56a9030
Showing
9 changed files
with
375 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,28 +4,30 @@ This listing shows the versions of the OpenDMARC package, the date of | |
release, and a summary of the changes in that release. | ||
|
||
1.4.1 2021/03/?? | ||
Addition of defines for MUSL C Library. (#129/#133) | ||
Patches by Marco Rebhan ([email protected]). | ||
Addition of defines for MUSL C Library. (#129/#133). Patches by | ||
Marco Rebhan. | ||
Fixes to MySQL Schema (#98/#99). Patch by Bond Keevil. | ||
LIBSPF2 calls would not compile on OpenBSD due to OpenBSD not | ||
having the ns_type definition in arpa/resolv.h. | ||
Added detection to configure script. (#134) | ||
Reworked hcreate_r functions to hcreate to compile natively on | ||
OpenBSD, MacOS. (Part of #94) Reported by Rupert Gallagher. | ||
Reworked hcreate_r calls to use hcreate, to compile natively on | ||
OpenBSD and MacOS. (Part of #94) Reported by Rupert Gallagher. | ||
Add compatibility with AutoConf 2.70. (#95) | ||
LIBOPENDMARC: Fix bug #50: Ignore all RRTYPEs other than TXT. | ||
Problem reported by Jan Bouwhuis. | ||
LIBOPENDMARC: Fix bug #89: Repair absurd RRTYPE test in SPF code. | ||
LIBOPENDMARC: Fix bug #104: Fix bogus header field parsing code. | ||
Documentation updates about SourceForge being deprecated. (#101) | ||
Only accept results from Received-SPF fields that indicate clearly | ||
which identifier was being evaluated, since DMARC specifically | ||
only wants results based on MAIL FROM. | ||
Many build-time fixes (#100, #91, #90, #86, #85, #84, #83, #82, #81) | ||
Patches provided by Rupert Gallagher ([email protected]) | ||
Added config option HoldQuarantinedMessages (default false), which | ||
controls if messages with p=quarantine will be passed on to | ||
the mail stream (if False) or placed in the MTA's "hold" | ||
queue. (if True). Issue #105. Patch by Marcos Moraes, on | ||
queue (if True). Issue #105. Patch by Marcos Moraes, on | ||
the OpenDMARC mailing list. | ||
|
||
LIBOPENDMARC: Fix bug #50: Ignore all RRTYPEs other than TXT. | ||
Problem reported by Jan Bouwhuis. | ||
LIBOPENDMARC: Fix bug #89: Repair absurd RRTYPE test in SPF code. | ||
LIBOPENDMARC: Fix bug #104: Fix bogus header field parsing code. | ||
|
||
1.4.0 2021/01/28 | ||
Add ARC support. Extensive work contributed by ValiMail, with patches | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
# | ||
# Test a message with a Received-SPF header that we can't trust | ||
# | ||
# DMARC only wants SPF results based on MAIL FROM. This is the positive | ||
# case where we have a Received-SPF that is definitely what we want. | ||
|
||
if [ x"$srcdir" = x"" ] | ||
then | ||
srcdir=`pwd` | ||
fi | ||
|
||
miltertest -s $srcdir/t-verify-received-spf-bad.lua |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Background No |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
-- Copyright (c) 2021, The Trusted Domain Project. All rights reserved. | ||
|
||
-- Test message with a not-valid (the way DMARC wants it) Received-SPF field | ||
-- | ||
-- Confirms that a message with a Received-SPF field that indicates a "pass" | ||
-- but does not include "identity=mailfrom" and "envelope-from" with the | ||
-- right value will not be trusted. | ||
|
||
mt.echo("*** Received-SPF test (bad)") | ||
|
||
-- setup | ||
sock = "unix:" .. mt.getcwd() .. "/t-verify-received-spf-bad.sock" | ||
binpath = mt.getcwd() .. "/.." | ||
if os.getenv("srcdir") ~= nil then | ||
mt.chdir(os.getenv("srcdir")) | ||
end | ||
|
||
-- try to start the filter | ||
mt.startfilter(binpath .. "/opendmarc", "-l", | ||
"-c", "t-verify-received-spf-bad.conf", "-p", sock) | ||
|
||
-- try to connect to it | ||
conn = mt.connect(sock, 40, 0.05) | ||
if conn == nil then | ||
error("mt.connect() failed") | ||
end | ||
|
||
-- send connection information | ||
-- mt.negotiate() is called implicitly | ||
if mt.conninfo(conn, "localhost2", "127.0.0.2") ~= nil then | ||
error("mt.conninfo() failed") | ||
end | ||
if mt.getreply(conn) ~= SMFIR_CONTINUE then | ||
error("mt.conninfo() unexpected reply") | ||
end | ||
|
||
-- send envelope macros and sender data | ||
-- mt.helo() is called implicitly | ||
mt.macro(conn, SMFIC_MAIL, "i", "t-verify-received-spf-bad") | ||
if mt.mailfrom(conn, "[email protected]") ~= nil then | ||
error("mt.mailfrom() failed") | ||
end | ||
if mt.getreply(conn) ~= SMFIR_CONTINUE then | ||
error("mt.mailfrom() unexpected reply") | ||
end | ||
|
||
-- send headers | ||
-- mt.rcptto() is called implicitly | ||
if mt.header(conn, "Received-SPF", "pass") ~= nil then | ||
error("mt.header(Received-SPF) failed") | ||
end | ||
if mt.getreply(conn) ~= SMFIR_CONTINUE then | ||
error("mt.header(Received-SPF) unexpected reply") | ||
end | ||
if mt.header(conn, "From", "[email protected]") ~= nil then | ||
error("mt.header(From) failed") | ||
end | ||
if mt.getreply(conn) ~= SMFIR_CONTINUE then | ||
error("mt.header(From) unexpected reply") | ||
end | ||
if mt.header(conn, "To", "[email protected]") ~= nil then | ||
error("mt.header(To) failed") | ||
end | ||
if mt.getreply(conn) ~= SMFIR_CONTINUE then | ||
error("mt.header(To) unexpected reply") | ||
end | ||
if mt.header(conn, "Date", "Tue, 22 Dec 2009 13:04:12 -0800") ~= nil then | ||
error("mt.header(Date) failed") | ||
end | ||
if mt.getreply(conn) ~= SMFIR_CONTINUE then | ||
error("mt.header(Date) unexpected reply") | ||
end | ||
if mt.header(conn, "Subject", "DMARC test") ~= nil then | ||
error("mt.header(Subject) failed") | ||
end | ||
if mt.getreply(conn) ~= SMFIR_CONTINUE then | ||
error("mt.header(Subject) unexpected reply") | ||
end | ||
|
||
-- send EOH | ||
if mt.eoh(conn) ~= nil then | ||
error("mt.eoh() failed") | ||
end | ||
if mt.getreply(conn) ~= SMFIR_CONTINUE then | ||
error("mt.eoh() unexpected reply") | ||
end | ||
|
||
-- end of message; let the filter react | ||
if mt.eom(conn) ~= nil then | ||
error("mt.eom() failed") | ||
end | ||
if mt.getreply(conn) ~= SMFIR_ACCEPT then | ||
error("mt.eom() unexpected reply") | ||
end | ||
|
||
-- verify that an Authentication-Results header field got added | ||
if not mt.eom_check(conn, MT_HDRINSERT, "Authentication-Results") and | ||
not mt.eom_check(conn, MT_HDRADD, "Authentication-Results") then | ||
error("no Authentication-Results added") | ||
end | ||
|
||
-- verify that a DMARC pass result was added | ||
n = 0 | ||
found = 0 | ||
while true do | ||
ar = mt.getheader(conn, "Authentication-Results", n) | ||
if ar == nil then | ||
break | ||
end | ||
if string.find(ar, "dmarc=fail", 1, true) ~= nil then | ||
found = 1 | ||
break | ||
end | ||
n = n + 1 | ||
end | ||
if found == 0 then | ||
error("incorrect DMARC result") | ||
end | ||
|
||
mt.disconnect(conn) |
Oops, something went wrong.