mirror of
https://github.com/mailscope/kumomta.git
synced 2026-09-09 12:02:14 +00:00
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).
1.3 KiB
1.3 KiB
kumo.spf.check_host
kumo.spf.check_host { PARAMS }
{{since('2024.11.08-d383b033')}}
This function will check SPF records from DNS for the given domain and IP address.
It takes three arguments:
domain(string), the domain to check (for example, from thesmtp_server_ehloevent)conn_meta(connectionmeta), used to get the client's IP addresssender(optionalstring), the sender address to check
It will return an object containing the SPF disposition string and a result
of type authenticationresult for use with msg:add_authentication_results().
Example: checking the SPF policy
kumo.on('smtp_server_ehlo', function(domain, conn_meta)
-- Check the SPF policy for the domain and return the results.
local result = kumo.spf.check_host(domain, conn_meta)
print('spf', kumo.json_encode_pretty(result))
if result.disposition ~= 'pass' then
kumo.reject(420, 'go away')
end
end)
might print something like this to the diagnostic log:
spf [
"disposition": "pass",
{
"result": "pass",
"method": "spf",
"reason": "matched 'all' directive",
"method_version": null,
"props": {}
}
]