20 Commits

Author SHA1 Message Date
Guiorgy
2b9d1faabf docker: Force Unix line endings on docker/ files
When using git on Windows, git may try to "fix" line endings to CRLF.
Then, when building the Docker image, the files copied can end up having
the wrong line ending, which causes scripts to fail to run.

This patch fixes the problem by using .gitattributes to indicate to git
which line ending to use for the files in the docker/ directory.

https://github.com/albertito/chasquid/pull/66

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Adjusted commit message, extended comment on .gitattributes.
2025-08-03 10:19:07 +01:00
Alberto Bertogli
5eded4edc3 test: Unify (most) SMTP client calls
To send mails, today some tests use msmtp and others our internal smtpc.py.

This works, but msmtp slows down the tests significantly, and smtpc.py
is also not particularly fast, and also has some limitations.

This patch introduces a new SMTP client tool written in Go, and makes
almost all the tests use it.

Some tests still remain on msmtp, mainly for client-check compatibility.
It's likely that this will be moved in later patches to a separate
special-purpose test.

With this patch, integration tests take ~20% less time than before.
2024-03-12 20:43:21 +00:00
Alberto Bertogli
8ded1f6f5e Auto-format protobuf files
This patch runs clang-format on the protobuf files, and also adds a
Makefile target for auto-formatting code (Go and protobuf) for
convenience.
2023-10-03 23:34:23 +01:00
Alberto Bertogli
e6c6df457d chasquid-util: Use server for aliases-resolve and domaininfo-remove
This patch makes chasquid-util's aliases-resolve and domaininfo-remove
commands talk to the chasquid server (via the new localrpc server).

For aliases-resolve, currently has fairly hacky logic which reimplements
a bunch of the servers', and is also incomplete because it does not
support hooks.

In this patch we fix that by having it talk to the server, where we get
authoritative responses and have no issues with aliases hooks. This
resolves https://github.com/albertito/chasquid/issues/18.

For domaininfo-remove, currently its implementation is also very hacky
since it manipulates files behind the servers' back and without even
using the internal library.

In this patch we fix that by doing the operation through the server,
avoiding the need for those hacks, and also remove the need to manually
reload the server afterwards.
2023-07-30 13:21:07 +01:00
Alberto Bertogli
efefee9fbb test: Update fuzz tests to use the built-in infrastructure
Go 1.18 supports fuzzing natively, so this patch migrates our fuzzing
tests to make use of it.
2023-02-05 12:30:25 +00:00
Alberto Bertogli
fbb9bed366 ci: Add Github workflows
This patch adds two github workflows that will run on each commit, and
also regularly: CodeQL and govulncheck.
2022-10-21 10:11:37 +01:00
Alberto Bertogli
21e8d50df6 test: Improve layout of helper binaries
This patch moves the test helper binaries to a "one directory per
helper" layout, and also makes them to be ignored in the coverage build
instead of all builds.

With this change, "go build ./..." will build all binaries including the
test helpers, which helps make sure that module manage automation also
considers them. In particular, this makes "go mod tidy" work fine.
2022-08-27 18:46:54 +01:00
Alberto Bertogli
b779941f90 Remove spf-check debugging tool
The spf-check debugging tool is quite primitive, rarely (if ever) used,
not tested, and has been superceded by the one in the spf library
(https://blitiri.com.ar/git/r/spf/b/master/t/cmd/spf-check/f=spf-check.go.html).

This patch removes it.
2022-08-08 17:56:58 +01:00
Alberto Bertogli
e9c6775418 test: Remove dependency on wget
This patch removes the dependency on wget for fetching content over
http, which was used in one of the tests to do some checking on debug
and metric pages, as well as loop detection.

Instead of wget, we now use a small built-in utility called fexp.
2020-11-12 23:24:21 +00:00
Alberto Bertogli
28cb9169cc test: Add SPF integration test
This patch adds a new integration test to cover SPF checks. The main
goal is not to cover the SPF parsing, since that's handled by the
library already, but the higher level aspects: that the mails are indeed
rejected, that the DSN looks reasonable, etc.
2019-12-01 22:13:31 +00:00
Alberto Bertogli
f73b889016 Ignore fuzz-generated corpus and build artifacts 2018-03-30 22:33:53 +01: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
82a1e4597f mda-lmtp: Add a very basic MDA that uses LMTP to do the mail delivery.
mda-lmtp is a very basic MDA that uses LMTP to do the mail delivery.

It takes command line arguments similar to maildrop or procmail, reads an
email via standard input, and sends it over the given LMTP server.
Supports connecting to LMTP servers over UNIX sockets and TCP.

Since chasquid does not support direct LMTP local delivery, this can be
used as a workaround instead.

Example of use:
$ mda-lmtp --addr localhost:1234 -f juan@casa -d jose < email
2017-07-13 22:05:45 +01:00
Alberto Bertogli
f43fd3d3cf gitignore: Fix binaries to only include top-level 2016-11-01 23:56:15 +00:00
Alberto Bertogli
60ed30e95a Add a Makefile
This patch introduces a Makefile to make it easier to build with version
information, and run all the tests together.

It's just for convenience, plain go commands continue to work just fine.
2016-11-01 23:55:56 +00:00
Alberto Bertogli
f38ae47164 chasquid-util: Make the commands more user-friendly
This patch changes chasquid-util's subcommands and parameters to
(hopefully) make them more user friendly and intuitive by default.

The changes include defaulting the configuration to /etc/chasquid, and
using full addresses as usernames.

It also adds some shell tests to cover most of the functionality.
2016-10-21 22:20:49 +01:00
Alberto Bertogli
92d16a0ca9 Add a new "chasquid-userdb" command line tool
This patch adds a "chasquid-userdb" command line tool to check and add users
to chasquid's userdb files.

It's not pretty or very friendly, as it's meant to be used for testing for
now.
2016-08-01 22:56:57 +01:00
Alberto Bertogli
bb08be4023 .gitignore: Exclude *.pem files 2016-07-16 12:33:50 +01:00
Alberto Bertogli
1ee6bf563e Initial commit
Extremely basic and hacky chasquid.go.
Hard-codes ports and hostname.

"Implements" EHLO, HELO, HELP and QUIT.
2015-10-26 03:40:26 +00:00