How to implement dynamic DKIM signer using sqlite

Hello team,

I am trying to configure dynamic dkim signer using SQLite in my init.lua, but i failed several times.

Please help me.

here is my configuration,

local sqlite = require ‘sqlite’

function get_key(domain, selector)
local db = sqlite:open ‘/opt/kumomta/etc/dkim/keys.db’
local result = db:execute(‘select data from keys where domain=? and selector=?’, domain, selector)
return result[1]
end

kumo.on(‘smtp_server_message_received’, function(msg)
local signer = kumo.dkim.rsa_sha256_signer {
key = {
key_data = get_key(msg:from_header().domain)
}
}
msg:dkim_sign(signer)
end)

Also, tell me what values should I import in my SQLite database? I used domain, selector and key-data

Please check and let me know.

This sounds more like paid PS work than KumoMTA support. Happy to work toward a solution if you want to bank a few hours of PS.

Alternatively, you should check to make sure the SQLite fb is actually working, then read the DKIM section in our docs to get all the fields you need.

:backhand_index_pointing_up: