Queue configuration with tenants

Hello,
Queue configuration is not clear for me.

I have the following config:

# sources.toml
[source.'default-ip']
source_address = '10.156.0.10'
ehlo_domain = 'mta1.examplecorp.com'
ha_proxy_server = '10.156.0.4:6000'
ha_proxy_source_address = '45.128.172.25'

[source.'customer-1-ip']
source_address = '10.156.0.10'
ehlo_domain = 'mta1.examplecorp.com'
ha_proxy_server = '10.156.0.4:6000'
ha_proxy_source_address = '45.128.172.102'

[pool.'default']
[pool.'default'.'default-ip']

[pool.'customer-1']
[pool.'customer-1'.'customer-1-ip']
# queues.toml
tenant_header = "X-Tenant"

default_tenant = 'default-tenant'

[tenant.'default-tenant']
egress_pool = 'default'

[tenant.'customer-1']
egress_pool = 'customer-1'

[queue.default]
max_age = '24 hours'
retry_interval = '10 mins'
egress_pool = 'default'
-- init.lua extract
-- Configure queues
local queue_module = require 'policy-extras.queue'
local queue_helper =
  queue_module:setup { '/opt/kumomta/etc/policy/queues.toml' }

-- Configure source IPs.
local sources = require 'policy-extras.sources'
sources:setup { '/opt/kumomta/etc/policy/sources.toml' }

If I try to send a message, regardless whether I provide the X-Tenant header, KumoMTA uses the default egress_pool and default-ip.

Trying like this: swaks --to test@example.com -f sender@other.com --server localhost or swaks --to test@example.com -f sender@other.com --server localhost --h-X-Tenant customer-1. In the logs both messages are assigned to the default pool.

It is also strange that I had to add egress_pool to the queue config, but the docs does not mention this.

Can anyone give me some hint what am I missing?

Thanks!

Hey there @effervescent-porcupi, thanks for posting. Please read the “Troubleshooting” and “How to Ask for Help” buttons below. If you would like a 1:1 support session from the KumoMTA team, details are at the “Book a Support Session” button below.

Please provide the full init.lua, not just an extract. Where in the docs are you referring to that did not mention adding egress_pool? I’d like to correct that.

Also I’d recommend using KumoProxy for SOCKS5 instead of HAPROXY. HAPROXY is not designed for egress, and SOCKS5 works better there.

Hello Mike,
Thanks for responding!

-- init.lua
--
local kumo = require 'kumo'
--[[ Start of INIT section ]]

-- Configure queues
local queue_module = require 'policy-extras.queue'
local queue_helper =
  queue_module:setup { '/opt/kumomta/etc/policy/queues.toml' }

-- Configure source IPs.
local sources = require 'policy-extras.sources'
sources:setup { '/opt/kumomta/etc/policy/sources.toml' }

kumo.on('init', function()
  kumo.start_esmtp_listener {
    listen = '0.0.0.0:25',
    relay_hosts = { '127.0.0.1', '10.156.0.0/24' },
  }

  kumo.start_http_listener {
    listen = '127.0.0.1:8000',
  --  listen = '10.156.0.10:8000',
    trusted_hosts = {'10.156.0.10', '127.0.0.1'}
  }

  kumo.define_spool {
    name = 'data',
    path = '/var/spool/kumomta/rocksdb/data',
    kind = 'RocksDB',
  }
  kumo.define_spool {
    name = 'meta',
    path = '/var/spool/kumomta/rocksdb/meta',
    kind = 'RocksDB',
  }

--[[  kumo.define_spool {
    name = 'data',
    path = '/var/spool/kumo/data',
  }
  kumo.define_spool {
    name = 'meta',
    path = '/var/spool/kumo/meta',
  }
  ]]--
  kumo.configure_local_logs {
    log_dir = '/var/log/kumomta',
    -- Flush logs every 10 seconds.
    -- You may wish to set a larger value in your production
    -- configuration; this lower value makes it quicker to see
    -- logs while you are first getting set up.
    max_segment_duration = '10s',
  }
end)
--[[ End of INIT Section ]]

--[[ Start of Non-INIT level config ]]



-- PLEASE read https://docs.kumomta.com/ for extensive documentation on customizing this config.
--[[ End of Non-INIT level config ]]

Sorry, it was my wrong, the docs contains that queue has egress_pool param.

Ok we are at M3AAWG this week, will review once we get a chance.

:folded_hands: Thanks!

You are missing queue_helper:apply(msg) in your kumo.on(‘smtp_server_message_received’, function(msg) event handler. Take a look at the example config at Example Server Policy - KumoMTA Docs to see how it is implemented.

I recommend using the example config as the basis of your install as it covers a lot of the bases.

Apologies, the reference to the apply method was not in the page for the queue helper, I’ve corrected the documentation.

Ahhh, that makes sense now! I will test it today. Thank you for pointing this out.

And it’s working now! Thank you for taking the time to answer my noob question.

Sounds good!