Sorry for creating multiple posts here, thought might post separately for others who might face something similar in the future.
I’m getting this error about the TSA queue in the logs:
{"type":"TransientFailure","id":"6c7ea06392b911ee803e080027be1609","sender":"noreply@example.com","recipient":"recipient@example.com","queue":"http://127.0.0.1:8008.tsa.kumomta","site":"","size":649,"response":{"code":451,"enhanced_code":{"class":4,"subject":4,"detail":4},"content":"failed to resolve queue http://127.0.0.1:8008.tsa.kumomta: proto error: Malformed label: http://127","command":null},"peer_address":null,"timestamp":1701705910,"created":1701703558,"num_attempts":1,"bounce_classification":"RoutingErrors","egress_pool":null,"egress_source":null,"feedback_report":null,"meta":{},"headers":{},"delivery_protocol":null,"reception_protocol":"LogRecord","nodeid":"6c48c1dc-5f6a-487c-ab67-c3e6f426d6a6"}
init.lua config:
local shaping = require 'policy-extras.shaping'
local shaper = shaping:setup_with_automation {
publish = { 'http://127.0.0.1:8008' },
subscribe = { 'http://127.0.0.1:8008' },
extra_files = { '/opt/kumomta/etc/policy/config/shaping.toml' },
}
-- the rest of the config
kumo.on('init', function()
-- other stuff.
shaper.setup_publish()
end)
Yeah, I appreciate splitting these out, although I suspect that it may be the same root cause. In both cases, the “fake domain” name used for the log hooks is trying to be resolved as an MX record. The associate queue config hooks normally will set up those queues to use the lua delivery protocol instead, so it sounds like maybe there is an issue with the ordering of things in the config, or perhaps that the config was changed to rename some things after those messages were received, but before they were delivered.
Thanks for sharing; I think this is a hook ordering issue. The queue helper code will always return a queue config because there is a queue.default in the toml data file. So if the queue helper is registered before other hooks like the webhooks and shaping helpers, then it will always take precedence
I’m calling queue_helper in the http_message_generated/smtp_server_message_received event handlers, and the shaping handler is registered on init which I assume will always get called before the other events, and I need to define shaper = shaping:setup_with_automation variable before using it in init. How can I register the queue helper after the shaper?
-- Put all the requires up the top; their relative order doesn't matter,
-- it is just tidier this way
local kumo = require 'kumo'
local log_hooks = require 'policy-extras.log_hooks'
local sources = require 'policy-extras.sources'
local dkim_sign = require 'policy-extras.dkim_sign'
local shaping = require 'policy-extras.shaping'
-- That said, since this is your custom version of the provided helper, it
-- it good practice to group your local custom modules together after importing
-- the product defaults; it helps to clarify/highlight that something different
-- might be going on
local queue_module = require 'queue'
-- Order is not important for the dkim signer
local dkim_signer = dkim_sign:setup { '/opt/kumomta/etc/policy/config/dkim.toml' }
local shaper = shaping:setup_with_automation {
publish = { 'http://127.0.0.1:8008' },
subscribe = { 'http://127.0.0.1:8008' },
extra_files = { '/opt/kumomta/etc/policy/config/shaping.toml' },
}
-- TODO: Put your log_hooks:new_json here
-- Setup the queue helper after all webhooks and the TSA setup
local queue_helper = queue_module:setup({'/opt/kumomta/etc/policy/config/queue.toml'})