Files
kumomta/crates/integration-tests/proxy_with_auth.lua
T
Kevin Vu c3ed6279d5 feat: add TLS and RFC 1929 auth to KumoProxy
Add TLS encryption and username/password authentication support for
the KumoProxy SOCKS5 server, with full Lua configuration capabilities.

Proxy Server Changes:
- Add kumo.start_proxy_listener() Lua function with TLS support
- Add proxy_server_auth_rfc1929 event for Lua-based auth validation
- Return AuthInfo from auth for ACL system integration
- Support optional and required authentication modes
- Maintain backwards-compatible legacy CLI mode (--listen, --timeout-seconds)

Breaking Changes:
- Cache renamed from rfc5321_rustls_config to rustls_client_config

Refs: #451
Closes: 459
2026-01-19 07:45:02 +00:00

20 lines
683 B
Lua

-- Proxy configuration with optional authentication
-- Auth credentials are passed via environment variables
local kumo = require 'kumo'
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()
kumo.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)