Commit Graph
30 Commits
Author SHA1 Message Date
Wez Furlong 1e3e208405 traffic-gen: fix usage with starttls
We were passing `hostname:port` as the server name used to verify
the certificate name, but it should just be `hostname`.
2023-06-13 10:29:21 -07:00
Wez Furlong 9d3411431f Add outbound SMTP auth support
refs: https://github.com/KumoCorp/kumomta/issues/10
2023-05-15 17:38:17 -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
Wez Furlong cb362592e7 Fix Domain::Tagged to_string issue
When given an extension/tagged domain, we didn't include the closing
square bracket when rendering it as text.

Note that this looks like an IPv6 address, but it is not a conforming
IPv6 address which looks like `[IPv6:aaaa::bbbb]` rather than
`[aaaa:bbbb]`. The latter uses tag "aaaa" to define a different
addressing namespace that has no known implementation.

<https://datatracker.ietf.org/doc/html/rfc5321#section-4.1.3>
2023-04-21 11:41:14 -07:00
Wez Furlong b57126f724 allow STARTTLS to fail without wiping out the connection
This should improve diagnostics around handshake errors
2023-03-23 16:01:47 -07:00
Wez Furlong 80c6f21b22 marginally improve logging of failed TLS handshake from server side 2023-03-23 15:16:44 -07:00
Wez Furlong 269e0702b4 add SMTP AUTH PLAIN support
Verified via:

```
swaks ... --auth plain --tls --auth-user scott --auth-password tiger
```
2023-03-11 16:23:49 -07:00
Wez Furlong b3fa0dab3e raise integration test timeouts a bit 2023-03-08 22:54:49 -07:00
Wez Furlong b458bbced1 refactor integration testing to make it a bit easier to use
Helpers for generating messages, summarizing deliveries,
reducing boilerplate in the tests themselves.

Add SMTP line length test.
2023-03-08 10:32:01 -07:00
Wez Furlong 257dc4a25a flesh out integration testing some more
This has our first end-to-end integration test that validates
smtp -> source mta -> sink mta -> maildir
and confirms that the message has the right bits inside it.

The end to end test will get refactored into more easily usable
pieces in follow-up commit(s).
2023-03-07 18:42:14 -07:00
Wez Furlong 52f7ab6150 add prohibited_hosts and skip_hosts for outbound resolving
While in that part of the code, handle null MX destination domains
(such as `example.com) more nicely.
2023-03-04 10:09:17 -07:00
Wez Furlong 74635be9fb Add extensible bounce classifier
The classifier can load and merge rules from multiple files.
A basic iana enhanced status codes ruleset is provided.
A deployment can define their own to augment that set.

This commit is just the core classifier functionality; it
is not yet connected to kumod.

The classification enum is a bit of an amalgam of categories
defined by other well-known vendors/products and the categories
defined by IANA.  Some classifications have no corresponding
rules at the current time.
2023-03-02 08:27:32 -07:00
Wez Furlong cd7ba3a2bb make smtp client timeouts configurable by command 2023-03-01 12:19:45 -07:00
Wez Furlong 9338de3d06 delay ready queue when target site is persistently unavailable
Tidy up the logging around this; move some error logs to debug level,
especially since we log message events to the log file for that purpose;
there is no need to log errors to the console for this.
2023-02-26 22:26:03 -07:00
Wez Furlong dd7c7a6292 graceful shutdown part 2
This adds some logic to save any messages that had spooling
deferred and release them once shutdown is requested.
2023-02-22 18:50:19 -07:00
Wez Furlong bcd4a6fc6d take a crack at logging receptions and deliveries 2023-02-22 11:57:26 -07:00
Wez Furlong 681784f3e1 allow "mail from:user@host" with no <>
Same for "rcpt to". The <> are required in the ABNF in the spec,
but they are widely considered to be optional by major implementations,
which makes it convenient when ad-hoc testing via telnet.

We require the <> when ESMTP mail from or rcpt to parameters are
used.
2023-02-22 07:20:14 -07:00
Wez Furlong aa508b012a smtpclient: include command in Response
This will make the logs more useful when we start writing those
2023-02-22 06:59:13 -07:00
Wez Furlong ca0456a6f7 fix detecting EOF 2023-02-20 10:27:20 -07:00
Wez Furlong 20749ddd30 add pipelining support to the smtp client 2023-02-18 18:42:55 -07:00
Wez Furlong d889acc275 replace mail-send with our own client implementation
This removes a dep on an AGPL crate
2023-02-17 11:08:59 -07:00
Wez Furlong 42d885ef02 add basic smtp client 2023-02-17 09:44:27 -07:00
Wez Furlong 7a9780361a implement starttls using automatic self-signed certs
We can make proper cert+key configurable later
2023-02-16 22:58:46 -07:00
Wez Furlong 03fb1f1cb8 do our own line buffering in preparation for starttls
This also allows us to handle excessive input line length as well.
2023-02-16 22:20:44 -07:00
Wez Furlong 7410cfd1b1 adopt BoxedAsyncReadAndWrite in smtp server
This allows erasing the <T> generic from the smtp server,
which in turn will make it possible to switch up to TLS
in a future commit.
2023-02-16 20:21:17 -07:00
Wez Furlong 135354b140 move AsyncReadAndWrite trait to rfc5321
This is prep for doing some protocol client/server work in this crate.
2023-02-16 20:10:40 -07:00
Wez Furlong a710a88db5 cut over smtp server to new command parser 2023-02-16 18:09:55 -07:00
Wez Furlong 01f38f509a format 2023-02-16 16:35:18 -07:00
Wez Furlong f9155541fe Add fuzzer for rfc5321 parser 2023-02-16 16:34:44 -07:00
Wez Furlong c4c206df1e Add rfc5321 protocol parser
This parses commands received by the server.
Can be expanded to responses from a server in the future.
2023-02-16 16:25:17 -07:00