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

592 Commits

Author SHA1 Message Date
Alberto Bertogli
644cd63eff sts: Use keyed fields in io.LimitedReader literal
Flagged by go vet:
internal/sts/sts.go:256: io.LimitedReader composite literal uses unkeyed fields
2018-07-14 10:23:36 +01:00
Alberto Bertogli
770a618c84 docs: Fix "chasquid-util user-add" typo 2018-07-14 10:08:27 +01:00
Alberto Bertogli
2d1711ac47 README: Add MTA-STS reference 2018-07-14 10:08:27 +01:00
Alberto Bertogli
ccb9ba47d2 smtp: Remove --experimental__enable_sts flag
This patch removes the --experimental__enable_sts flag, making STS
checking the default.
2018-07-14 10:08:27 +01:00
Alberto Bertogli
0ee7cb4cce sts: Add documentation and fix minor style issues
This patch adds some missing function documentation entries, and fixes
minor style issues caught by the linter.

No functional changes.
2018-07-14 10:08:27 +01:00
Alberto Bertogli
46bce576e8 sts: Add miscellaneous tests
This patch adds a few miscellaneous tests to the sts package, covering
various previously-untested code paths.
2018-07-14 10:08:09 +01:00
Alberto Bertogli
79a8cfc21c sts: DNS TXT record support
This patch adds support for checking the MTA-STS TXT record before
fetching the policy via https.

The content of the record is unused.
2018-07-01 12:19:02 +01:00
Alberto Bertogli
8bf584bd86 sts: Don't pre-filter MX list, but skip them if needed
Instead of pre-filtering the MX list based on STS policy, just check
if it's allowed before each attempt, and skip it if not.

This simplifies the code.
2018-07-01 12:19:02 +01:00
Alberto Bertogli
252ab5d3e3 sts: Update to draft-ietf-uta-mta-sts-18
This patch updates the STS implementation from draft version 02 to 18.

The main changes are:

 - Policy is now in an ad-hoc format instead of JSON (😒).
 - Minor policy well-known URL change (now ends in ".txt").
 - Enforce HTTP media type == text/plain, as with the ad-hoc format this
   becomes much more important.
 - Simplify wildcard mx matching (same algorithm), extend test cases.
 - Valid modes are "enforce" (as before), "testing" (replaces "report"),
   and "none" (new).
2018-07-01 12:19:02 +01:00
Alberto Bertogli
23deaf1f88 Reinstate the MTA-STS (Strict Transport Security) implementation
This commit brings back the experimental MTA-STS (Strict Transport
Security) implementation, removed in commit
7f5bedf4aa.

We will continue development in the "sts" branch, subject to rebase,
until it is ready to be integrated into "next" again.
2018-07-01 12:19:02 +01:00
Alberto Bertogli
a94253ba25 docs: Fix minor typo in chasquid.conf.5.pod 2018-06-06 19:47:09 +01:00
Alberto Bertogli
17b7bbe9c6 dovecot: Remove "experimental" qualifiers
dovecot support has been around for a release, has decent testing and
seems stable enough to remove the "experimental" qualifier.
v0.05
2018-06-04 23:45:18 +01:00
Alberto Bertogli
cf81fbee74 dovecot: Add tests for more error cases
This patch adds more tests for the dovecot library, in particular:
 - Protocol errors (invalid versions, etc.).
 - Invalid command (cli-specific test).
 - Connection breakups.
2018-06-04 01:34:32 +01:00
Alberto Bertogli
36692b52d3 dovecot: Include cli-based tests in the coverage tests
Many areas of the dovecot library are tested via chamuyero scripts, but
these were not being included in the coverage report.

This patch extends the dovecot-auth-cli tests so that they are now
coverage-aware.
2018-06-04 01:18:24 +01:00
Alberto Bertogli
5adb13311b testlib: Add missing comment 2018-06-04 00:06:23 +01:00
Alberto Bertogli
bbe9f4187d protoio: Test some I/O errors
This patch adds some test cases for I/O errors, in particular when
reading, writing and listing from files that don't exist or that we
shouldn't have permissions to access.
2018-06-04 00:04:57 +01:00
Alberto Bertogli
26017548ef courier: Extend MX lookup tests
This patch adds more tests to the MX lookup process, covering some
unusual cases that were missing.
2018-06-04 00:04:57 +01:00
Alberto Bertogli
b24f02e3a5 test: Test noise in the "certs" directory
This patch adds some border cases to the "certs" directory in one of
the test cases, so we check that chasquid does not get confused with
them.
2018-06-03 23:51:04 +01:00
Alberto Bertogli
029bca7013 test: Add TLS tracking integration test
This patch adds a new test, which verifies the TLS tracking.

