Files
kumomta/docs/reference/message/dkim_verify.md
T
Wez Furlong 42bf5c5e61 docs: adjust reference to improve search terms
We've been hoping that mkdocs-material will ship the much anticipated
search enhancements for some time, but it's time to recognize that
we need to do something to improve the search results with how
things work right now.

This is a big commit that changes the titles of the various pages
from the code-annotated synopsis to just the name of the function.

This makes it much easier now to match things like `kumo.reject`
directly, but `reject` remains awkward to find.

I think this is the best that we can do at this time.

A few functions have been annotated with the `status: deprecated` to
show as deprecated in the toc/nav (shows with a little trash can next
to the name).
2025-05-16 14:02:19 -07:00

66 lines
1.7 KiB
Markdown

# dkim_verify
```lua
message:dkim_verify()
```
{{since('2023.11.28-b5252a41')}}
This method will verify each DKIM signature that is present at the top level of
the message, up to a limit of 10 signatures. The limit is in place to limit the
scope of a DoS attack being carried out through maliciously constructed messages.
For each signature, an [authenticationresult](../authenticationresult.md) object
will be constructed and an array of those results will be returned to the caller.
## Example: obtaining DKIM authentication results
```lua
kumo.on('smtp_server_message_received', function(msg)
-- Verify the dkim signature and return the results.
-- Note that this example isn't making any policy decisions;
-- it is only annotating the message with the results and
-- allowing it to be relayed
local verify = msg:dkim_verify()
print('dkim', kumo.json_encode_pretty(verify))
-- Add the results to the message
msg:add_authentication_results(msg:get_meta 'hostname', verify)
end)
```
might print something like this to the diagnostic log:
```
dkim [
{
"props": {
"header.d": "github.com",
"header.i": "@github.com",
"header.s": "pf2023",
"header.a": "rsa-sha256",
"header.b": "jo0EO4dX"
},
"result": "pass",
"method": "dkim",
"reason": null,
"method_version": null
}
]
```
and produce an `Authentication-Results` header:
```
Authentication-Results: hostname.example.com;
dkim=pass
header.a=rsa-sha256
header.b=jo0EO4dX
header.d=github.com
header.i=@github.com
header.s=pf2023
```
## See Also:
* [msg:add_authentication_results()](add_authentication_results.md)