1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00
Commit Graph

409 Commits

Author SHA1 Message Date
Alberto Bertogli
a75eabbc22 test: Generate a prettier coverage report
To make the coverage report a bit more accessible and easier to
navigate, this patch makes the coverage tests generate a new HTML
coverage report (in addition to the classic variant).
v1.1
2019-10-26 01:56:33 +01:00
Alberto Bertogli
809578cb57 README: Update links and shields
This patch updates the README file, adjusting some of the existing
references, as well as adding new ones (mainly pointing to new
documentation).
2019-10-25 16:00:15 +01:00
Alberto Bertogli
e8511e3f55 docs: Update install/build documentation
This patch updates the installation guide to try to make the
installation section more readable.

It also assumes a modern Go environment is installed, which
simplifies the process of building from source.
2019-10-25 16:00:15 +01:00
Alberto Bertogli
a47faf89a4 smtpsrv: Failures to enqueue are transient, not permanent
If we fail to put the message in the queue (e.g. because we're out of
storage space, or the aliases-resolve hook errored out), it should be
considered a transient failure.

Currently we return a permanent error, which is misleading, as we want
clients to retry in these situations.

So this patch changes the error returned accordingly.
2019-10-24 21:37:09 +01:00
Alberto Bertogli
0718749314 Update auto-generated code
This patch updates the auto-generated code to match the latest tooling
versions.

In particular, the protobufs are regenerated, and the new version no
longer supports unkeyed literals, so some minor changes are needed.

Other than that, the cipher list is extended with the latest ciphers.
2019-10-24 21:37:09 +01:00
Alberto Bertogli
f399fe3e84 aliases: Implement aliases hooks
This patch implements two new hooks: alias-resolve and alias-exists.

They are called during the aliases resolution process, to allow for more
complex integration with other systems, such as storing the aliases in a
database.