Because we need to simulate SPF records, and Go does not support fully
intercepting DNS lookups yet, this test relies on dnsmasq to provide a
DNS resolver.

In the future, once Go supports DNS lookup interception, we can get rid
of this additional dependency.
2018-06-02 19:31:28 +01:00
Alberto Bertogli
4373f56a82 chasquid-util: Add domaininfo-remove
This patch adds a chasquid-util subcommand to remove a domain
information entry.

The main use case is to manually allow a security level downgrade, after
performing manual verification.
2018-05-24 23:02:57 +01:00
Alberto Bertogli
a177fec7c3 domaininfo: Reload periodically
This patch makes chasquid reload domaininfo periodically, so it notices
any external changes made to it.

It is in line with what we do for aliases and authentication already,
and makes it possible for external removals an additions to the
domaininfo database to be picked up without a restart.
2018-05-20 13:18:17 +01:00
Alberto Bertogli
2064e9e65d queue: Increase retry time from 12h to 20h
Some transient issues might take more than 12h to resolve, specially if
they happen overnight.

20h gives a bit more margin for retries, while still being short enough
so that users are notified early.
2018-05-20 12:05:32 +01:00
Alberto Bertogli
97826d4f88 README: Match wording with website
Rewrite some of the paragraph to make them (hopefully) clearer, reorder
the feature list in a 2-level structure for more legibility, reference
the IRC channel, and other minor wording changes.
2018-05-20 12:05:32 +01:00
Alberto Bertogli
ead3e73c49 README: Add Codefresh badge
There is now a Codefresh CI pipeline which uses Docker to run the
integration tests. Link to it from the README for convenience.
2018-04-09 22:59:14 +01:00
Alberto Bertogli
88789c8cde test: Properly exit with non-0 status on errors
SIGTERM can happen normally in our tests, and the current code has a
trap that makes it trigger a clean exit.

This causes some errors to be masked, as we end up calling "exit 0" when
they occur. The error message will still be displayed, but the caller
script will assume it worked.

This patch fixes the problem by adjusting the bash signal handlers, so
that we ignore SIGTERM (so bash does not get killed by the exit handler)
and exit with error on SIGINT (triggered by ctrl-c).

Note that under some conditions the SIGTERM trap is not necessary, but
this depends on the environment.
2018-04-09 22:51:01 +01:00
Alberto Bertogli
24af22ac35 docs: Add man pages
This patch adds man pages for chasquid's main commands and
configuration. They are generated using pod2man (commonly used for this,
and included with perl in most distributions).

The generated man pages are included to avoid introducing a dependency
for such simple task, similar to how we handle protocol buffer generated
files.
2018-04-04 21:26:02 +01:00
Alberto Bertogli
4e2e3785d2 normalize: Fuzz testing 2018-03-30 22:35:08 +01:00
Alberto Bertogli
9f603da8de auth: Fuzz testing 2018-03-30 22:33:53 +01:00
Alberto Bertogli
e543a03feb aliases: Fuzz testing 2018-03-30 22:33:53 +01:00
Alberto Bertogli
f73b889016 Ignore fuzz-generated corpus and build artifacts 2018-03-30 22:33:53 +01:00
Alberto Bertogli
9ef481633a test: Add Dockerfile
This patch adds a Docker configuration file, to build an image that can
run the integration and stress tests.

It might be used for configuring automated testing infrastructure in
subsequent patches.
2018-03-27 08:37:11 +01:00
Alberto Bertogli
1b28734e44 test: Make "chamuyero" work in utf8 regardless of the environment
Our chamuyero tests involve reading and writing utf8. This usually
works, but is dependent on the environment: on LC_ALL=POSIX environment,
for example, Python enforces ascii as the default encoding, and the
tests break.

So this patch makes chamuyero explicitly set utf8 encodings in stdout
and all the sockets.
2018-03-26 01:58:47 +01:00
Alberto Bertogli
b0011f5a51 test: Add stress tests
This patch introduces stress tests, which put load on the daemon to help
sanity check its behaviour under stress.

They are separate from the existing integration tests, which focus on
correctness.

Two tests are included here: a load test, which sends emails repeatedly;
and a connection test which opens as many conections as possible.
2018-03-26 01:58:47 +01:00
Alberto Bertogli
4abffc9aaa docs: Minor link and wording fixes
Fix a link to letsencrypt in the how-to, and missing wording in the
readme.
2018-03-04 21:01:06 +00:00
Alberto Bertogli
f3b01cb493 docs: Add missing docstrings, adjust wording to match standard style
This patch adds a missing docstrings for exported identifiers, and
adjust some of the existing ones to match the standard style.

