Commit Graph
865 Commits
Author SHA1 Message Date
Mike Hillyer e88ad0360a Update changelog. 2023-05-10 17:23:08 -04:00
Mike Hillyer 7095c7f358 Formatting. 2023-05-10 17:13:50 -04:00
Mike Hillyer 052bcaa454 Adding warning and pointer to the Secrets Load function. 2023-05-10 16:52:55 -04:00
Wez Furlong d5572f0293 docs: tweak haproxy guide 2023-05-10 13:27:30 -07:00
Mike Hillyer 6a59aefb37 Automated doc formatting fix 2023-05-10 20:08:05 +00:00
Mike Hillyer 4565540b04 HAProxy user guide page 2023-05-10 15:59:58 -04:00
Mike Hillyer bcac01932e Add a note to the Policy chapter index. 2023-05-10 13:56:54 -04:00
Mike Hillyer d7a7b24039 Automated doc formatting fix 2023-05-10 17:49:22 +00:00
Mike Hillyer 501012fc5f Whoops. 2023-05-10 13:47:57 -04:00
Mike Hillyer bc970ab94e Move webhook chapter to Operations. 2023-05-10 13:45:45 -04:00
Mike Hillyer 3e3483b281 Automated doc formatting fix 2023-05-10 17:44:47 +00:00
Mike Hillyer b3a720e906 Adding webhook content. 2023-05-10 13:42:38 -04:00
Mike Hillyer 88390291b3 Adding Webhook section to the configuration chapter. 2023-05-10 13:42:38 -04:00
Wez Furlong 75f72aef7d tone down the debug
refs: #19
2023-05-10 09:53:09 -07:00
Wez Furlong 6fdee41600 Add HA Proxy support
I used a config like this for testing:

```
global
    log stdout  format raw  local0  debug

defaults
    timeout connect 10s
    timeout client 30s
    timeout server 30s
    log global

listen outboundsmtp
    log global
    bind 0:2526 accept-proxy
    mode tcp
    use-server v4 if { src 0.0.0.0/0 }
    use-server v6 if { src ::/0 }
    server v4 0.0.0.0 source 0.0.0.0 usesrc clientip
    server v6 ::: source ::: usesrc clientip
```

Launched via:

```console
$ sudo haproxy -f assets/haproxy.conf -V
```

with the source:

```lua
  kumo.define_egress_source {
    name = 'w00t',
    ha_proxy_server = '127.0.0.1:2526',
    ha_proxy_source_address = '192.168.1.92',
  }
```

refs: #19
2023-05-10 09:50:06 -07:00
Mike Hillyer 2fcbdfdf3a Automated doc formatting fix 2023-05-10 15:56:23 +00:00
Mike Hillyer 09cc31e552 Update traffic shaping page of user guide, add default rules to shaping.toml. 2023-05-10 11:52:27 -04:00
Mike Hillyer 0ade9f1964 Added remaining defaults to round out the big four, will look to community to refine and expand from here. 2023-05-09 15:21:43 -04:00
Mike Hillyer dd0f1eb5aa Update shaping.toml based on input from Comcast and Yahoo contacts. 2023-05-09 14:45:52 -04:00
Wez Furlong 14291df014 docs: fix missing note admonish 2023-05-09 11:06:01 -07:00
Wez Furlong c969a61016 tweak comments in shaping.toml 2023-05-09 10:14:04 -07:00
Wez Furlong de325af0ac surface lua errors raised by get_egress_path_config to diagnostic log
Previously, they would get logged only as a transient failure now
we log to both places.
2023-05-09 10:01:13 -07:00
Wez Furlong ed3e0356e3 Add shaping.toml and revise shaping.lua to load multiple files
refs: https://github.com/KumoCorp/kumomta/issues/43
2023-05-09 10:00:40 -07:00
Wez Furlong 927721fc0c Add toml parsing/encoding functions to lua
refs: https://github.com/KumoCorp/kumomta/issues/43
2023-05-09 08:40:37 -07:00
Mike Hillyer 75e85c2f6e Skeleton in the webhook page. 2023-05-09 11:30:59 -04:00
Wez Furlong 757ddbcf22 Automated doc formatting fix 2023-05-09 15:28:01 +00:00
Wez Furlong 992cae1409 Allow loading a key source directly from lua
This makes it easier to compose secret management with a variety
of lua functions without having to build that directly into each
of them.

In particular: one can now use vaults or other secret stores that
we add in the future to manage credentials for HTTP clients.
2023-05-09 08:25:54 -07:00
Wez Furlong f0e0ffe828 add message:set_force_sync
refs: https://github.com/KumoCorp/kumomta/issues/6
2023-05-08 17:37:54 -07:00
Mike Hillyer bfafab4ef5 Automated doc formatting fix 2023-05-08 22:24:47 +00:00
Mike Hillyer 217ca5be4e Add http API call routing to Policy Chapter. 2023-05-08 18:23:41 -04:00
Wez Furlong 9bc92b9a73 rustfmt 2023-05-08 15:21:00 -07:00
Wez Furlong c738ce2985 Automated doc formatting fix 2023-05-08 22:07:27 +00:00
Wez Furlong 0211b03060 http: add helpers for constructing form data
refs: https://github.com/KumoCorp/kumomta/issues/36
2023-05-08 15:06:09 -07:00
Wez Furlong cceaccf06a docs: webhook/lua delivery reference
refs: https://github.com/KumoCorp/kumomta/issues/36
refs: https://github.com/KumoCorp/kumomta/issues/18
2023-05-08 13:51:06 -07:00
Wez Furlong 713d46e6a8 tests: add end-to-end webhook test
This exercises the log -> webhook delivery path

