Files
kumomta/crates/integration-tests/proxy_with_auth.lua
T
Wez Furlong 1690e6526a refactor: move start_proxy_listener to proxy module
We're keeping a reference to it via kumo.start_proxy_listener briefly,
just in case someone is using that live somewhere.

We don't need to changelog this, as this whole feature hasn't
been in a stable tag yet.

refs: https://github.com/KumoCorp/kumomta/pull/472
2026-02-06 07:31:30 +00:00

21 lines
714 B
Lua

-- Proxy configuration with optional authentication
-- Auth credentials are passed via environment variables
local kumo = require 'kumo'
local proxy = require 'proxy'
local REQUIRE_AUTH = os.getenv 'KUMO_PROXY_REQUIRE_AUTH' == 'true'
local AUTH_USERNAME = os.getenv 'KUMO_PROXY_AUTH_USERNAME' or 'testuser'
local AUTH_PASSWORD = os.getenv 'KUMO_PROXY_AUTH_PASSWORD' or 'testpass'
kumo.on('proxy_init', function()
proxy.start_proxy_listener {
listen = '127.0.0.1:0',
require_auth = REQUIRE_AUTH,
}
end)
kumo.on('proxy_server_auth_rfc1929', function(username, password, conn_meta)
-- Validate credentials against expected values
return username == AUTH_USERNAME and password == AUTH_PASSWORD
end)