In some cases, the identifiers were un-exported after noticing they had
no external users.

Besides improving documentation, it also reduces the linter noise
significantly.
2018-03-04 16:00:06 +00:00
Alberto Bertogli
40ae9b5f69 docs: Minor edits to the README file
This patch includes minor changes to the README file, such as small
rewordings, adding various links, and badges for convenience.
2018-03-03 14:04:21 +00:00
Alberto Bertogli
0f7fb6b8c7 docs: Split install instructions out of the README
To keep documentation more organized, this patch splits the install
instructions to its own file, and references it from the README file.
2018-03-02 19:56:17 +00:00
Alberto Bertogli
12b856a387 docs: Add a how-to guide
This patch adds a brief how-to guide for setting up an email server with
Debian, dovecot and chasquid.

It is incomplete, but has enough information that it's ok to include it.
2018-03-02 19:55:12 +00:00
Alberto Bertogli
407f7cf79a test: Test monitoring HTTP fetching
This patch adds HTTP fetching to the integration tests.

It checks that the URLs are properly exported and that the server
replies reasonably to them. The contents are saved as they might be
useful as a debugging aid.

They're added to t-09-loop as it already was doing other HTTP fetches,
but the changes are not particularly tied to it.

The content of the pages is not checked yet, that might come in
subsequent patches.
2018-03-02 19:37:37 +00:00
Alberto Bertogli
83e40da3f6 test: Fix "run without certificates" test
The test to check that chasquid fails on startup if there are no valid
TLS certificates is passing, but for the wrong reasons: it fails because
there is no logging directory, not because there are no certificates.

This patch fixes the problem by moving the logs directory creation
before the first test.
2018-03-02 19:37:37 +00:00
Alberto Bertogli
f4fb2153b8 protoio: Use keyed fields in composite literal
In the protoio tests, we were using unkeyed fields in some composite
literals. This can cause confusion and makes the code more brittle wrt.
future changes. go vet also complains about this.

This patch fixes the issue by adding the field names to the struct
initializations.
2018-03-02 19:37:37 +00:00
Alberto Bertogli
f629ffefa4 trace: Remove unused SetError function 2018-03-02 19:37:37 +00:00
Alberto Bertogli
420754b0a0 auth, dovecot: Add missing Reload tests
auth.wrapNoErrorBackend.Reload and dovecot.Reload were not being tested;
this patch fixes that by adding a simple test for each.
2018-03-02 19:37:37 +00:00
Alberto Bertogli
61d2961ee9 test: Add a new integration test with minor dialogs
This patch adds a new integration test, which executes various small
dialogs, to cover corner cases that are not well covered (according to
our coverage report).

For example, "EHLO" without domain, or invalid DATA.

While we could do them via Go tests, this way is more realistic, and the
tests are easier to write.
2018-03-02 19:37:37 +00:00
Alberto Bertogli
5ce4ff2602 gitignore: Ignore dovecot-auth-cli binaries 2018-03-02 19:37:37 +00:00
Alberto Bertogli
bb90274edd test: Add tools to generate test coverage information
This patch adds some tooling and scripts to generate test coverage
information.

Unfortunately, this involves some hacks as Go does not have support for
generating coverage-enabled binaries, or merging coverage reports; but
overall it's not very intrusive.
2018-03-02 19:37:37 +00:00
Alberto Bertogli
751fbd4b55 test: Integration test for reload
This patch implements an integration test for reloading; in particular
it exercises reloading aliases and user databases.
2018-03-02 19:37:37 +00:00
Alberto Bertogli
0611b7a7fc test: Add small miscellaneous tests
This patch extends various packages and integration tests, increasing
test coverage. They're small enough that it's not worth splitting them
up, as it would add a lot of noise to the history.
2018-03-02 19:37:37 +00:00
Alberto Bertogli
d80c76f746 envelope: Handle zero-length keys in AddHeader
We don't expect the AddHeader function to be given an empty key;
however, if that were to happen, it currently crashes.

This patch fixes the bug, while also adding tests for that and other
similar cases.
2018-03-02 19:37:28 +00:00
Alberto Bertogli
0ae5798d20 dovecot: Support dovecot-side username changes
Dovecot has options for changing the formatting of usernames; for
example, dropping the domain part, or replacing characters.

chasquid's implementation, however, fails to handle this well, as it
expects the reply to contain the username exactly as requested.

This patch fixes the problem by making chasquid ignoring the returned
username, which is unused anyway. The protocol is unambiguous enough.

Tests are also amended to always exercise this case.
2018-03-02 19:08:00 +00:00