* chore: install swaks from the Debian package
Debian Trixie ships the same upstream version (20240103.0) that was
downloaded from the GitHub release, so the download is no longer needed
and the package receives updates from Debian.
* docs(changelog): link the pull request
---------
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
* fix(build): use Debian's Dovecot config layout with the CE packages
The Dovecot CE repo ships a minimal config layout that DMS does not
expect: no 15-lda.conf, 90-fts.conf or 20-pop3.conf, a 2.3-style
20-managesieve.conf, and a dovecot.conf without the commented
protocols/listen lines or the local.conf include. The startup scripts
then fail to enable LMTP, so Postfix cannot deliver to Dovecot, and a
custom dovecot.cf is ignored.
When DOVECOT_COMMUNITY_REPO=1, install the config files from Debian's
own packages of the same release, as Debian's postinst does. Also
tolerate the missing 90-fts-flatcurve.conf, which only Debian ships,
as the build otherwise fails.
* fix(build): install ssl-cert explicitly
Dovecot and Postfix default to the snakeoil cert from the ssl-cert
package. Debian's dovecot-core depends on ssl-cert, but the Dovecot CE
package does not, so with DOVECOT_COMMUNITY_REPO=1 the cert is missing
and Dovecot fails to start when no SSL_TYPE is set.
* fix(dovecot): disable attachment detection keywords explicitly
Dovecot 2.4.2 changed the default of mail_attachment_detection_options
to add-flags for maildir and dbox. This per-driver default is applied
even with dovecot_config_version = 2.4.0, so LMTP adds a
$HasNoAttachment keyword and maildir stores new mail in cur/ instead of
new/. Set it explicitly to keep the 2.4.0/2.4.1 behaviour. This is a
no-op with Debian's Dovecot 2.4.1.
* tests: make the letsencrypt doveconf check work with Dovecot 2.4.2+
Querying `doveconf ssl_server` prints nothing with Dovecot 2.4.5, and
querying the full setting names prints empty values with 2.4.1. Use
`doveconf -n -P`, which prints the same lines on both.
* docs: add changelog entries for the Dovecot CE build fixes
* docs: link the changelog entries to #4834
* fix(build): exclude the CE repo instead of matching deb.debian.org
Matching the deb.debian.org host made builds behind a different Debian
mirror (Artifactory, apt-cacher-ng, regional mirrors) fail to find the
Debian version of dovecot-core. There are only two sources, so exclude
repo.dovecot.org instead.
* docs: describe the attachment detection setting as a deliberate choice
Mail in cur/ without the S flag is still valid maildir and still
unread, so the explicit empty value is for parity with the Debian
build, not a bug fix. Say so in the config comment and the changelog,
and mention how to enable the feature.
---------
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
* fix(rspamd): pin Rspamd to 4.1.5 and install it from a verified .deb
The Rspamd apt repo only lists the newest release, so every image build
and rebuild picked up whatever Rspamd had just released. Download the
pinned release from the repo's pool instead and verify its sha256 for
amd64 and arm64. 4.1.5 is the version in Debian testing (forky).
* docs(changelog): link the pull request
Postfix LDAP configs are now generated at startup to `/etc/postfix/ldap/<KIND>.cf`
(`users`, `groups`, `aliases`, `domains`, `senders`) from these sources, later ones take precedence:
1. Defaults (`version = 3`, `result_attribute = mail`, `senders`: `mail, uid`).
2. `LDAP_<SETTING>` ENV for all configs.
3. The custom config `ldap-<KIND>.cf` from the DMS config volume (now also supported for `senders`).
4. `POSTFIX_<KIND>_<SETTING>` ENV for a single config.
A config without `query_filter` is not generated and its lookup table is not configured
(including `smtpd_sender_login_maps` with `SPOOF_PROTECTION=1`). Previously all lookup
tables were always configured, as the default configs shipped by the image always existed.
Breaking:
- `LDAP_QUERY_FILTER_{USER,GROUP,ALIAS,DOMAIN,SENDERS}` are renamed to
`POSTFIX_{USERS,GROUPS,ALIASES,DOMAINS,SENDERS}_QUERY_FILTER` (an error is logged when the old ENV is set).
- `/etc/postfix/ldap-*.cf` moved to `/etc/postfix/ldap/*.cf`, the default configs (with default query filters) were removed.
Reworked from the original "Config Templates" proposal: Dovecot (already reworked for Dovecot 2.4)
and SASLAuthd are unchanged, and no template files or additional dependencies (`zenv`, `envsubst`) are required.
Signed-off-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
* fix: Helper `_replace_by_env_in_file()` support delimiter parameter
Minor change to add support for usage with `saslauthd.conf` which differs with `:` for it's key/value delimiter.
Also adopts the`_escape_for_sed()` method, instead of the inline sed pattern (_which for some reason escaped `=` but not `(` + `)`, thus buggy if ever matching on input with those tokens_).
`_escape_for_sed()` likewise wasn't escaping for `(` + `)` or even `|`, which are required for proper escape support if using `sed -E` / `sed -r` with this method. Additionally added escaping support for `&` replacement segment token, which seems valid. Increased verbosity to better grok pattern matching expression, clarified escaping concern with `sed` delimiter since the project is not consistent there.
* chore: Preserve K/V white-space of original source
No need to check for a non-empty value to prepend a space (_since an empty value is used via sed anyway?_).
Can also be a bit DRY with the sed pattern, matching the key + delimiter (_and all white-space before/after the delimiter until the value_), then capture that for the replacement left-side value while only actually swapping the value for the ENV input value.
Should be an improvement, unless there is a scenario that would differ between `` and ` ` as valid value assignments?
* chore: Adopt `sedfile` + case-insensitive pattern matching
Both should be improvements for usage
Co-authored-by: Casper <casperklein@users.noreply.github.com>
* fix: Harden `_replace_by_env_in_file()` and update tests
- Split each ENV line at the first `=` only, `IFS='=' read` dropped a trailing `=` from values (e.g. base64 padded passwords).
- Use `/` as the `sed` delimiter, as it is the only delimiter escaped by `_escape_for_sed()` (values with `#` broke the expression).
- Revert `sedfile` to `sed -i`: most prefixed ENV have no matching key, so an unchanged file is expected and `sedfile` would log spurious errors.
- Drop the unused key/value delimiter parameter.
- Avoid trailing white-space when the value is empty.
- Tests: Expect the retained white-space, add edge-cases for `sed` tokens and a trailing `=`, compare LDAP settings white-space insensitive.
Signed-off-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
---------
Signed-off-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
Co-authored-by: Casper <casperklein@users.noreply.github.com>
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
* chore: bump `jaq` from 2.3.0 to 3.0.0
* chore: bump `step-cli` from 0.28.7 to 0.30.2
* chore: formatting
---------
Signed-off-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
* fix: Enable change detection support for `ACCOUNT_PROVISIONER=LDAP`
* fix(test/rspamd_full): Explicitly wait for the `rspamd_proxy` port to be available before testing
- Ensure catch-all alias entries (eg: `@example.test`) are also skipped. Adding a dummy account for catch-all will not match a `quota-status` query to Dovecot by Postfix for a recipient.
- When there are multiple addresses provided, they will now be iterated through by the `,` delimiter, instead of as a single value that fails. This way the first valid aliased address to a local Dovecot mailbox account will now be used for the dummy alias account.
- The common logic for extracting the quota user attribute is now split out to a common function call.
Refactoring this `setup` CLI command as part of the effort to unify our DKIM feature support between OpenDKIM + Rspamd:
- Adds a `main()` method similar to other setup CLI commands.
- Help text more aligned with equivalent rspamd DKIM setup CLI command.
- DRY some repetition such as hard-coded paths to use variables.
- OpenDKIM config files are created / initialized early on now with `_create_opendkim_configs()`. `while` loop only needs to append entries, so is easier to grok.
- `_create_dkim_key()` to scope just the logic (_and additional notes_) to key generation via `opendkim-genkey`
- Now overall logic with the `while` loop of the script occurs in `_generate_dkim_keys()`:
- Ownership fixes are now applied after the `while` loop as that seems more appropriate than per iteration.
- Temporary VHOST config is now removed since it's no longer useful after running.
- Tests adjusted for one new log for adding of default trusted hosts content.
Overall this should be nicer to grok/maintain. Some of this logic will be reused for the unified DKIM generation command in future, which is more likely to shift towards all domains using the same keypair by default with rspamd/opendkim config generated at runtime rather than reliant upon DMS config volume to provide that (_still expected for private key_).
---------
Co-authored-by: Casper <casperklein@users.noreply.github.com>
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>