refs: https://github.com/KumoCorp/kumomta/issues/36
refs: https://github.com/KumoCorp/kumomta/issues/18
2023-05-08 10:14:34 -07:00
Wez Furlong 001ba6d46f http: allow inspecting status even after the body has been read 2023-05-08 09:09:04 -07:00
Wez Furlong 3a168687a8 rustfmt 2023-05-08 09:07:20 -07:00
Wez Furlong 65c7a9e5a6 Add reception and delivery protocol to log record
closes: https://github.com/KumoCorp/kumomta/issues/38
2023-05-08 08:39:40 -07:00
Wez Furlong 4237227323 ci: add pkg-config to deps 2023-05-05 15:28:32 -07:00
Wez Furlong c61d6aaa04 docs for kumo.http 2023-05-05 15:08:48 -07:00
Wez Furlong 5dfa6e5865 add http client module
```lua
  local response = kumo.http
    .build_client({})
    :get('https://example.com/')
    :send()
  print(response:status_code(), response:status_reason())
  for k, v in pairs(response:headers()) do
    print("Header", k, v)
  end
  print(response:text())
```
2023-05-05 14:26:09 -07:00
Wez Furlong 32bd7283cf mod-dns-resolver: remove unused dep 2023-05-05 11:04:11 -07:00
Wez Furlong dade11ef22 dns: make it easy to detect and react to domain literals in lua
Add an is_domain_literal field to the resolve of kumo.dns.lookup_mx
2023-05-05 10:57:40 -07:00
Wez Furlong d6203f6eff Allow logging via a lua hook
Still need to write up some proper docs, but the gist is that
the example below will enqueue a message holding the content
of the JsonRecord for each log event, and that message will be
dispatched via a custom lua delivery mechanism.

```lua
kumo.on('init', function()
  kumo.configure_log_hook {}
end)

kumo.on('make.lua-sender', function(domain, tenant, campaign)
  print 'making lua sender'
  local sender = {}
  function sender:send(message)
    print('Sending a message!', message:get_data())
    return 'Super!'
  end
  return sender
end)

kumo.on('should_enqueue_log_record', function(msg)
  local log_record = msg:get_meta 'log_record'
  print('should_enqueue_log_record', log_record)
  -- avoid an infinite loop caused by logging that we logged
  if log_record.queue ~= 'lua-stuff' then
    msg:set_meta('queue', 'lua-stuff')
    return true
  end
  return false
end)

kumo.on('get_queue_config', function(domain, tenant, campaign)
  print('get_queue_config', domain, tenant, campaign)
  if domain == 'lua-stuff' then
    return kumo.make_queue_config {
      protocol = {
        custom_lua = {
          constructor = 'make.lua-sender',
        },
      },
    }
  end

  return kumo.make_queue_config {}
end)
```
2023-05-04 16:20:29 -07:00
Wez Furlong 2bdcd9cb4e Allow configuring multiple instances of local logging 2023-05-04 15:22:43 -07:00
Wez Furlong ac4d645670 Basic plumbing for handling deliveries in lua
```lua
-- Constructs a connection object in lua
kumo.on('make.lua-sender', function(domain, tenant, campaign)
  print 'making lua sender'
  local sender = {}
  function sender:send(message)
    print('Sending a message!', message)

    -- To log a transient failure:
    -- kumo.reject(420, 'boo!')

    -- To log a permanent failure:
    -- kumo.reject(500, "perm fail")

    -- To log success, return a string with additional data
    -- to be logged
    return 'Super!'
  end
  return sender
end)

-- Make everything use the lua "connection":
kumo.on('get_queue_config', function(domain, tenant, campaign)
  return kumo.make_queue_config {
    protocol = {
      custom_lua = {
        constructor = 'make.lua-sender',
      }
    },
  }
end)
```
2023-05-04 13:51:37 -07:00
Wez Furlong cdaae5adb1 move ideal_connection_count to be closer to caller 2023-05-04 13:51:37 -07:00
Wez Furlong 4cf2dd5e28 refactor: move DeliveryMetrics to its own file 2023-05-04 13:51:37 -07:00
Wez Furlong 28c3383169 queues: split ready queue in two halves
In preparation for web hook and other protocol delivery,
split the egress path / ready queue stuff into two pieces:

* The ready queue management
* A trait for dispatching ready queues

Implement smtp dispatching in terms of that new trait.

Add a stub trait for performing dispatching via lua; that will
be fleshed out in a follow up commit.

refs: https://github.com/KumoCorp/kumomta/issues/18
refs: https://github.com/KumoCorp/kumomta/issues/31
refs: https://github.com/KumoCorp/kumomta/issues/32
refs: https://github.com/KumoCorp/kumomta/issues/36
2023-05-04 13:51:37 -07:00
Mike Hillyer f4200c575d Automated doc formatting fix 2023-05-04 16:27:59 +00:00