Commit Graph
710 Commits
Author SHA1 Message Date
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
Mike Hillyer e0a4039a12 Fix bad formatting in Lua example. 2023-05-04 12:26:05 -04:00
Mike Hillyer 179bf825fd Forgot code tags. 2023-05-04 12:24:23 -04:00
Mike Hillyer d3f3241f82 Update routing page to reflect proper IP annotation. 2023-05-04 12:17:15 -04:00
Tom Mairs 2dffdd232d Populate admin bounce page 2023-04-28 14:41:50 -07:00
Tom Mairs c95087db60 Populate logging page 2023-04-28 14:26:56 -07:00
Tom Mairs 3635dd4caa Fix formatting 2023-04-28 13:35:45 -07:00
Tom Mairs 5a2a5e2487 Populate HTTP Injection page 2023-04-28 13:30:41 -07:00
Tom Mairs 4abb2f1418 fix formatting 2023-04-28 12:45:43 -07:00
Tom Mairs 1dadae1711 Delete placeholder 2023-04-28 13:40:04 -06:00
Tom Mairs 4f20302596 Add files via upload 2023-04-28 13:39:43 -06:00
Tom Mairs c1f64c597e Create placeholder 2023-04-28 13:39:11 -06:00
Tom Mairs 52d8efc1b8 Populate SMTP Injection page 2023-04-28 12:35:32 -07:00
Tom Mairs 452428e9d6 Populate Server Status page 2023-04-28 09:54:01 -07:00
Tom Mairs b435e210bb Add Note about CIDR strictness 2023-04-28 09:03:24 -07:00
Ubuntu ad403da74f Modify startup details 2023-04-28 08:54:05 -07:00
Mike Hillyer 7a66800f6e Automated doc formatting fix 2023-04-28 15:22:15 +00:00
Mike Hillyer 42c4b19047 Typo Fix 2023-04-28 11:21:16 -04:00