mirror of
https://github.com/mailscope/kumomta.git
synced 2026-08-19 02:48:18 +00:00
cfaea43cab
Similar to how we summarize and inform when all connection errors are due to broken TLS, recognize and inform when all connection errors are due to a source_address that cannot be bound due to the address not being plumbed on the system. This does not include other reasons that `bind(2)` can fail, just the case where the address is not present. Add an integration test to capture the error message for that situation, for easier future reference.
86 lines
1.9 KiB
Lua
86 lines
1.9 KiB
Lua
local kumo = require 'kumo'
|
|
package.path = '../../assets/?.lua;' .. package.path
|
|
|
|
local TEST_DIR = os.getenv 'KUMOD_TEST_DIR'
|
|
local SINK_PORT = tonumber(os.getenv 'KUMOD_SMTP_SINK_PORT')
|
|
|
|
kumo.on('init', function()
|
|
kumo.configure_accounting_db_path(TEST_DIR .. '/accounting.db')
|
|
|
|
local relay_hosts = { '0.0.0.0/0' }
|
|
kumo.start_esmtp_listener {
|
|
listen = '127.0.0.1:0',
|
|
relay_hosts = relay_hosts,
|
|
deferred_queue = false,
|
|
}
|
|
|
|
kumo.start_http_listener {
|
|
listen = '127.0.0.1:0',
|
|
}
|
|
|
|
kumo.define_spool {
|
|
name = 'data',
|
|
path = TEST_DIR .. '/data-spool',
|
|
}
|
|
|
|
kumo.configure_local_logs {
|
|
log_dir = TEST_DIR .. '/logs',
|
|
max_segment_duration = '1s',
|
|
}
|
|
|
|
kumo.define_spool {
|
|
name = 'meta',
|
|
path = TEST_DIR .. '/meta-spool',
|
|
}
|
|
end)
|
|
|
|
kumo.on('get_listener_domain', function(domain, listener, conn_meta)
|
|
return kumo.make_listener_domain {
|
|
relay_to = true,
|
|
log_oob = true,
|
|
log_arf = true,
|
|
}
|
|
end)
|
|
|
|
kumo.on('get_queue_config', function(domain, tenant, campaign, routing_domain)
|
|
return kumo.make_queue_config {
|
|
protocol = {
|
|
smtp = {
|
|
mx_list = { 'localhost:' .. SINK_PORT },
|
|
},
|
|
},
|
|
egress_pool = 'default',
|
|
}
|
|
end)
|
|
|
|
kumo.on('get_egress_pool', function(pool_name)
|
|
return kumo.make_egress_pool {
|
|
name = pool_name,
|
|
entries = {
|
|
{ name = 'default' },
|
|
},
|
|
}
|
|
end)
|
|
|
|
kumo.on('get_egress_source', function(source_name)
|
|
return kumo.make_egress_source {
|
|
name = source_name,
|
|
-- If the quad-9 folks are ever running this test on this public
|
|
-- ip then this test may fail
|
|
source_address = '9.9.9.9',
|
|
}
|
|
end)
|
|
|
|
kumo.on('get_egress_path_config', function(domain, source_name, _site_name)
|
|
-- Allow sending to a sink
|
|
local params = {
|
|
enable_tls = 'OpportunisticInsecure',
|
|
prohibited_hosts = {},
|
|
ip_lookup_strategy = 'Ipv4Only',
|
|
}
|
|
|
|
kumo.log_warn('get_egress_path_config *******************', domain)
|
|
|
|
return kumo.make_egress_path(params)
|
|
end)
|