See the included documentation for more details.
2019-10-24 21:37:09 +01:00
Alberto Bertogli
dea6f73164 aliases: Treat empty pipe aliases as bad lines and skip them
A pipe alias must have a command, if it doesn't, we should treat the
line as bad and skip it like we do for others.
2019-10-22 22:14:26 +01:00
Alberto Bertogli
5f72f723db smtpsrv: Clean up post-data hook tracing output
This patch does some cleanups on the tracing output for the post-data
hook, to quote the output better and more consistently.
2019-10-22 21:45:54 +01:00
Alberto Bertogli
5782a7705e hooks: Add rspamd integration to the example hook
Rspamd (https://rspamd.com/) is a popular open-source spam filtering
system.

This patch adds integration with it in the example hook, which uses the
rspamc client to get a veredict, similar to what it does for
Spamassassin.
2019-10-21 13:51:58 +01:00
Alberto Bertogli
27227986ab smtp-check: Improve error reporting
smtp-check exits on the first error, which is not ideal when
troubleshooting, as seeing only one error can mask others, or make it
more difficult to find the underlying cause.

This patch improves how smtp-check reports errors by tweaking the
presentation a bit, as well as perform almost all checks regardless of
whether they pass or not.
2019-10-19 14:26:47 +01:00
Alberto Bertogli
0bf8f72c73 docs: Add documentation about tests
This patch replaces test/README, which was becoming a bit outdated, with
a more general description of the different tests at a high level, and
includes it in the documentation index.
2019-10-19 13:06:30 +01:00
Alberto Bertogli
605e39d0e3 test: Extend chasquid-util aliases-add tests 2019-10-19 13:06:30 +01:00
Thor77
8d910fc84d Add aliases-add subcommand to chasquid-util 2019-10-19 13:06:30 +01:00
Alberto Bertogli
9dea372d96 gitlab-ci.yml: Run integration tests against submitted and latest deps
It is useful to run the integration tests both against the submitted
dependencies, based on Go module versions from the repository, as well
as the latest ones, to catch integration problems early.

This patch extends the .gitlab-ci.yml configuration to do that, by
optionally passing a flag to "go get" to update the modules.
2019-10-19 13:06:30 +01:00
Alberto Bertogli
3aa7bb4555 test: Adjust Dockerfile to support modules
When modules are configured, go will now attempt to fetch them on build,
using the proxy.

That causes the integration tests run via Docker to fail, because go
build attempts to contact the proxy within the test environment, which
has the external DNS resolvers disabled.

This patch fixes the problem by adjusting the pre-run fetch to use the
new modules system. We fetch the dependencies to the cache so that when
they're needed within the environment, they are present and there's no
need to use the proxy.
2019-10-19 13:06:26 +01:00
Thor77
80b4f7f832 Add support for go modules 2019-10-19 00:45:18 +01:00
Alberto Bertogli
5fa756fddc docs: Clarify how users are identified to dovecot
In authentication requests sent to dovecot, chasquid uses the full
addresses, "user@domain". However this wasn't mentioned in the
documentation, and could cause some confusion.

So this patch adds an explicit clarification about this in the dovecot
integration documentation.
2019-10-19 00:45:18 +01:00
Alberto Bertogli
bb97991a24 docs: Add aliases documentation
The processing of aliases wasn't properly documented in an user-visible
way, so this patch adds a new section for it.
2019-10-19 00:45:18 +01:00
Alberto Bertogli
41d960590d smtpsrv: Use spf.CheckHostWithSender
The spf library has gained support for macros, but to process them
properly, a new function needs to be called with the full sender
address, spf.CheckHostWithSender.

This patch updates chasquid's calls to the new API.
2019-10-14 19:37:14 +01:00
Alberto Bertogli
3584441549 test: Use testlib.RemoveIfOk where appropriate
Some tests did not make use of testlib.RemoveIfOk, which resulted in
some duplication; this patch fixes that.

While at it, userdb tests have its own simpler variant, so add some
safety checks to it.
2019-09-10 01:09:44 +01:00
Alberto Bertogli
34ade50374 test: Work around msmtp having setgid permissions
In some distributions, including newer Debian versions, msmtp is
installed as setgid.

That prevents $HOSTALIASES from being honoured, which breaks the tests.

This patch works around the problem by creating a copy of the binary,
which will not have the setgid bit set.
2019-08-31 01:27:19 +01:00
Alberto Bertogli
f63e5bf0b2 sts: Reject policies with max_age > 1y, as per RFC
The MTA-STS standard explicitly says the maximum max_age is 1 year.

This patch adds a check to the STS library to enforce this. Policies
with max_age > 1y will be treated as invalid.

See this email thread for some discussion on the topic:
https://mailarchive.ietf.org/arch/msg/uta/bnUjy9jxM_Va-lDXVtbB32zIkYI
2019-08-31 01:14:56 +01:00
Alberto Bertogli
0f487e5fb5 test: Remove dependency on Python 2
Python 2 is approaching end of life, and we only need it to run
the mail_diff test utility.

This patch updates mail_diff to run on Python 3, which only needed minor
changes.
2019-08-30 09:46:46 +01:00
Alberto Bertogli
e98464c424 docker: Add Dockerfile for running chasquid+dovecot+letsencrypt
This patch adds a new docker directory, which contains a Dockerfile plus
some additional configuration for creating a container that runs
chasquid+dovecot+letsencrypt.

It also updates the gitlab CI pipeline to automatically build and
publish an image on each commit.

This is experimental and likely to break.
2019-08-12 01:21:41 +01:00
Alberto Bertogli
a7d49792f5 docs: Self-host the documentation
Instead of use readthedocs.org, point to the self-hosted version of the
rendered documentation.

We still use mkdocs to generate it, it's just more practical and
consistent to self-host the documentation.
2019-08-07 00:59:45 +01:00
Alberto Bertogli
c6c9866ae1 docs: Add documentation for security level checks
This patch adds documentation for the security level checks, and
references it (the rendered version, for convenience) from the README
file.
2019-08-06 03:05:43 +01:00
Alberto Bertogli
d348477841 docs: Integrate with readthedocs.org
This patch adds configuration to integrate with readthedocs.org, using
mkdocs as rendering engine.

It also does minor documentation updates, to tidy some things up
(clearer titles, move some documentation from the root into docs/, etc).
2019-08-05 14:30:14 +01:00
Alberto Bertogli
0d3bbe11c0 test: In the docker entrypoint, wait for minidns to come up
The tests might start running and attempting to do DNS resolutions
before minidns has come up, which can cause false positives and flaky
tests.

This patch makes the entrypoint wait until minidns has come up, to fix
the problem.
2019-08-04 04:55:07 +01:00
Alberto Bertogli
5102007687 test: Adjust docker test to msmtp being a setgid binary
The golang image has been updated to use Debian buster. In that version,
msmtp is now setgid, which means glibc sanitizes the environment before
forking and $HOSTALIASES will be ignored, which breaks the tests.

This patch works around the problem by removing the setgid bit from
msmtp.
2019-08-04 04:55:01 +01:00
Alberto Bertogli
e8ccff749e docs: Add documentation for the monitoring facilities
This patch adds a new document, to cover the monitoring facilities
provided by the daemon.
2019-07-16 01:31:57 +01:00
Alberto Bertogli
25624b406d docs: Document submission_over_tls_address option
The submission_over_tls_address configuration option has existed for a
long time, but was not properly documented.

This patch adds it to the manpage, as well as printing it in the
configuration output on startup.
v1.00
2019-07-15 01:58:55 +01:00
Alberto Bertogli
dade2041db README: Add link to the gitlab CI pipeline status
The integration tests are automatically run in a gitlab CI pipeline,
using docker.

This patch adds a link to the current status, like we do for the Go test
that are run in Travis, for convenience.
2019-07-14 00:26:19 +01:00
Alberto Bertogli
0a29f25f14 UPGRADING: Add note for the upcoming version
We don't expect any backwards incompatible change, so mention this in
the UPGRADING notes.
2019-07-13 18:39:28 +01:00
Alberto Bertogli
5d932b44a0 README: Update status and add line about main design target 2019-07-13 18:37:25 +01:00
Alberto Bertogli
1a764cb87c docs/howto: Minor updates
This patch contains some minor updates to docs/howto.md for simplicity
and readability.

In particular removing the "testing" qualifier from Debian, since the
guide can be used on Debian stable, and also removing a clarification in
a comment about a very old version of chasquid.
2019-07-13 18:18:28 +01:00
Alberto Bertogli
d6c1b4a359 test/t-14-tls_tracking: Remove Go version check
The test/t-14-tls_tracking test relies on Go 1.8 features, but since we
used to support Go 1.7, the test had a version check.

Since now the minimum Go version supported is 1.9, we can remove this
check.
2019-07-13 14:56:26 +01:00
Alberto Bertogli
d6bbea391f maillog: Test that we log to the system logger on write errors
The maillog package will write to the system logger if it can't write to
the mail log. It does this only once to avoid spamming the system logger
on misconfigurations.

This patch adds a test for this condition.
2019-07-13 14:45:59 +01:00
Alberto Bertogli
d53d97aba0 dovecot: Test autodetection works with closed sockets
We want to test that autodetection works with closed sockets, as we
explicitly support that scenario: chasquid might be up before dovecot
is, and we still want the detection to work.

The code is written that way, but we had no tests for it until now,
because we were blocked on the unix listeners supporting
SetUnlinkOnClose, which appeared in Go 1.8.

Now that the minimum Go version has been raised past that, we can
implement the test.
2019-07-13 14:06:13 +01:00
Alberto Bertogli
9821a17d6c sts: Use expvar.Int.Value in tests
Now that we raised the minimum Go version to 1.9, we can make use of
expvar's .Value methods to simplify some of the STS tests.

This patch makes those simplifications, which do not change the logic of
the tests themselves.
2019-07-13 13:52:28 +01:00
Alberto Bertogli
2943f994e7 Use context.WithTimeout instead of context.WithDeadline
There are a few context.WithDeadline calls that can be simplified by
using context.WithTimeout.

At the time they were added, WithTimeout was too new so we didn't want
to depend on it. But now that the minimum Go version has been raised to
1.9, we can simplify the calls.

This patch does that simplification, which is purely mechanical, and
does not change the logic itself.
2019-07-13 13:44:25 +01:00
Alberto Bertogli
a92497aef0 travis: Increase minimum supported version to 1.9
As of a29dc8fd (2019-04-26), golang.org/x/crypto requires math/bits.
math/bits was introduced in Go 1.9, so we can no longer build from head
using 1.7.

Building using Debian's packaged dependencies should work just fine, but
since we want Travis to build from head, this commit updates the minimum
supported version to 1.9.
2019-05-05 13:04:04 +01:00
Alberto Bertogli
a5edd9053f queue: Make DSN tidier, especially in handling multi-line errors
This patch contains some changes to generate tidier DSNs, which should
make them slightly more readable.

In particular, it also makes it able to handle multi-line errors much
better than before.
2019-05-04 21:28:07 +01:00
Alberto Bertogli
cac1e161ac smtpsrv: Set connection deadline before the initial greeting
When handling a connection, today we only set a deadline after each
command received.

However, this does not cover our initial greeting, or the initial TLS
handshake (if the socket is TLS), so a connection can hang
indefininitely at that stage.

This patch fixes that by setting a deadline earlier, before we send or
receive anythong on the connection.
2019-03-31 12:13:09 +01:00
Alberto Bertogli
ec95131bb4 Miscellaneous style fixes
This patch has some miscellaneous style fixes to issues found by the
staticcheck tool.

There are no functional changes.
2019-02-10 12:46:15 +00:00
Alberto Bertogli
582da79eca UPGRADING: Add (no-op) note for the upcoming version v0.07 2019-01-19 00:28:16 +00:00
Alberto Bertogli
1ecc957aba queue: Internationalized Delivery Status Notifications (DSN)
Our non-delivery status notifications are quite simple today, but that
makes it much more difficult to support internationalization and
cross-language reporting.

There is a standard for internationalized DSNs, RFC 6533 (which builds
on top of the structured DSNs from RFC 3464).

This patch changes our DSN messages to be based on those standards, so
it is easier for MUAs to display reports according to the users'
languages preferences.

Note we still use message/rfc822 + 8bit to transmit the message, instead
of message/global, for compatibility reasons. This seems to be more
universally compatible, but the decision might be revisited in the
future. See RFC 5335 (section 4.6 in particular).
2019-01-18 23:27:10 +00:00
Alberto Bertogli
abf91eac8d test: Make mail_diff support comparing multipart messages
In upcoming patches we will want to compare mime-multipart messages, so
this patch extends the mail_diff test helper to support it.
2019-01-18 14:54:29 +00:00
Alberto Bertogli
e7309a2c7b smtpsrv: Send enhanced status codes
SMTP supports enhanced status codes, which help with
internationalization and accessibility in cases where protocol errors
make their way to the users.

This patch makes chasquid include these extended status codes in the
corresponding replies, as well as advertising support in the EHLO reply.

Main references:
- RFC 3463 (https://tools.ietf.org/html/rfc3463)
- RFC 2034 (https://tools.ietf.org/html/rfc2034)
- SMTP Enhanced Status Codes Registry
  (https://www.iana.org/assignments/smtp-enhanced-status-codes/smtp-enhanced-status-codes.xhtml)
2019-01-10 15:44:25 +00:00
Alberto Bertogli
78937aca93 travis.yml: Add IRC notifications 2018-12-02 01:23:49 +00:00
Alberto Bertogli
4db9ffec09 Code style improvements
This patch contains some minor code style improvements, to leave the
linter happier and generally follow best practices in some areas where
things snuck through.
2018-12-01 11:58:50 +00:00