msys.validate.openarc.verify
Name
msys.validate.openarc.verify — Verifies ARC set headers in an email, and stores the verification results
(none/pass/fail
) into the email's context variable.
Synopsis
msys.validate.openarc.verify(msg)
Description
This function validates the ARC set headers contained in the input message. The validation result
will be stored as string value (none
or pass
or fail
) in the ec_message
's context variable
of arc_cv
. A caller can take actions (e.g. disposition of the message) based on the validation
result.
This function requires the openarc
module.
Enable this function with the statement require('msys.validate.openarc')
.
Note
After being called, this function always sets the ec_message
context variable arc_cv
to one of
the values: none
, pass
, fail
. Unexpected fail
cases are logged into paniclog.
This function invokes dns lookup for signature validation. It's recommended to invoke it from a hook
which would not block Momentum's main tasks, e.g. from the validate_data_spool
or the
validate_data_spool_each_rcpt
hook.
Example
require("msys.core");
require("msys.extended.message");
require("msys.validate.openarc");
local mod = {};
function mod:validate_data_spool_each_rcpt(msg, ac, vctx)
msys.validate.openarc.verify(msg)
local cv = msg:context_get(msys.core.ECMESS_CTX_MESS, "arc_cv")
if cv then
print("ARC validation result: ", cv)
else
print("Failed to do ARC validation. Check paniclog for reasons.")
end
end
msys.registerModule("openarc_verify", mod);