Commit Graph

767 Commits

Author SHA1 Message Date
Brennan Kinney 6d06149581
fix: Restore detection of letsencrypt certificate file changes (#2326)
The `DYNAMIC_FILES` var was quote wrapped, treating all filepaths to create checksums for as a single string that would be ignored instead of processed individually.

Removed the quotes, and changed the for loop to an array which accomplishes the same goal.


* fix: Prevent unnecessary change detection event

`acme.json` change would extract new cert files, which would then be hashed after restarting services and considered a change event, running through the logic again and restarting services once more when that was not required.

The checksum entries for those cert files are now replaced with new entries containing updated checksum hashes, after `acme.json` extraction.
2021-12-19 11:25:15 +13:00
Georg Lauterbach a4095a7d48
Disable `service stats` for Dovecot explicitly (#2292)
Co-authored-by: Casper <casperklein@users.noreply.github.com>

Co-authored-by: Casper <casperklein@users.noreply.github.com>
2021-12-12 12:08:34 +01:00
Robert Schumann b11e5ffd1a
fetchmailrc split: ignore commented lines (#2305)
Co-authored-by: Robert Schumann <robert@schumann.link>
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-11-29 15:24:38 +01:00
Casper a8a39a0a1a
Rename function and adjust comment (#2306) 2021-11-28 17:02:07 +01:00
Brennan Kinney 5254f7c658
fix: `check-for-changes.sh` should not fall out of sync with shared logic (#2260)
Removes duplicate logic from `check-for-changes.sh` that is used/maintained elsewhere to avoid risk of problems, as this code is already starting to diverge / rot.

---

Previously the change detection support has had code added for rebuilding config upon change detection which is the same as code run during startup scripts. Unfortunately over time this has fallen out of sync. Mostly the startup scripts would get maintenance and the contributor and reviewers may not have been aware of the duplicate code handled by `check-for-changes.sh`.

That code was starting to diverge in addition to some changes in structure (_eg: relay host logic seems interleaved here vs separated out in startup scripts_). I wanted to address this before it risks becoming a much bigger headache.

Rather than bloat `helper-functions.sh` further, I've added a `helpers/` folder extracting relevant common logic between startup scripts and `changedetector`. If you want to follow that process I've kept scoped commits to make those diffs easier. Some minor changes/improvements were added but nothing significant.

---

- chore: Extract relay host logic to new `relay.sh` helper
- chore: Extract `/etc/postfix/sasl_passwd` logic to new `sasl.sh` helper
- chore: Extract `postfix-accounts.cf` logic to new `accounts.sh` helper
- chore: Extract `/etc/aliases` logic to new `aliases.sh` helper
- chore: Extract `/etc/postfix/vhost` logic to new `postfix.sh` helper

- chore: Add inline docs for Postfix configs
> These are possibly more verbose than needed and can be reduced at a later stage.
> They are helpful during this refactor process while investigating that everything is handled correctly.

`accounts.sh`: 
- Add note regarding potential bug for bare domain setups with `/etc/postfix/vhost` and `mydestination` sharing same domain value.

`relay.sh`: 
- Remove the tabs for a single space delimiter, revised associated comment.
- Add PR reference for original `_populate_relayhost_map` implementation which has some useful details.


Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
Co-authored-by: Casper <casperklein@users.noreply.github.com>
2021-11-21 09:33:49 +13:00
Georg Lauterbach ae70142d8f
Housekeeping (#2302)
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2021-11-20 10:38:40 +01:00
Brennan Kinney 7ca056852f
tests(feat): Complete rewrite of letsencrypt tests (#2286)
* chore: Normalize container setup

Easier to grok what is different between configurations.

- Container name usage replaced with variable
- Volumes defined earlier and redeclared when relevant (only real difference is `VOLUME_LETSENCRYPT`)
- Contextual comment about the `acme.json` copy.
- Quoting `SSL_TYPE`, `SSL_DOMAIN` and `-h` values for syntax highlighting.
- Moved `-t` and `${NAME}` to separate line.
- Consistent indentation.

* chore: DRY test logic

Extracts out repeated test logic into methods

* chore: Scope configs to individual test cases (1/3)

- Preparation step for shifting out the container configs to their own scoped test cases. Split into multiple commits to ease reviewing by diffs for this change.
- Re-arrange the hostname and domain configs to match the expected order of the new test cases.
- Shuffle the hostname and domainname grouped tests into tests per container config scope.
- Collapse the `acme.json` test cases into single test case.

* chore: Scope configs to individual test cases (2/3)

- Shifts the hostname and domainname container configs into their respective scoped test cases.
- Moving the `acme.json` container config produces a less favorable diff, so is deferred to a follow-up commit.
- Test cases updated to refer to their `${CONTAINER_NAME}` var instead of the hard-coded string name.

* chore: Scope configs to individual test cases (3/3)

Final commit to shift out the container configs.

- Common vars are exported in `setup_file()` for the test cases to use without needing to repeat the declaration in each test case.
- `teardown_file()` shifts container removal at end of scoped test case.

* chore: Adapt to `common_container_setup` template

- `CONTAINER_NAME` becomes `TEST_NAME` (`common.bash` helper via `init_with_defaults`).
- `docker run ...` and related configuration is now outsourced to the `common.bash` helper, only extra args that the default template does not cover are defined in the test case.
- `TARGET_DOMAIN`establishes the domain folder name for `/etc/letsencrypt/live`.
- `_should*` methods no longer manage a `CONTAINER_NAME` arg, instead using the `TEST_NAME` global that should be valid as test is run as a sequence of test cases.
- `PRIVATE_CONFIG` and the `private_config_path ...` are now using the global `TEST_TMP_CONFIG` initialized at the start of each test case, slightly different as not locally defined/scoped like `PRIVATE_CONFIG` would be within the test case, hence the explicit choice of a different name for context.

* chore: Minor tweaks

- Test case comment descriptions.
- DRY: `docker rm -f` lines moved to `teardown()`
- Use `wait_for_service` helper instead of checking the `changedetector` script itself is running.
- There is a startup delay before the `changedetector` begins monitoring, wait until it ready event is logged.
- Added a helper to query logs for a service (useful later).
- `/bin/sh` commands reduced to `sh`.
- Change the config check to match and compare output, not number of lines returned. Provides better failure output by bats to debug against.

* chore: Add more test functions for `acme.json`

This just extracts out existing logic from the test case to functions to make the test case itself more readable/terse.

* chore: Housekeeping

No changes, just moving logic around and grouping into inline functions, with some added comments.

* chore: Switch to `example.test` certs

This also required copying the source files to match the expected letsencrypt file structure expected in the test/container usage.

* chore: Delete `test/config/letsencrypt/`

No longer necessary, using the `example.test/` certs instead.

These letsencrypt certs weren't for the domains they were used for, and of course long expired.

* chore: Housekeeping

Add more maintainer comments, rename some functions.

* tests: Expand `acme.json` extraction coverage

Finally able to add more test coverage! :)

- Two new methods to validate expected success/failure of extraction for a given FQDN.
- Added an RSA test prior to the wildcard to test a renewal simulation (just with different cert type).
- Added extra method to make sure we're detecting multiple successful change events, not just a previous logged success (false positive).

* tests: Refactor the negotiate_tls functionality

Covers all ports (except POP) and correctly tests against expected verification status with new `example.test` certs.

The `FQDN` var will be put to use in a follow-up commit.

* tests: Verify the certs contain the expected FQDNs

* chore: Extract TLS test methods into a separate helper script

Can be useful for other TLS tests to utilize.

* chore: Housekeeping

* chore: Fix test typo

There was a mismatch between the output and expected output between these two files "find key for" and "find key & cert for". Changed to "find key and/or cert for" to make the warning more clear that it's issued for either or both failure conditions.

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-11-16 16:00:16 +01:00
Brennan Kinney 584577787a
refactor: Internal HOSTNAME and DOMAINNAME configuration (#2280)
Better logical flow, handling and inline documentation.

Despite the verbosity, it's better to make this visible here for maintenance and debugging purposes than trying to dig through issue/PR or commit history for it.

* fix: Panic when HOSTNAME is misconfigured
* chore: Add more comment docs for maintainers
* tests(fix): Use `--domainname` not ENV `DOMAINNAME`

Co-authored-by: Casper <casperklein@users.noreply.github.com>
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-11-16 10:50:45 +13:00
Casper cac0647250
improve: sort environment variables (#2298) 2021-11-14 09:11:44 +13:00
Georg Lauterbach 6c1c669619
make Bash start user-patches.sh (#2295) 2021-11-13 10:19:56 +01:00
Georg Lauterbach cf4682fe5e
remove unnecessary `ls` from debug log (#2294) 2021-11-12 14:33:04 +01:00
Andreas Egli e436968655
openDMARC: remove quotation marks from setup script (#2291) 2021-11-10 12:21:26 +01:00
Brennan Kinney 917f0f6a9c
fix: Monitor for changes in supported letsencrypt locations (#2279)
Previously we only monitored for `$HOSTNAME` in `/etc/letsencrypt/live` and only for hard-coded `.pem` filenames.

This ensures we check the locations of other locations that may not match `$HOSTNAME`, which we also support. Ideally in future at least the directory to look in would be better known in advance..
2021-11-05 12:08:57 +13:00
Brennan Kinney e807631a76
refactor: acme.json extraction (#2274)
Split into scoped commits with messages if further details are needed, view those via the associated PR :)

**Commit Summary:**

**`check-for-changes.sh`**

- Prevent `SSL_DOMAIN` silently skipping when value has wildcard prefix `*.` (_at least this was known as a bugfix when originally committed in linked PR_).
- Improved inlined docs for maintainers.
- Additional logging for debugging.

**`helper-functions.sh:_extract_certs_from_acme`**:

- Fail if the input arg (_`$CERT_DOMAIN`, aka the FQDN_) provided for extraction is empty.
- Use `$CERT_DOMAIN` in place of `$HOSTNAME` and `$1` for a consistent value (_previously could mismatch, eg with `SSL_DOMAIN` defined_).
- The conditional is now only for handling extraction failure (_key or cert value is missing from extraction_).
- Log an actual warning or success (debug) based on outcome.
- Don't use `SSL_DOMAIN` with wildcard value for the `mkdir` letsencrypt directory name (_wildcard prefix `*.` is first stripped instead_).

**`acme_extract`** (_new python utility for `acme.json` handling_):

- Extracted out into a python script that can be treated as a utility in the `$PATH` like other helper scripts. It can now be used and optionally tested directly instead of via `helper-functions.sh`.
-Made compatible with Python 3, as Python 2 is EOL and no longer in newer versions of Debian.
2021-11-04 09:28:40 +13:00
Brennan Kinney bdb35dd19a
chore: Refactor `setup-stack.sh` case `SSL_TYPE=letsencrypt` (#2278)
Mostly cleans up the code and documents it better, although there are some minor fixes for handling `SSL_DOMAIN` ENV and additional logging added for spotting issues related to it in future when troubleshooting.

Commits are scoped with context messages for easing review if necessary. Overview of changes:

Traefik specific:

- Logic extracted out into it's own function.
- Conditional reworked to assist with debugging.
- `SSL_DOMAIN` must not be empty when attempting to extract.
- Added additional notes.

`SSL_TYPE=letsencrypt` case:

- Revised top note block.
- Correct handling for `SSL_DOMAIN`.
- Removed some unnecessary nesting.
- Less repetitive error message for `LETSENCRYPT_DOMAIN`.
- Added use of panics where appropriate (kept `return 1` so failures still exit functionality early).
- Improved inline docs.
2021-11-03 09:12:33 +13:00
Casper ebb081c80f
Add missing SA variables (#2283) 2021-11-02 11:51:36 +01:00
Casper b117cd1423
Improve VIRUSMAILS_DELETE_DELAY usage (#2281) 2021-11-01 22:13:14 +01:00
Casper c7dec1e330
fix(listmailuser): Don't query quota, if ENABLE_QUOTAS is not 1
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-11-01 12:09:47 +01:00
Georg Lauterbach 537247031f
fix: Make Dovecot aware of basic aliases in userdb for quota support + Use correct hash scheme in passdb configuration (#2248)
Dovecot quota support would log auth failures when Postfix validated incoming mail to accept/reject and the `check_policy_service` for `quota-status` was queried with a recipient that was an account alias.

When Dovecot is not aware of the user account, it will not be able to check a quota and inform Postfix that everything is fine, Postfix will accept the mail and send it to Dovecot, where if the quota is exceeded will result in a bounce back to the sender. This is considered "backscatter" and can be abused by spammers forging the sender address which can get your server blacklisted.

The solution is to either disable quota support `ENABLE_QUOTAS=0`, or as a workaround, add dummy accounts to Dovecot userdb for aliases in `postfix-virtual.cf` (not `postfix-aliases.cf`), these dummy accounts will map to the real user account mailbox (real users are defined in `postfix-accounts.cf`).

The workaround is naive, in that we only check for basic 1-to-1 alias mapping to real accounts. This will still be an issue for aliases that map to another alias or multiple addresses (real or alias). Unfortunately Postfix will not expand aliases until accepting mail where this would be too late.

A better solution is to proxy the `check_policy_service` from Dovecot `quota-status` that Postfix queries in `main.cf:smtpd_recipient_restrictions`, however this requires a fair amount more of additional work and still requires an implementation to recursively query aliases for nested or multiple address mappings, which can then be forwarded to the `quota-status` service configured by Dovecot in `/etc/dovecot/conf.d/90-quota.conf`.

LDAP users are unaffected as quota support is not supported/implemented with `docker-mailserver` at this time, it is always considered disabled when using LDAP.

---

Additionally Dovecot configuration for `passdb` has been fixed to use the correct password hash scheme of `SHA512-CRYPT`. 

Co-authored-by: Casper <casperklein@users.noreply.github.com>
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2021-11-01 14:20:22 +13:00
Brennan Kinney 0c8c936c74
chore: Remove invalid config in Postfix `master.cf` (#2272)
This was all introduced by the original project author early on, no explanation for it.

- None of the paths they use as `argv` values exist.
- `uucp` doesn't seem relevant to the project. No justification for it, no issues or PRs in project history or codebase.

See associated PR for further details and linked resources.
2021-11-01 14:03:56 +13:00
Brennan Kinney 79617dcc40
fix: `ONE_DIR=1` should keep correct permissions for `spool-postfix` (#2273)
GID of postfix(102) should not be set here. only GID is root(0) and postdrop(103). Ensure root(0) UID matches source location ownership too.
2021-11-01 10:23:00 +13:00
Brennan Kinney d9e8accf5f
chore: Housekeeping on the 'open-dkim' script (#2267) 2021-10-30 10:10:32 +00:00
Casper 34ba3c2a5b
Add warnings when Amavis is disabled. (#2251)
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-10-17 16:18:56 +00:00
Frugan 0cebfde414
Fixed KeyTable refile in opendkim.conf https://serverfault.com/a/861701/377751 (#2249) 2021-10-16 19:04:51 +02:00
Casper 61973f731c
Relaxed error handling (#2233) 2021-10-03 12:48:43 +00:00
Casper 5cb1815972
Disable name resolution in iptables check (#2235) 2021-10-03 12:41:35 +02:00
Casper c7e9dd2bad
function _defunc removed (#2199)
* function _defunc removed

* _shutdown is better than just notify in that cases

* PANIC_TYPE 'fail-init' introduced

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-09-23 19:49:07 +02:00
Brennan Kinney a0ee472501
docs(chore): Normalize for consistency (#2206)
"Brief" summary/overview of changes. See the PR discussion or individual commits from the PR for more details.

---

Only applies to the `docs/content/**` content (_and `setup` command_). `target/` and `test/` can be normalized at a later date.

* Normalize to `example.com`

- Domains normalized to `example.com`: `mywebserver.com`, `myserver.tld`, `domain.com`, `domain.tld`, `mydomain.net`, `my-domain.tld`, `my-domain.com`, `example.org`, `whoami.com`.
- Alternative domains normalized to `not-example.com`: `otherdomain.com`, `otherdomain.tld`, `domain2.tld`, `mybackupmx.com`, `whoareyou.org`.
- Email addresses normalized to `admin@example.com` (in `ssl.md`): `foo@bar.com`, `yourcurrentemail@gmail.com`, `email@email.com`, `admin@domain.tld`.
- Email addresses normalized to `external-account@gmail.com`: `bill@gates321boom.com`, `external@gmail.com`, `myemail@gmail.com`, `real-email-address@external-domain.com`.
- **`faq.md`:** A FAQ entry title with `sample.domain.com` changed to `subdomain.example.com`.
- **`mail-fetchmail.md`:** Config examples with FQDNs for `imap`/`pop3` used `example.com` domain for a third-party, changed to `gmail.com` as more familiar third-party/external MTA.

* Normalize config volume path

- Normalizing local config path references to `./docker-data/dms/config/`: `./config/`, `config/`, \``config`\`, `/etc/` (_volume mount src path prefix_).
- Normalize DMS volume paths to `docker-data/dms/mail-{data,state,log}`: `./mail`, `./mail-state` `./data/mail`, `./data/state`, `./data/logs`, `./data/maildata`, `./data/mailstate`, `./data/maillogs`, (_dropped/converted data volumes: `maildata`, `mailstate`_).
- Other docker images also adopt the `docker-data/{service name}/` prefix.

* `ssl.md` - Use `dms/custom-certs` where appropriate.

* Apply normalizations to README and example `docker-compose.yml`

---

Common terms, sometimes interchangeably used or now invalid depending on context: `mail`, `mail container`, `mail server`, `mail-server`, `mailserver`,`docker-mailserver`, `Docker Mailserver`.

Rough transformations applied to most matches (_conditionally, depending on context_):

- 'Docker Mailserver' => '`docker-mailserver`'
- 'mail container' => '`docker-mailserver`' (_optionally retaining ' container'_)
- 'mail server' => 'mail-server' / '`docker-mailserver`'
- 'mail-server' => '`docker-mailserver`'
- 'mailserver' => 'mail-server' / '`docker-mailserver`'

Additionally I checked `docker run` (_plus `exec`, `logs`, etc, sub-commands_) and `docker-compose` commands. Often finding usage of `mail` instead of the expected `mailserver`

Additionally changes `mailserver` hostname in k8s to `mail` to align with other non-k8s examples.

---

* drive-by revisions

Mostly minor revisions or improvements to docs that aren't related to normalization effort.
2021-09-23 11:29:37 +12:00
Casper 5b9d1f9120
Fix weird dashes (#2205) 2021-09-22 08:41:32 +02:00
Brennan Kinney f4f0e4ef61
tests: Refactored bounced spam test + Introduce common container setup template (#2198)
* fix: Spam bounced test copy/paste typo
* tests(docs): Expand inline documentation

Should assist maintainers like myself that are not yet familiar with this functionality, saving some time :)

* Refactor bounced test + Introduce initial container template

DRY'd up the test and extracted a common init pattern for other tests to adopt in future.

The test does not need to run distinct containers at once, so a common name is fine, although the `init_with_defaults()` method could be given an arg to add a suffix: `init_with_defaults "_${BATS_TEST_NUMBER}"` which could be called in `setup()` for tests that can benefit from being run in parallel.

Often it seems the containers only need the bare minimum config such as accounts provided to actually make the container happy to perform a test, so sharing a `:ro` config mount is fine, or in future this could be better addressed.

---

The test would fail if the test cases requiring smtp access ran before postfix was ready (_only a few seconds after setup scripts announce being done_). Added the wait condition for smtp, took a while to track that failure down.
2021-09-20 19:35:03 +12:00
Georg Lauterbach 3216d495cc
scripts: merge new setup.sh version for 10.2.0 again (#2189) 2021-09-19 16:47:08 +02:00
Brennan Kinney c851f5b6aa
fix: Remove `mkcert.sh` usage + `_setup_ssl` refactor. (#2196)
* chore(refactor): DRY up the `_setup_ssl` method

- `/etc/postfix/ssl` was a bit misleading in usage here. As a maintainer (of my own contribution!) I was confused why only `/etc/postfix/ssl` was referenced and not `/etc/dovecot/ssl`.
- The postfix specific path is unnecessary, dovecot was referencing it via it's config, the same can be done from postfix to a generic DMS specific config location instead.
- This location is defined and created early as `/etc/dms/tls` (with var `DMS_TLS_PATH`). All usage of `/etc/postfix/ssl` has been replaced, making it easier to grok. Several `mkdir` commands related to this have been dropped as a result.

- Likewise, a related `TMP_DMS_TLS_PATH` var provides a reference to the config volume path `/tmp/docker-mailserver` which is used for conditions on presently hard-coded paths.

- Other values that benefit from being DRY have been lifted up into vars. Definitely easier to follow now and makes some further opportunities clearer to tackle in a future refactor.

- `chmod` has been updated where appropriate. Public key/cert is acceptable to have as readable by non-root users (644). The custom type with single fullchain file was not root accessible only, but should as it contains a private key.
- That said, the security benefit can be a bit moot due to source files that were copied remain present, the user would be responsible to ensure similar permissions on their source files.

- I've not touched LetsEncrypt section as I don't have time to investigate into that yet (not familiar with that portion).

---

* chore: Remove mkcert logic and dovecot cert

- No longer serving a purpose.
- Our own TLS startup script handles a variety of cert scenarios, while the dropped code was always generating a self-signed cert and persisting an unused cert regardless with `ONE_DIR=1`.
- To avoid similar issues that DH params had with doveadm validating filepath values in the SSL config, the default dummy values match postfix pointing to "snakeoil" cert. That serves the same purpose as mkcert was covering in the image.
- Bonus, no more hassle with differing mkcert target paths for users replacing our supplied Dovecot with the latest community edition.

---

* Error handling for SSL_TYPE

- Added a panic utility to exit early when SSL_TYPE conditions are misconfigured.
- Some info text had order of key/cert occurrence swapped to be consistent with key then cert.
- Some existing comments moved and rephrased.
- Additional comments added.
- `-f` test for cert files instead of `-e` (true also for directories/devices/symlinks).
- _notify messages lifted out of conditionals so that they always output when the case is hit.
- ~~Empty SSL_TYPE collapsed into catch all panic, while it's contents is now mapped to a new 'disabled' value.~~

---

* Use sedfile + improve sed expressions + update case style

- Uses sedfile when appropriate (file change intentional, not optional match/check).
- sed expressions modified to be DRY and reduce escaping via `-r` flag (acceptable if actual text content contains no `?`,`+`,`()` or `{}` characters, [otherwise they must be escaped](https://www.gnu.org/software/sed/manual/html_node/Extended-regexps.html)).
- sed captures anything matched between the parenthesis`()` and inserts it via `\1` as part of the replacement.

- case statements adopt the `(` prefix, adopting recent shell style for consistency.

---

* Refactor SSL_TYPE=disabled

- Postfix is also disabled now.
- Included heavy inline documentation reference for maintainers.
- Dropped an obsolete postfix config option 'use_tls' on the relayhost function, it was replaced by 'security_level'.

---

* I'm a friggin' sed wizard now

- The `modern` TLS_LEVEL is the default values for the configs they modify. As such, `sedfile` outputs an "Error" which isn't an actual concern, back to regular `sed`.

- I realized that multiple edits for the same file can all be done at once via `-e` (assuming other sed options are the same for each operation), and that `g` suffix is global scope for single line match, not whole file (default as sed iterates through individual lines).

- Some postfix replacements have `smtp` and `smtpd` lines, collapsed into a single `smtpd?` instead now that I know sed better.

---

* tests(fix): Tests that require SSL/TLS to pass

- SSL_TYPE=snakeoil added as temporary workaround.

- nmap tests are being dropped. These were added about 4-5 years ago, I have since made these redundant with the `testssl.sh` tests.
- Additionally the `--link` option is deprecated and IIRC these grades were a bit misleading when I initially used nmap in my own TLS cipher suite update PRs in the past.
- The removed SSL test is already handled in mail_ssl_manual.bats

ldap test:
- Replace `--link` alias option with `--network` and alias assignment.
- Parameterized some values and added the `SSL_TYPE` to resolve the starttls test failure.

privacy test:
- Also needed `SSL_TYPE` to pass the starttls test.

`tests.bats` had another starttls test for imap:
- Workaround for now is to give the main test container `SSL_TYPE=snakeoil`.

---

* Remove the expired lets-encrypt cert

This expired in March 2021. It was originally required when first added back in 2016 as LetsEncrypt was fairly new and not as broadly accepted into OS trust stores.

No longer the case today.

---

* chore: Housekeeping

Not required for this PR branch, little bit of tidying up while working on these two test files.

- privacy test copied over content when extracted from `tests.bats` that isn't relevant.
- ldap test was not as easy to identify the source of DOVECOT_TLS. Added comment to make the prefix connection to `configomat.sh` and `.ext` files more easier to find.
- Additionally converted the two localhost FQDN to vars.

---

* Default SSL_TYPE becomes `''` (aka equivalent to desired `disabled` case)

- This is to prevent other tests from failing by hitting the panic catchall case.
- More ideal would be adjusting tests to default to `disabled`, rather than treating `disabled` as an empty / unset SSL_TYPE value.

---

* Add inline documentation for `dms_panic`

- This could later be better formatted and placed into contributor docs.

Panic with kill (shutdown) not exit (errex):
- `kill 1` from `_shutdown` will send SIGTERM signal to PID 1 (init process).
- `exit 1` within the `start-mailserver.sh` init scripts context, will just exit the initialization script leaving the container running when it shouldn't.

The two previous `_shutdown` methods can benefit from using `dms_panic` wrapper instead to standardize on panic messages.
2021-09-20 00:31:11 +12:00
Brennan Kinney 2bf24e4c08
fix: Relax openssl security level for `intermediate` TLS_LEVEL (#2193)
Although these two config lines have not changed since `debian:buster-slim` image, Dovecot seems to now be affected by it which results in rejecting cipher suites below TLS v1.2.

To continue supporting the `intermediate` TLS_LEVEL, we now need to relax the global config. Dovecot could alternatively be given a modified openssl config to only affect it's interaction with openssl.

Postfix is unaffected and continues to support TLS <1.2 cipher suites when configured to.
2021-09-16 01:28:42 +12:00
Brennan Kinney 08cd4d3371
fix: Enable DH parameters (ffdhe4096) by default (#2192)
This feature was originally introduced by the PR: https://github.com/docker-mailserver/docker-mailserver/pull/1463

- Assign default DH params to use via Dockerfile build instead of copy and update at runtime.
- Parameterized service names and paths.
- Refactor postfix and dovecot dh methods to wrap shared dh logic
- I don't see any value in checking the alternative service for dh params file to copy over, so that's now dropped too.
- Another conditional check is dropped and the default fallback message for existing DH params file is no longer relevant.
- Improved the remaining `_notify` messages. Collapsing the warning into a single logged message also seemed relevant.
- There is no apparent need for special handling with `ONE_DIR=1`. Dropped it.

- Refactor DH params  tests
- Combine custom and default DH param tests into single test file
- docs: Add instructions to use custom DH params

There is no official documented support for custom DH parameters. As no guarantee is provided, this is considered an internal change, not a breaking one.
2021-09-15 20:28:04 +12:00
Casper 54ee1e7567
Fix delmailuser error handling (#2181)
* Update delmailuser

* it's ok, when 'sed -i' leaves a file unchanged

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-09-14 14:07:29 +02:00
Nathan Pierce be35d9bef1
Lock file create and remove improvements (#2183)
* changed the locking function to better support multiple servers running at once and sharing the same config

* helper function testing now runs inside of container

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2021-09-13 20:09:01 +12:00
Georg Lauterbach c7e4981945
Move setup process via script into container (#2174)
Decoupling setup process from `setup.sh` script by introducing a setup script _inside_ the container that coordinates the setup process.

**This is not a breaking change**. This way, we do not have to keep track of versions of `setup.sh`.

This change brings the additional benefit for Kubernetes users to be able to make use of `setup` now, without the need for `setup.sh`.

---

* move setup process into container; setup.sh versioning not needed anymore

* add tilde functionality to docs

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
Co-authored-by: Casper <casperklein@users.noreply.github.com>
2021-09-12 11:29:02 +12:00
Nathan Pierce c267d8a990
HOSTNAME and DOMAINNAME setting improvements (#2175)
Centralize the collection of the HOSTNAME and DOMAINAME so that it's predictable and uniform across the various scripts (using the helper). Ensure it supports the various configurations users can have (both subdomain and without subdomain, override and no override).

---

* using _obtain_hostname_and_domainname helper + covers when not a subdomain
doc: OVERRIDE_HOSTNAME takes priority

* added tests for non-subdomain hostname + further improvements

* moved SRS DOMAINANME tests into hostname test file + Allowing DOMAINNAME ENV to override what would be automatically set

---

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-09-12 02:20:16 +12:00
Georg Lauterbach 061ecf6365
Introduce issue forms and update debug output for forms (#2160)
* chore(issue forms): introduce issue forms and update debug output

* update links to our code of conduct

* added double-check mechanism

* Update .github/ISSUE_TEMPLATE/bug_report_form.yml

Co-authored-by: William Desportes <williamdes@wdes.fr>
Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com>
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
Co-authored-by: Casper <casperklein@users.noreply.github.com>
2021-09-11 10:49:39 +12:00
Daniël van den Berg 00c8a7b07f
Update delmailuser to allow mailboxes without TLD (#2172) 2021-09-09 08:57:08 +02:00
Nathan Pierce 0da66ccb34
setup.sh: docker_container first, then fall back to docker_image (#2134)
* docker_container first, then fall back to docker_image
+ test changes to support
+ test change to wait for smtp port to fix flakey tests since https://github.com/docker-mailserver/docker-mailserver/pull/2104

* quick fix

* Update setup.sh

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
Co-authored-by: Casper <casperklein@users.noreply.github.com>
2021-09-06 10:13:12 +00:00
Georg Lauterbach 317f3e41c2
Update F2B wrapper to show possible errors with IPTables (#2170) 2021-09-06 11:39:50 +02:00
Casper e89ea3110f
sed wrapper (#2158)
* sed wrapper 'sedfile' added

* formatting

* sed --> sedfile

* typo

* fix lint

* debug

* fixme

* mkcert fix

* style adjusted

* Update Dockerfile
2021-09-06 10:07:02 +12:00
Casper 6336c0b256
Change default value of ONE_DIR (#2148)
* ONE_DIR=1

* Update Dockerfile

* Update start-mailserver.sh

* Update tests.bats

* Update tests.bats

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-08-31 13:50:56 +02:00
Nathan Pierce dff7e428c0 Revert "check-for-changes: performance improvements + wait for settle (#2104)"
This reverts commit 232d463b81.
2021-08-28 19:16:34 -04:00
Nathan Pierce f2ac78d154
reverted stopwaitsecs for postfix (#2137) 2021-08-17 15:39:30 +02:00
Nathan Pierce 232d463b81
check-for-changes: performance improvements + wait for settle (#2104) 2021-08-16 09:21:29 +02:00
William Desportes 3a38b23a1a
Improve fail2ban docs and fix a typo (#2126)
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-08-13 10:30:39 +02:00
William Desportes 392ee076ec
Fix #2122 - only chmod when needed (#2127) 2021-08-13 00:09:44 +02:00
Andrew Low 0e9c9889ff
Add logwatch maillog.conf file to support /var/log/mail/ (#2112)
* Add logwatch maillog.conf file to support /var/log/mail/
* Simpliied after reviewing logwatch doc

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-08-11 11:31:00 +02:00
hnws 630e083c9a
docs: Add example for customizing IMAP folders (#2045)
* docs: Add example for customizing IMAP folders (mailboxes)

* chore: Update `15-mailboxes.conf` to sync with upstream

This config has not been updated since 2016 (ignoring the Junk autosubscribe addition).

Synced to upstream equivalent at https://github.com/dovecot/core/blob/master/doc/example-config/conf.d/15-mailboxes.conf

Retains the `Archive` example definition from this PR and prior `auto = subscribe` additions.

---

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2021-06-23 10:28:43 +12:00
Casper 7293e3c9e8
Check if CONTAINER_IP could be determined (#2046)
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-06-19 22:24:06 +02:00
Casper 4822709000
do not delete supervisord.pid (#2044) 2021-06-19 14:01:38 +02:00
Nathan Pierce 5becce8064
chore(scripts): Removing flock so NFS works (#1980)
Co-authored-by: Casper <casperklein@users.noreply.github.com>
Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
2021-06-15 14:03:41 +02:00
Georg Lauterbach e7b88d865b
cleaned up >/dev/nulls in Dockerfile and replaced em dashes with normal dashes (#2024) 2021-06-08 13:20:20 +12:00
Nathan Pierce 543bd8b16b
MacOS linting & testing support + docs (#2001) 2021-06-07 14:58:34 +02:00
Georg Lauterbach abdf681d02
chore(ci): Linting Improved (#2000) 2021-06-01 18:12:17 +02:00
Frederic Werner a0f4a37512
v10.0.0 release (#1978)
* chore: prepare v10 release

* chore: bump version to v10.0.0

* chore: bump version to v10.0.0

* chore: add changelog for v10.0.0

* Fail2ban compatibility/downgrade info added

* chore: add PR and PR links

* fix a dot in the README

* chore: add pr 1996

* chore: add pr 1921 and 1989

* Revert "chore: add pr 1996"

This reverts commit 58a8ba4b44.

* chore: add grace_period pr reference

* remove :stable and other deprecated stuff

* corrected linting and removed generate ssl bin

* updated CHANGELOG

* fix: list of prs

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>

* fix: list of prs

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>

* partial revert of dc8f49de54

* chore: add pr 2021

Co-authored-by: Casper <casperklein@users.noreply.github.com>
Co-authored-by: Georg Lauterbach <44545919+aendeavor@users.noreply.github.com>
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2021-06-01 12:17:14 +02:00
Moritz Marquardt 66bc157c1d
fix!: Allow protocol in SASLAUTHD_LDAP_SERVER & adjust SASLAUTHD_LDAP_ default values (#1989)
* fix: make sure the SASLAUTHD_LDAP_HOST/PROTO logic makes sense and use LDAP_SERVER_HOST as a fallback (#1983)

* chore(docs): document changes to LDAP/SASLAUTHD as of #1983

* fix!: apply default value modifications suggested in #1983

https://github.com/docker-mailserver/docker-mailserver/issues/1983#issuecomment-844848224

* chore(test): Test SASLAUTHD_LDAP_SERVER with protocol and ..._SSL=0, as well as with default bind credentials

Note that there are currently no regression tests for this as there's only one setup_file, so that would require big changes to the testing methodology.

* refactor!: completely remove SASLAUTHD_LDAP_SSL and SASLAUTHD_LDAP_PROTO

Co-authored-by: Georg Lauterbach <44545919+aendeavor@users.noreply.github.com>
Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com>
2021-05-22 22:52:56 +02:00
Casper bab0277723
Update check (#1951)
* mail binary

* initial work

* make env vars available

* typo

* some fixes

* make script ugly, to satisfy linter..

* mailserver.env updated

* Version to welcome message added

* remove VERSION file references

* VERSION --> DMS_VERSION

* fetch remote version

* variable usage

* Quoting added

* edge test & docu

* dash removed

* subject changed

* re-add VERSION

* VERSION added

* new file:   VERSION

* rewrite

* unnecessary additions from fail2ban PR removed

* UPDATE_CHECK_INTERVAL added

* syntax check & _log function

* comment added

* final commit
2021-05-19 21:18:06 +02:00
Casper 225e21edb7
Add version variable (#1976) 2021-05-17 14:54:43 +02:00
Georg Lauterbach 04e98dc49f
introduce variable to control Amavis' loglevel (#1947) 2021-05-06 23:51:45 +02:00
Casper ba37ed115d
Add supervisor stop grace period (#1945) 2021-05-06 19:04:24 +02:00
Moritz Marquardt 94b5ac49c1
fix!: use dovecot's LDAP uris option instead of hosts (#1901)
* Use dovecot's LDAP uris option instead of hosts (fixes #1510)

* Clean up variables & environment documentation for #1901

Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com>
Co-authored-by: Georg Lauterbach <44545919+aendeavor@users.noreply.github.com>
2021-04-19 09:02:03 +02:00
Georg Lauterbach 8313d9753b
Adjusted documentation for service name and Traefik certificate issuance (#1918)
Co-authored-by: Casper <casperklein@users.noreply.github.com>
2021-04-18 15:21:08 +02:00
Casper f7836c8b1a
Fail2Ban block behaviour (#1914)
* new default: block IP on all ports

* introduce FAIL2BAN_BLOCKTYPE

* fix test

* tests added

* test added

* test blocktype drop

* merged two tests
2021-04-18 12:55:43 +02:00
Moritz Marquardt 271d94a37e
Add LDAP_QUERY_FILTER_SENDERS setting for spoof protection with LDAP (#1902) 2021-04-17 22:40:19 +02:00
Casper dea9bca900
Enhance setup.sh email list (#1898)
* add quota and aliases to output

* shellcheck fixes

* fix test

Co-authored-by: Georg Lauterbach <44545919+aendeavor@users.noreply.github.com>
2021-04-12 15:18:15 +02:00
Casper ba0f9199b7
fail2ban cleanup (#1895) 2021-04-11 15:33:39 +00:00
Georg Lauterbach bc5bc51c02
Partial revert #1864 (#1877) 2021-03-31 14:45:16 +00:00
Casper 22321c308c
fix SpamAssassin spelling/typos (#1869) 2021-03-28 22:07:52 +02:00
Casper dd0b399f33
feat: Introduce ENABLE_AMAVIS env (#1866)
* Introduce ENABLE_AMAVIS env

* missing 'fi' added

* documentation added

* add condition for amavis fix function

* Fix spelling

Co-authored-by: William Desportes <williamdes@wdes.fr>

* Fix spelling

Co-authored-by: William Desportes <williamdes@wdes.fr>

Co-authored-by: William Desportes <williamdes@wdes.fr>
Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com>
2021-03-28 15:37:48 +02:00
Georg Lauterbach 4afebda64d
fix for #1808 (#1864) 2021-03-24 20:42:00 +01:00
Stephan c214cba981
Make directory with parent directories (#1862) 2021-03-23 13:50:29 +00:00
Georg Lauterbach 4ba2315058
corrected dkim keysize argument in help pages, closing #1845 2021-03-10 11:21:24 +01:00
Georg Lauterbach 0d9fb096b7
adjusting _seup_supervisor to not restart when wrong log-level given 2021-02-25 10:57:20 +01:00
Georg Lauterbach 0fa5c1ef9d
revamping the notify function (#1836) 2021-02-24 17:28:59 +01:00
Georg Lauterbach 1ef66fd5c5
first (may-be) fixes for v9.0.0 startup problems (#1835)
* first (may-be) fixes for v9.0.0 startup problems
* adjust grep showing an error when it shouldn't
2021-02-24 10:12:20 +01:00
Georg Lauterbach c881facbd2
start-mailserver.sh split (#1820)
* splitting start-mailserver.sh

* refactoring part 2

* refactored setup-stack.sh
* stzarted adjusting target/bin/*.sh to use new usage format

* corrected lowercase-uppercase test error

* better handling of .bashrc variable export

* linting tests and fix for default assignements

* last stylistic changes and rebase
2021-02-23 20:03:01 +01:00
landergate a8d7d1802b
Fixed REPORT_RECIPIENT=1 behavior
Condition never matched, so reports were sent to 1@ instead of postmaster@
2021-02-23 00:17:01 +03:00
polarathene 867cac6707 chore: Consistent `sed` substitution delimiter `+`
This additionally converts `+` delimited to `|` standardizing it throughout the file.
2021-02-22 11:59:59 +13:00
polarathene 75aefa3bdf chore: Consistent `sed` substitution delimiter
My `~` substitution and any usage of `/` within `start-mailserver.sh` has been replaced with the `|` delimiter instead as advised for matching style guide preference. Note there are other `sed` substitution delimiters still in use such as `+`.

Also added warning for empty `SSL_TYPE` ENV var that may result in an internal state config persist bug when changing `SSL_TYPE` depending on how a container is restarted.
2021-02-22 11:55:10 +13:00
Brennan Kinney d02ebc922c
Dual certificate support (eg ECDSA with RSA fallback) (#1801)
* feat: Change Postfix smtpd_tls key and cert files to chain_files

Since Postfix 3.4, `smtpd_tls_cert_file` and `smtpd_tls_key_file` have been deprecated in favor of `smtpd_tls_chain_files` which supports a list of values where a single or sequence of file paths provide a private key followed by it's certificate chain.

* feat: Dual certificate support

`smtpd_tls_chain_files` allows for multiple key+cert bundles so that you can provide different key types, such as ECDSA and RSA.

To maintain compatibility with the current CERT/KEY ENV vars only a 2nd certificate is supported.

Since Dovecot 2.2.31 a related feature is also available, but it is limited to only providing one alternative certificate via separate cert and key settings.

---

This feature enables support for multiple certificates, eg for serving modern ECDSA certs with RSA as fallback.

* chore: Refactor variable names to meet style guide

Improved some comments too.

* chore: Have function definitions respect style guide

* chore: Minor edits to comments

* chore: Expand on comments for maintenance, alert of insecure config

When `SSL_TYPE` isn't properly setup, we're still offering SSL connections but not warning in logs about the insecurity of such, or why a misconfiguration may have occurred.

This commit more clearly communicates to the user that they should look into the issue before considering deploying to production.

The `TODO` comments communicate to any future maintainer to consider treating these improper configs as disabling TLS instead.

* fix: Use `snakeoil` cert

I mistakenly thought this was placeholder text, which broke some tests. This adds the two files in the correct order (private key followed by cert/chain), to fix that issue.

* fix: Disable alt cert for Dovecot if necessary

Certain scenarios may persist state of previously configured alt cert via ENV vars that are removed from a future run. If the config is not reset to original immutable state, this will correctly disable the config from using alt cert unintentionally.

* fix: Satisfy ShellCheck lint

By switching from string var to array / list expansion, this better stores the extracted result and applies it in a manner that ShellCheck linting approves, removing the need to disable the rule.

* feat: Support dual cert test

Few tweaks to the test script allows re-purposing it for covering dual cert support as well.

* chore: Rearranged cert and key lines

A little reorganization, mostly placing private key ahead of related cert lines.

* chore: Refactor `_set_certificate`

This should make the parameters a little less confusing.

Previously was 3 parameters, but the Postfix parameter (1st) may look like two variables if you don't pay attention to the surrounding quotes; while the Dovecot parameters (2nd + 3rd) would have an opposing order. There was also a variant where the `FULLKEYCHAIN` var was passed in three times.

Now it's two params, with the 2nd param as an optional one. If the 2nd param is provided, then the two params are in the order of private key then certificate, otherwise if only a single parameter it's a single PEM file with the full cert chain and private key bundled.

This avoids implying that Postfix and Dovecot might use different files.

* chore: Document current state of `SSL_TYPE` logic better

Inlined for the benefit of anyone else maintaining this section if I'm unable to address the concerns within my own time.

* docs: ENV vars

`TLS_LEVEL=old` isn't in the codebase anymore, not likely to be relevant to retain.

No point in documenting what is considered invalid / unsupported config value in the first place for `SSL_TYPE`.

`SSL_TYPE=manual` was missing documentation for both related file path ENV vars, they've been added along with their alt fallback variants.

* chore: Update Dovecot LMTP SSL test config

Not sure how relevant this is, the file isn't complete sync with the main dovecot `10-ssl.conf` config, adding the support just in case.

* chore: Rename `FULLKEYCHAIN` to avoid confusion

There doesn't appear to be a standardized name for this type of file bundle, and `keychain` may be misleading (fullkeychain often provides macOS keychain  results on search engines).

Opting for a more explicit `KEY_WITH_FULLCHAIN` name instead.

* fix: Invalid var name

`_set_certificate` refactor commit accidentally changed a var name and committed that breaking the dual cert support (thanks tests!).

* test: Refactor `mail_ssl_manual.bats`

Proper test return values instead of `wc -l` based checking.

Tests with dual cert support active, tests that feature (to better detect failure case.

Third test case was unable to verify new self-signed certificate, added new certs signed with self-signed root CA.

Adjusted openssl `CApath` parameter to use `CAfile` instead as `letsencrypt` cert was replaced thus CA cert is missing from the system trust store.

* test: Properly check for files in `mail_ssl_manual.bats`

Fixes lint error.

Also realized I was accidentally asserting a file exists in the test environment, not within the container.

Resolved that and also added an additional test case to ensure the ENV var files are valid when passed in, in the event a change misconfigures them and that the issue is identified earlier.

* chore: Apply PR review feedback

Better format some strings that had mixed quotes when they weren't necessary.

Additionally DRYed up the config path for Postfix and Dovecot within the `_setup_ssl` method.

Co-authored-by: Georg Lauterbach <infrastructure@itbsd.com>
2021-02-21 23:43:41 +01:00
Astro a7ecb0ea8b
feat/enable custom dkim selector (#1811)
* let dkim generator accept selector as parameter

* test dkim-generator with selector parameter

* fix: correct name of domain argument in usage

* fix: adapt command to new syntax

* tests: use different quotes

* tests: use different quotes

* tests: remove domains that were never added

* style: change test name

* refactor: dkim setup

* style: remove trailing whitespace

* tests: remove test of removed dummy file

Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com>
2021-02-21 22:05:35 +01:00
Frederic Werner 6e6b5be1ee
chore: change argument name and parameter shift 2021-02-18 19:20:48 +01:00
Georg Lauterbach f3f38db0f9
adjust test to use new script output from openDKIM 2021-02-18 13:11:45 +01:00
Georg Lauterbach 1005bb3b09
Provide complete refactoring of openDKIM script (#1812)
* provide complete refactoring of openDKIM usage and tests

* fix leftover linting errors

* correct defualt key size and README usage

* provide independent order for arguments

* added `config` and adjusted usage information

* fixing shift in setup.sh

* adjust usage information to use new style and rename script

* use updated argument keysize instead of size
2021-02-18 10:29:34 +01:00
Brennan Kinney 432f96b3a6
Use best practice cipher suites for 2021 (#1802)
Update cipherlist to sync with OWASP B and Mozilla Intermediate
2021-02-18 10:24:34 +01:00
Georg Lauterbach cb2ecacd56
Rewrite of `delmailuser` to enable proper account deletion (again) (#1813)
* rewrite to fix docker-mailserver#1808 (again)
* exiting script correctly now
* over-engineered usage information
the usage is now displayed like a man page and the paging mechanism (i.e. the display of the information) is borrowed from batcat
* fix typos
2021-02-17 12:12:51 +01:00
Georg Lauterbach ddf2bc2567
exchanging errex with echo 2021-02-14 22:09:33 +01:00
Georg Lauterbach 227719ee0d
patching the delmailuser script to function properly (+ refactoring) 2021-02-14 21:19:58 +01:00
Georg Lauterbach 11eb174121
follow up style enhancement 2021-02-09 12:12:36 +01:00
Georg Lauterbach 5338433b78
Merge pull request #1798 from aendeavor/fix#1796
Enhancement for function _setup_postfix_sasl fixing #1796 & More
2021-02-08 11:38:05 +01:00
Ask Bjørn Hansen 4a3735bced
Support extra user_attributes in accounts configuration (#1792)
This allows you to add for example

    |userdb_mail=mbox:~/mail:INBOX=~/inbox

 to the end of an account to have a different mailbox configuration.
2021-02-07 19:02:09 +01:00
Georg Lauterbach c6c7b8522d
enhancement for function _setup_postfix_sasl fixing #1796 & more 2021-02-07 18:11:33 +01:00
Georg Lauterbach 6c575adae2
correct application of the new SUPERVISOR_LOGLEVEL variable (#1787)
* correct application of the new SUPERVISOR_LOGLEVEL variable
* correcting default log level adjustment
* replacing grep &>/dev/null with grep -q
2021-02-01 18:39:05 +01:00
Georg Lauterbach 931eab0541
removing bl.spamcop.net for 8.0.1 2021-01-31 16:05:05 +01:00
Georg Lauterbach cc7138e28f
minor adjustments before release 8.0.0 2021-01-27 18:42:39 +01:00
William Desportes 4616894fbf
Allow manual domains for dkim generator (#1753)
* Allow manual domains for dkim generator

* Document the DKIM manual mode

* Remove unnecessary quotes

* updating default value usage and "" in [[ ]]

* Change parameter expansion

* Add test for manual dkim domains

* Remove obsolete script

* Add manual dkim mode to usage

* Move manual dkim guide into quickstart section

* Cover case that key for domain already exists

* Set default dkim key size to 4096

Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com>
Co-authored-by: Georg Lauterbach <44545919+aendeavor@users.noreply.github.com>
2021-01-27 14:09:24 +01:00
Casper 23984e3f07
Missing variables added (#1771)
Co-authored-by: casperklein <casperklein@users.noreply.github.com>
2021-01-27 13:35:55 +01:00
Georg Lauterbach fd030644bf
Merge pull request #1770 from casperklein/fix-1769 2021-01-26 13:13:23 +01:00
casperklein 1bda61580d export prefixed to variable assignment 2021-01-26 12:20:35 +01:00
casperklein 4bda0cf1e0 fix wrong default value 2021-01-26 00:09:58 +01:00
casperklein ce86ee485f add missing quotes 2021-01-26 00:08:42 +01:00
Frederic Werner 11bbda4adf
Strip all ANSI escape sequences from child log files
Closes #1768 and sadly partly reverts #1758
2021-01-25 21:54:20 +01:00
Casper cb1e6d579e
Typo fixed 2021-01-23 19:10:15 +01:00
Georg Lauterbach 324ee8eb85
Improve logging significantly – color is back! (#1758)
* improve logging significantly
* now defaulting to warn
* final adjustments
* correcting not-escaped $ in sed
2021-01-22 10:03:31 +01:00
Georg Lauterbach e40c2593cc
FIX: Postfix configuration in `start-mailserver.sh` for regex (#1754)
* fixes tomav#1437
2021-01-19 12:31:45 +01:00
Georg Lauterbach 221d4ce187
adjusting links & misc 2021-01-19 09:27:01 +01:00
brainkiller 061fe12aa7
Solve Fetchmail imap idle issue (#10)
* Migrate PR#1730 from tomav/docker-mailserver repo to new
docker-mailserver/docker-mailserver repo
* Resolved review comments
* Moved counter increment to have consistency between fetchmail process
and fetchmail config files
* Added tests for new fetchmail option

Co-authored-by: Georg Lauterbach <44545919+aendeavor@users.noreply.github.com>
2021-01-17 10:39:09 +01:00
Georg Lauterbach 189e5376cc
Final Migration Step (#6)
* first migration steps
  * altered issue templates
  * altered README
  * removed .travis.yml
* adjusting registry & repository, Dockerfile and compose.env
* Close stale issues automatically
* Integrated CI with Github Actions (#3)
* feat: integrated ci with github actions
* fix: use secrets for docker org and update image
* docs: clarify why we use -t if no tty exists
* fix: correct remaining references to old repo
chore: prettier automatically updated markdown as well
* fix: hardcode docker org
* change testing image to just testing
* ci: add armv7 as a supported platform
* finished migration steps
* corrected linting in build-push action
* corrected linting in build-push action (2)
* minor preps for PR
* correcting push on pull request and minor details
* adjusted workflows to adhere closer to @wernerfred's diagram
* minor patches
* adjusting Dockerfile's installation of base packages
* adjusting schedule for stale issue action
* reverting license text
* improving CONTRIBUTING.md PR text
* Update CONTRIBUTING.md
* a bigger patch at the end
  * moved all scripts into one directory under target/scripts/
  * moved the quota-warning.sh script into target/scripts/ and removed empty directory /target/dovecot/scripts
  * minor fixes here and there
  * adjusted workflows for use a fully qualified name (i.e. docker.io/...)
  * improved on the Dockerfile layer count
  * corrected local tests - now they (actually) work (fine)!
  * corrected start-mailserver.sh to make use of defaults consistently
  * removed very old, deprecated variables (actually only one)
* various smaller improvements in the end
* last commit before merging #6
* rearranging variables to use alphabetic order

Co-authored-by: casperklein <casperklein@users.noreply.github.com>
Co-authored-by: Nick Pappas <radicand@users.noreply.github.com>
Co-authored-by: William Desportes <williamdes@wdes.fr>
2021-01-16 10:16:05 +01:00
William Desportes 7765d4a6b3
Fix shebangs 2021-01-02 14:49:35 +01:00
Georg Lauterbach e11f4f609a
Merge pull request #1705 from gmasse/new-1697
Add purge cron job for Dovecot dbox format
2020-12-18 23:00:36 +01:00
Germain Masse d400417d0e Add purge cron job for dbox 2020-12-17 20:35:06 +01:00
Georg Lauterbach d9e4b89415
Merge pull request #1703 from BrandonSchmitt/acme-fixes
Small fixes for extracting certs from the acme.json file
2020-12-11 12:53:04 +01:00
Brandon Schmitt ad4d4cc794
Refactor bash [[ ... ]] && ... || ... into if then else 2020-12-11 04:51:53 +01:00
William Desportes e58020029e
Add more sasl LDAP config options
- SASLAUTHD_LDAP_PASSWORD_ATTR => ldap_password_attr
- SASLAUTHD_LDAP_AUTH_METHOD => ldap_auth_method
- SASLAUTHD_LDAP_MECH => ldap_mech
2020-12-08 15:30:55 +01:00
William Desportes 17962c243a
Implement more sasl config options
Follow up of: https://github.com/tomav/docker-mailserver/pull/980
Ref: https://github.com/tomav/docker-mailserver/issues/1704
2020-12-08 15:07:22 +01:00
Brandon Schmitt c020cc88a1
Use the environment var SSL_DOMAIN while extracting certs from the acme.json during start-up
Signed-off-by: Brandon Schmitt <Brandon.Schmitt@live.de>
2020-12-06 20:36:22 +01:00
Brandon Schmitt 6251f898ea
Fix error in python script extracting certs from the acme.json file if there are sections with null values as certs
Signed-off-by: Brandon Schmitt <Brandon.Schmitt@live.de>
2020-12-06 20:30:20 +01:00
Aleksey Drozdov cc014d5b4b added additional pem file for _monitored_files_checksums 2020-11-16 15:49:35 +01:00
Georg Lauterbach 3780783145
Housekeeping (#1682)
Housekeeping
2020-11-07 09:56:03 +01:00
Casper ab45ae5504
Change default logrotate settings for /var/mail/maillog (#1667)
Change default logrotate settings for /var/mail/maillog

See also: https://github.com/tomav/docker-mailserver/issues/1666
2020-11-07 00:54:50 +01:00
Georg Lauterbach ed7106b04d
housekeeping 2020-11-06 14:04:23 +01:00
Georg Lauterbach dd5c0b003a
removing debug trace 2020-11-05 12:40:24 +01:00
Georg Lauterbach 5365e7f0f8
fixes #1677 2020-11-05 11:41:18 +01:00
Georg Lauterbach f0105f6d47
Merge pull request #1613 from martin-schulze-vireso/feature/extract_even_more_tests 2020-10-28 11:16:15 +01:00
Charles Harris 451bbfdf40
silence errorneous output when not generating reports (#1657)
* silence errorneous output when not generating reports
* remove incorrect variable assignment
* change error messages and logic when reports turned off
* changing warn -> inf

Co-authored-by: Charles Harris
Co-authored-by: Georg Lauterbach
2020-10-21 19:45:47 +02:00
Georg Lauterbach da8171388f
Complete Refactor for `target/bin` (#1654)
* documentation and script updates trying to fix #1647
* preparations for refactoring target/bin/
* complete refactor for target/bin/
* changing script output slightly
* outsourcing functions in `bin-helper.sh`
* re-wrote linting to allow for proper shellcheck -x execution
* show explanation for shellcheck ignore
* adding some more information
2020-10-21 18:16:32 +02:00
Georg Lauterbach 0ada57d87c
Documentation and Script Updates trying to fix #1647 (#1653)
* documentation and script updates trying to fix #1647
* re-trigger tests
* removing unnecessary rm statements
* re-trigger tests
2020-10-21 16:00:35 +02:00
Martin Schulze 1bd1fd3b32 Merge remote-tracking branch 'tvial/master' into feature/extract_even_more_tests 2020-10-20 13:19:15 +02:00
Georg Lauterbach d5543b21c4
Correction for LINE variable 2020-10-19 16:29:25 +02:00
Georg Lauterbach 6bff929b13
Merge pull request #1 from martin-schulze-vireso/feature/extract_even_more_tests
Feature/extract even more tests
2020-10-18 15:25:50 +02:00
Casper 90778de19d
Quotes removed to have a uniform style 2020-10-17 22:17:59 +02:00
Martin Schulze c46edee8f9 Mark the end of restarts due to changes by moving the checksum file 2020-10-17 02:04:30 +02:00
Georg Lauterbach 94c2a68bd5
Updated submodule target/docker-configomat 2020-10-11 19:41:53 +02:00
Georg Lauterbach 916ef571b9
Miscellaneous cleanup / housekeeping (#1641) 2020-10-06 14:45:55 +02:00
Georg Lauterbach 177d24feab
streamlined all scripts (now completely adhering to the contributing guidelines) 2020-10-02 15:45:57 +02:00
Sergey Nazaryev 84dbf4a7b4
Merge pull request #1634 from 3ap/master
fix: use self-signed cert for dovecot
2020-10-01 22:32:15 +02:00
Georg Lauterbach 1d18cb81fb
possible fix for tomav#1383 2020-09-28 11:42:50 +02:00
Georg Lauterbach 8e8671bb42
added option to use non-default network-interface, resolves #1227 (#1621)
* added option to use non-default network-interface (#1227)
* minor (stylistic) changes
* properly working with Bash arrays for CONTAINER_NETWORKS
* cleanup to trigger rebuild
* added CODE_OF_CONDUCT to trigger rebuild
2020-09-26 15:11:52 +02:00
Georg Lauterbach a0791ef457
formatting files according to standard (#1619)
* added EditorConfig linting
* adding `eclint` as Travis script target
* re-adjusted .pem files to have a newline
2020-09-24 14:54:21 +02:00
Casper 9f7414d95f
remove unnecessary use of `cat` (#1616) 2020-09-23 21:53:07 +02:00
Georg Lauterbach 566eaa0e13
complete refactoring for `start-mailserver.sh` (#1605)
* completely refactored `start-mailserver.sh`
* added braces; correctly formatted tabs / spaces
*  included `start-mailserver` into shellcheck checks
* cleanup
* removed unnecessary shellcheck comments adding braces and "" where necessary
* corrected some mistakes in CONTRIBUTING
* Makefile now uses correct shellcheck
2020-09-23 10:21:37 +02:00
Georg Lauterbach 77520bf96f
adjusted coding style guidelines; added table of contents 2020-09-09 17:19:48 +02:00
Georg Lauterbach 323303431a
fixed shellcheck version 2020-09-08 19:49:19 +02:00
Georg Lauterbach f7ca406ec9
fixing #1602; variable-brace-policy changed; 2020-09-06 12:27:40 +02:00
Georg Lauterbach 67e1e586c7
coherent renaming of functions 2020-09-05 16:53:36 +02:00
Georg Lauterbach bf679a5504
changes from tomav#1599 without `start-mailserver.sh`
included all changes from the work on refactoring all scripts, but excluded one big script to make merging easier; replaced mapfile with read
2020-09-05 16:19:12 +02:00
mwnx 42352a3259 Update relayhost_map with virtual accounts too
Previously, only postfix-relaymap.cf and postfix-accounts.cf would be
used to populate the relayhost_map file.

Now, also use postfix-virtual.cf when present. To me, there is nothing
absurd about sending mail "From:" a virtual account (or more
specifically its domain) so it makes sense that when a $RELAY_HOST is
defined it should be used for virtual accounts as well.
2020-08-28 15:03:51 +02:00
mwnx 1286a1266b Fix/refactor relayhost_map update when dynamically adding account
check-for-changes.sh did not have a special case to handle lines in
postfix-relaymap.cf consisting of only a domain (indicating that said
domain should never be relayed). This case is handled by
start-mailserver.sh so when such a line existed, things would work well
until a config file update was detected by check-for-changes.sh. After
that, the generated relayhost_map file would be corrupted.

Fixed by factoring a 'populate_relayhost_map' function out of
start-mailserver.sh and into helper_functions.sh and reusing it in
check-for-changes.sh.

Note: There are certainly quite a few more pieces of code that could be
refactored in a similar fashion.

Note2: check-for-changes.sh would previously never update the
relayhost_map file when $ENABLE_LDAP was set to 1. I don't think this
was intended —there is after all no such condition in
start-mailserver.sh— and so this condition no longer applies.
2020-08-28 15:03:51 +02:00
mwnx 2a70f33a4b Fix checksum race condition in check-for-changes.sh
If a change to one of the tracked files happened soon after (<1 second?)
a previously detected change, it could end up going undetected. In
particular, this could cause integration tests to fail (see next
commits).

Fixed by computing the new checksum file _before_ checking for changes.
2020-08-28 14:57:43 +02:00
Erik Wramner 26cc0c49ca
Merge pull request #1573 from casperklein/patch-2
addalias: check if two arguments are given
2020-07-22 16:13:51 +02:00
Martin Wepner 821d88e93a add break; remove empty print 2020-07-20 11:28:23 +02:00
Martin Wepner 6bd1fb568e fix: extractCertsFromAcmeJson fails if "sans" not in Certificates.domain.main 2020-07-19 23:57:16 +02:00
Casper 398b1dd554
Merge pull request #2 from casperklein/patch-1
Small change to error message
2020-07-19 21:33:41 +02:00
Casper 2ffb0de1db
Small change to error message 2020-07-19 21:33:06 +02:00
Casper 79f6c88653
Merge pull request #1 from casperklein/patch-3
More detailed error message
2020-07-19 21:26:36 +02:00
Casper 11ab4a84a9
More detailed error message 2020-07-19 21:23:59 +02:00
Casper 7c0998f7fa
Check if second argument is given 2020-07-19 21:21:01 +02:00
Erik Wramner f206ad7ee1
Merge pull request #1553 from MichaelSp/letsencrypt-traefik-acme-json
Letsencrypt traefik v2 acme json
2020-07-16 07:49:04 +02:00
guardiande 5c5c8eb814
Revert dummy change 2020-07-15 09:39:59 +02:00
guardiande 7189d4c63f
Dummy change to trigger travis 2020-07-15 09:12:14 +02:00
guardiande 76d3f7643a
Fix sasl_password generation to allow passwords containing hashes 2020-07-15 08:26:25 +02:00
Michael Sprauer d61a8cd9c0 letsencrypt & traefik wildcard support
set SSL_DOMAIN=*.example.com to extract a wildcard certificate from traefiks acme.json store
2020-07-13 22:58:17 +02:00
Michael Sprauer 3a3cec6a8f trigger reload if cert change
/etc/letsencrypt/live/$HOSTNAME/key.pem  and /etc/letsencrypt/live/$HOSTNAME/fullchain.pem are watched and will trigger a reload if changed
2020-07-07 21:26:53 +02:00
Ben 2ee280dcb3
Update dovecot-ldap.conf.ext
add auth_bind = no so that it can be overridden via the env-mailserver file used by docker compose. This is related to #1526
2020-07-04 11:50:25 -07:00
Michael Sprauer 32c732e276 certificates from acme.json
Will extract certificates from acme.json as written by traefik for usage in dovecot and postfix.
Also watches acme.json for changes. For this to work the file has to be mounted/present at `/etc/letsencrypt/acme.json`
2020-06-30 22:43:22 +02:00
Erik Wramner df4e04f033
Merge pull request #1547 from MrFreezeex/master
Fix dovecot variable with whitespace
2020-06-28 11:02:58 +02:00
Gio d888dbcf7f Fix typo 2020-06-27 23:07:17 -05:00
Arthur Outhenin-Chalandre c7f9fbd439
Fix dovecot variable with whitespace
Signed-off-by: Arthur Outhenin-Chalandre <arthur@cri.epita.fr>
2020-06-27 11:17:25 +02:00
Casper c359521121
Typo fixed 2020-06-14 04:39:34 +02:00
Nicholas Pepper 1b659a5574 Modified letsencrypt support to add domain name checking in addition to
hostname checking.  Added necessary tests and renamed original manual
ssl test to a name that supports adding the other SSL tests.
2020-05-15 04:52:26 +00:00
youtous 04059cd618
MAIL-8818 - Postfix information leakage
To prevent announcing software or version to malicious people or scripts, it is advised to hide such information.


This information is provided as part of the Lynis community project. It is related to Lynis control MAIL-8818 and should be considered as-is and without guarantees.

https://cisofy.com/lynis/controls/MAIL-8818/
2020-05-10 16:04:53 +02:00
youtous d0f7257333
support comments in .cf files 2020-05-06 22:59:55 +02:00
youtous 32d16084ec
sieve scripts using alphabetical order 2020-05-04 16:13:47 +02:00
youtous 92414b7eba
sieve after/before use folder instead of individual listing
Loading sieve scripts using a directory scheme permits to handle multi scripts wtihout defining individual sieve_before/sieve_after
2020-05-04 00:27:29 +02:00
youtous 30262128f4
raise a warning when SPAMASSASSIN_SPAM_TO_INBOX isn't explicitly defined 2020-05-03 10:33:50 +02:00
youtous d829905cf7
init spams to junk 2020-05-03 10:33:28 +02:00
Erik Wramner 23eb7c42ab
Merge pull request #1481 from youtous/fix-sieve-folder
Prevent sieve symlink to be evaluated as a directory by dovecot
2020-05-02 08:09:09 +02:00
Erik Wramner 0537c6f046
Merge pull request #1482 from youtous/feature-quota-optional
Feature quota optional.
2020-05-02 08:07:38 +02:00
youtous 16cd4f9d2d
Reduce opportunities for a potential CPU exhaustion attack with `NO_RENEGOTIATION`
See https://en.wikipedia.org/wiki/Resource_exhaustion_attack
2020-05-02 00:04:05 +02:00
youtous 0c838706d0
Option to disable dovecot quota 2020-05-01 23:42:21 +02:00
youtous e8581be2d3
Prevent sieve symlink to be evaluated as a directory by dovecot 2020-05-01 23:20:15 +02:00
youtous 3aeacef125
remove start-mailserver nested conditions dovecot quota 2020-04-30 16:11:45 +02:00
youtous d45e6b1c22
#fix 1478 2020-04-30 12:47:12 +02:00
Erik Wramner 35f473ad12
Merge pull request #1474 from polarathene/chore/remove-obsolete-param-usetls
chore: Remove obsolete postfix parameter `smtpd_use_tls`
2020-04-30 08:02:11 +02:00
Brennan Kinney 76594c21c4
Add note about `tls_ssl_options = NO_COMPRESSION`
[Postfix docs](http://www.postfix.org/postconf.5.html#tls_ssl_options):

> Disable SSL compression even if supported by the OpenSSL library. Compression is CPU-intensive, and compression before encryption does not always improve security.

[Postfix mailing list discussion](http://postfix.1071664.n5.nabble.com/patch-mitigate-CRIME-attack-td57978.html):

> The CRIME attack does not apply to SMTP, because unlike SMTP, there is no javascript in SMTP clients that makes them send thousands of email messages with chosen plaintext compressed together in the same packet with SASL credentials or other sensitive data.
> The auditor completely failed to take the context into account.

[Mailing list discussion of potential compression CRIME-like attack](https://lists.cert.at/pipermail/ach/2014-December/001660.html)

> keeping compression disabled is a good idea.

If you need a good test score, PCI compliance will likely flag compression despite not having any known risk with non-HTTP TLS.
2020-04-29 19:41:08 +12:00
Brennan Kinney e7de9bceaf
chore: Remove obsolete postfix parameter `smtpd_use_tls`
See: http://www.postfix.org/postconf.5.html#smtpd_tls_security_level

> this overrides the obsolete parameters `smtpd_use_tls` and `smtpd_enforce_tls`.
2020-04-27 23:24:26 +12:00
youtous 03b8f87ffc
update dovecot conf comment 2020-04-26 22:23:51 +02:00
youtous 47fac2706f
use ffdhe4096 for DHE params
use by default ffdhe4096 for DHE params 


use by default ffdhe4096 for DHE params
2020-04-26 22:23:51 +02:00
youtous f60de0c66e
init tests cases ffdhe4096 2020-04-26 22:23:51 +02:00
youtous 2527ebfaf2
added dovecot quota feature
add postfix service quota check


check-for-changes on quotas


setquota command


fix checkforchanges quota


addquota verify user exists


add setquota in setup.sh


merging addquota into setquota


test quota commands


add ldap tests for dovecot quota


fix smtp only quota postfix rules


test postfix conf


add quota test integration


add quota exceeded test


add wait analyze


fix tests


fix setup typo


add test fixes


fix error output


wip


update startup rules


fix setup


fix setup tests


fix output commands


remove quota on remove user


try to fix sync limit mails


check if file exists


fix path


change used quota user


fix post size


check if quota file exists


update tests


configure virtualmailbox limit for dovecot


last fix


fix quota expr


relax dovecot tests


auto create dovecot-quotas


fix dovecot apply quota test


wip quota warning


trying to fix get dovadm quota


dovecot applies fix


fix quota warning lda path


test count mail on quota


fix quota warning permissiosn


fix test
2020-04-24 14:56:15 +02:00
Nils Knappmeier 370d08fd33 fail2ban: use filter.d/dovecot.conf from distribution
closes #972
2020-04-10 22:21:40 +02:00
Erik Wramner 73b8d65dd3 Merge next into master 2020-04-05 09:28:22 +02:00
Erik Wramner 04777fdb89
Merge pull request #1435 from Drakulix/master
amavis: fix config permission
2020-04-05 08:43:47 +02:00
Christian Glahn ff1248eeee activate shortcircuit plugin, fixes #1442 2020-03-31 17:09:23 +02:00
Jairo Llopis a00dced8bc Allow to set comfortably inet_protocols
Setting `inet_protocols = ipv4` is almost a requirement when running behind Docker. Provide a way to make it easy.

@Tecnativa TT22925
2020-03-25 21:43:29 +01:00
Victor Brekenfeld c491496b6e avavis fix config permission 2020-03-24 15:43:35 +01:00
Erik Wramner 142b98a209
Merge pull request #1427 from Tecnativa/inet-protocols
Allow to set comfortably inet_protocols
2020-03-22 08:56:55 +01:00
Germain Masse ce41f60888 Move filebeat to its own container 2020-03-20 17:56:18 +01:00
Jairo Llopis ab22450364
Allow to set comfortably inet_protocols
Setting `inet_protocols = ipv4` is almost a requirement when running behind Docker. Provide a way to make it easy.

@Tecnativa TT22925
2020-03-19 08:35:25 +00:00
Wandrille RONCE d148eeddfb Add an option to place spam in the inbox, and then sort the mail by a sieve rule for example 2020-03-16 18:47:24 +01:00
Robert Pufky d3f7c56cdf Fix broken fail2ban dovecot filter; use <HOST> instead of undocumented feature.
* Replace deprecated, undocumented fail2ban feature "(\P<host>\S*)" with
  supported host match "<HOST>".
* Fixes "No failure-id group in '(?: pop3-login|ima ..." fail2ban dovecot filter
  error message.
* See: https://github.com/fail2ban/fail2ban/issues/2130
2020-03-16 18:45:22 +01:00
Wandrille RONCE 90951876cd Add an option to place spam in the inbox, and then sort the mail by a sieve rule for example 2020-03-15 17:51:12 +01:00
Robert Pufky a82caf5d9b Fix broken fail2ban dovecot filter; use <HOST> instead of undocumented feature.
* Replace deprecated, undocumented fail2ban feature "(\P<host>\S*)" with
  supported host match "<HOST>".
* Fixes "No failure-id group in '(?: pop3-login|ima ..." fail2ban dovecot filter
  error message.
* See: https://github.com/fail2ban/fail2ban/issues/2130
2020-02-01 14:57:03 -08:00
Erik Wramner f342151b80 Fixed several amavis tests and removed commented code 2020-01-26 16:39:58 +01:00
Erik Wramner a208748ea2 Configure amavis with D_BOUNCE for spam 2020-01-26 08:34:40 +01:00
Erik Wramner 85ae8a1471 Fix fail2ban issues and install some suggested amavis packages 2020-01-25 15:33:06 +01:00
Erik Wramner 91b2c9834e Upgrade to buster and remove filebeat 2020-01-25 15:33:06 +01:00
Torben Weibert ca16307729 Added -f flag to chmod command to suppress error when no sieve-pipe scripts exist 2020-01-21 22:18:00 +01:00
Torben Weibert 70d87f5119 Add executable flag for scripts in /usr/lib/dovecot/sieve-pipe 2020-01-21 18:18:16 +01:00
Erik Wramner ae2aa6eeb4
Merge pull request #1372 from phish108/shortcircuit-bayes-99-mini
activate SA shortcircuit features via env, fixes #1118 (again)
2020-01-15 07:28:00 +01:00
Lukas Elsner 35df764107 fix clamav issue in logwatch 2020-01-13 17:58:34 -05:00
Christian Glahn b8726b80a4 activate SA shortcircuit features via env, fixes #1118 2020-01-13 14:22:14 +01:00
Erik Wramner d847be2d5a
Merge pull request #1331 from Tecnativa/srs-sender-classes
Allow to configure SRS sender classes easily
2019-12-06 07:22:46 +01:00
Jairo Llopis 7f1bc8f8b3
Avoid infinite failure log in Amavis with SMTP_ONLY=1
Fix #801 by simply touching the file if it doesn't exist.

@Tecnativa TT20505
2019-12-03 13:43:43 +00:00
Jairo Llopis 42348ff353
Allow to configure SRS sender classes easily
This will allow to forward safely any email from any host, no matter how strict their SPF policy is, by setting `SRS_SENDER_CLASSES=envelope_sender,header_sender`.

@Tecnativa TT20505
2019-12-03 13:33:51 +00:00
Erik Wramner da1287c1a5 Changed wrong set options in pflogsumm cron job 2019-12-01 09:19:47 +01:00
Erik Wramner c882d95deb
Merge pull request #1284 from vortex852456/master
Added optional file user-patches.sh for own patches without recompiling
2019-11-09 15:13:06 +01:00
Germain Masse 36afac7726 New option DOVECOT_MAILBOX_FORMAT 2019-11-04 15:49:29 +00:00
Germain Masse e465e659ad Remove unnecessary maildir folders creation 2019-11-01 20:04:37 +00:00
Erik Wramner 37e0082cd7 Set expected permissions in log #1300 2019-10-27 09:22:16 +01:00
Vortex c30c3bf5de moved user_patches from misc to nearly the end of setups 2019-10-16 18:56:06 +02:00
Daniel Dobko e441f1318a Tests should work from now on
Merge branch 'user-patches.sh'

# Conflicts:
#	config/user-patches.sh
#	target/start-mailserver.sh
2019-10-08 21:55:46 +02:00
Undercover1989 275a83667a base files 2019-10-08 21:22:12 +02:00
Undercover1989 0975b71d72 chown docker:docker /tmp/docker-mailserver/user-patches.sh 2019-10-08 19:24:01 +02:00
Undercover1989 b5c422c3c5 start user-patches.sh native instead of explicit using the bash-command 2019-10-08 15:08:01 +02:00
Undercover1989 b01071f52f Added optional file ./config/user-patches.sh which is executed between configuration and starting daemons (misc-section) 2019-10-07 21:04:49 +02:00
Erik Wramner 5f9428fcf3 Set REPORT_RECIPIENT to postmaster when 0 2019-09-24 21:09:48 +02:00
Erik Wramner b9515eae4c Fix report_recipient bugs 2019-09-22 17:16:33 +02:00
Erik Wramner 008b8e6bce Fix #1093, pflogsumm and logwatch 2019-09-16 08:00:35 +02:00
Erik Wramner f14c9fc6ce Moved Postfix overrides last to fix #1143 2019-09-15 18:29:46 +02:00
Erik Wramner 0eef718ed2 Fix #1251 intermediate TLS level 2019-09-05 19:39:33 +02:00
Erik Wramner 615a845d6c Fixed bug when dh.pem/dhparam.pem exists with ONE_DIR 2019-08-13 07:26:31 +02:00
Erik Wramner 5ebb8614a2
Merge pull request #1220 from erik-wramner/dhparam_on_start
Generate dhparam and dovecot cert on start
2019-08-12 22:00:31 +02:00
Erik Wramner f5dac6e71c Disable SMTPUTF8 as Dovecot can't handle it 2019-08-11 17:14:00 +02:00
Erik Wramner d6838e8274 Remove spamassassin cron job when spamassassin is off 2019-08-11 09:52:50 +02:00
Erik Wramner 9d7873850d Move dovecot cert generation to startup 2019-08-10 10:15:35 +02:00
Erik Wramner fc8d684994 Generate dhparams at startup, not build 2019-08-09 22:13:50 +02:00
Roman Seyffarth 5eb0d5ffa6 Fixed opendkim config on multiple nameservers 2019-08-09 09:04:43 +02:00
Martin Schulze fcce47a392 WIP: actually test PERMIT_DOCKER=connected-networks
also showcase timeouts and makefile integration
2019-08-07 02:24:56 +02:00
Erik Wramner 41921f82aa
Merge pull request #1205 from j-marz/opendkim_nameserver
set Nameservers in opendkim.conf at start-up
2019-08-04 18:54:08 +02:00
j-marz 8a1584c3cb set Nameservers in opendkim.conf at start-up 2019-08-03 15:26:44 +10:00
Martin Schulze 234632913e Add PERMIT_DOCKER=connected-networks 2019-08-02 15:05:00 +02:00
Erik Wramner 81e9c7dcff Protect user db with flock 2019-08-01 19:39:25 +02:00
Erik Wramner ec4661194b Compute checksum after possible in-place sed changes 2019-08-01 12:05:48 +02:00
Erik Wramner 7f3e5a22e1 Create checksums in start script, avoid race condition 2019-08-01 09:58:22 +02:00
Erik Wramner 573609e011 Put checksum file in /tmp as suggested in code review 2019-07-31 12:56:18 +02:00
Erik Wramner 37708b5787 Added comment explaining chksum file location 2019-07-31 10:41:32 +02:00
Erik Wramner 311bdfa1ba Keep checksum file outside shared/mounted area 2019-07-30 16:10:51 +02:00
Erik Wramner 566c28555a Revert "Sync after update to make sure changes propagate to host"
This reverts commit 66711cfe5d33a9ce5ae3d78e7b7c04e68edf1571.
2019-07-30 16:10:51 +02:00
Erik Wramner b58fd30c0a Sync after update to make sure changes propagate to host 2019-07-30 16:10:51 +02:00
Erik Wramner f21bffe322 Fix 1198 freshclam (#1199)
* Run freshclam as clamav user not root

* Remove freshclam cron job when clamav is disabled
2019-07-29 11:15:49 +02:00
j-marz 42675ba7ad Fixed self-signed cert generation (#1183)
Added optional FQDN arguement to setup.sh script which avoids using temporary container hostname for cert names. Also fixed issue with certs being saved outside config volume
2019-07-29 11:14:36 +02:00
Torben Weibert cba6b07391 Allow postfix master.cf overrides to start with numbers, not only characters (#1190) 2019-07-24 15:11:00 +02:00
Erik Wramner 603dbbd7b0 1175: specify user for cron.d freshclam file (#1176)
* 1175: specify user for cron.d freshclam file

* Fix Dovecot SSL parameters and generate dhparams as for Postfix

* Fixed broken unit tests
2019-07-23 16:12:12 +02:00
jjtt a3724fa91d Support for setting relayhost in main.cf (#1104)
* Added DEFAULT_RELAY_HOST setting
* If set this value will be used as the relayhost in /etc/postfix/maincf causing all mail to be delivered using this relay host
* Test for default relay host setting
2019-01-19 11:10:31 +01:00
Andrey Likhodievskiy a989d77a87 Disable ssl when no certificate is set (Closes: #1083, #1085)
* Modified start-mailserver.sh with two new options for SSL certificate Configuration ():
+ ‘’ (empty string) modifies dovecot configs to allow plain text access
+ * (default) does nothing but warn with message ‘SSL configured by default’

* Updated README.md:
SSL_TYPE environment variable with unknown value will set SSL by default
2018-12-02 12:59:16 +01:00
Daniel Panteleit 0fb4a6d082 Clear up env format and hostname value (#1076)
* Describe format for .env in README
* Display used domain and hostname even when they are not acceptable
This should be clearer for the user when the hostname was set incorrectly.
2018-11-11 20:46:53 +01:00
Daniel Panteleit cc56b4f89e Calling supervisord directly instead of via shell (Closes: #1047, #1074) 2018-11-04 20:23:50 +01:00
Marius Panneck 351c9c80a8 Added default values for LDAP_START_TLS and DOVECOT_TLS (Closes: #1071, #1073) 2018-11-04 19:50:40 +01:00
Peter Hartmann 30ed8fbf0e Configuration support for /etc/aliases(Closes: #988, #1065)
* Update check-for-changes.sh
* add postfix-aliases.cf and handling of runtime updates
2018-11-01 20:17:07 +01:00
millerjason 53a344a056 Support for additional postgrey options (Close: #998, #999, #1046)
* addnl postgrey whitelist support. closes #998, closes #999.

	modified:   Dockerfile
	modified:   Makefile
	modified:   README.md
	modified:   docker-compose.elk.yml.dist
	modified:   docker-compose.yml.dist
	modified:   target/start-mailserver.sh
	modified:   target/supervisor/conf.d/supervisor-app.conf
	new file:   test/config/whitelist_recipients
	new file:   test/nc_templates/postgrey_whitelist_local.txt
	new file:   test/nc_templates/postgrey_whitelist_recipients.txt
	modified:   test/tests.bats

* match existing indent convention

	modified:   target/start-mailserver.sh

* ISSUE-999: add support for header_checks

	modified:   Dockerfile
	modified:   target/postfix/main.cf

* ISSUE-999: add empty header_check file

	new file:   target/postfix/header_checks.pcre
2018-11-01 19:32:36 +01:00
olaf-mandel 8c8426ef4a postfix: fix message size limits (#1061)
The message size limit was reduced in c8728eab from the postfix
default [1] of 10,240,000B = 10,000kiB = ~10MiB to only
1,048,576B = 1MiB. And the documentation claims that this would be 10MiB
instead of 1MiB.

Restore the old behaviour as default and fix the documentation as well.

[1]: http://www.postfix.org/postconf.5.html
2018-10-20 20:10:30 +02:00
Jiří Kozlovský c8728eab8a feat: added postfix message & mailbox size limits to ENV settings (Closes: #629, #1056) 2018-10-15 21:17:45 +02:00
Birkenstab 92002041ba Fix missing quotes in env export (Closes: #1007, #1048) 2018-10-14 10:07:05 +02:00
Birkenstab a198ea8495 Fix allow sending emails from regexp aliases when spoof protection is enabled (#1032) 2018-09-12 18:55:13 +02:00
James d518a9fc1d DOMAINNAME can fail to be set in postsrsd-wrapper.sh (#989)
* DOMAINNAME can fail to be set in postsrsd-wrapper.sh

if the container doesn’t have a proper hostname, postsrsd will fail to start
because SRS_DOMAIN is empty. Make a best effort to figure out the domain name
and provide a way to set one if needed.
2018-06-19 08:17:32 +02:00
n00dl3 261a78c036 fix SASL domain (fixes #892, #970)
setting value as `$myhostname` will make sasl look for users `user@mail.domain.tld` instead of `user@domain.tld`
2018-06-14 20:02:49 +02:00
Franz Keferböck e27e13c1b3 Add saslauthd option for ldap_start_tls & ldap_tls_check_peer - (Solves: #979, #980) 2018-06-02 21:16:16 +02:00
ixeft 60656aec49 Report sender (#965)
* added REPORT_SENDER env variable to the container.
* integration test for REPORT_SENDER
* added tests for default REPORT_SENDER
2018-05-01 19:57:31 +02:00
Johan Smits 5d03bb0982
Update docker-configomat (#959) 2018-04-23 20:59:27 +02:00
Paul Adams 283ac70bb9 don't update permissions on non-existent file (#956) 2018-04-23 20:42:47 +02:00
Paul Adams ea848eb86f Deliver root mail (#952)
* Configure delivery of root's mail to postmaster
* Tests for delivery of root mail
* add missing email template
2018-04-23 20:35:33 +02:00
17Halbe 59ce9d03f0 Testfixes & more (#942)
* fixed useless updatetest, made updatemailuser and addmailuser setup.sh compliant.
* changed documentation
2018-04-08 16:12:41 +02:00
Paul Adams a564cca0e5 set postmaster address to a sensible default (#938, #939, #940) 2018-04-05 19:04:55 +02:00
17Halbe cc7c1f8804 Introducing global filters. (#934)
* Introducing global filters
* added optional after.dovecot.sieve/before.dovecot.sieve files
* added global filter test
2018-04-05 18:54:01 +02:00
Pierre-Yves Rofes 137d623171 Ensure that the account contains a @ (#923, #924)
* Ensure that the provided username actually contains a domain
* Update README.md to be consistent with addmailuser script
* Add a test to check if the username includes the domain
2018-04-04 18:59:28 +02:00
17Halbe 7015d09404 Set default virus delete time (#932, #935) 2018-04-04 18:48:55 +02:00
Andreas Gerstmayr 1490f652c0 fix line breaks in postfix-summary mail error case (#936) 2018-04-04 18:45:50 +02:00
17Halbe 2e06228b10 Password creation fix (#908, #914)
* fix password with spaces is stripped to first word
2018-04-02 16:55:54 +02:00
Paul Adams f28e9843ce Implementation of multi-domain relay hosts (#922, #926)
* Add new configuration for multi-domain relay hosts (#922)
 * Creates new environment variables (replacing existing AWS_SES variables)
 * Optionally allows more advanced setups using config files
* Update relay hosts during change detection (#922)
* Add helper scripts for adding relay hosts and per-domain auth
* Allow the possibility to deliver some mail directly
* adding a domain with no destination will exclude it from the
  relayhost_map and so Postfix will attempt to deliver the mail directly
* tests for setup.sh script
* tests for relay host configuration
* these tests cover the code in `start-mailserver.sh` dealing with both
  the env vars and the configuration files
2018-04-02 10:45:58 +02:00
Andreas Gerstmayr f540f8e9c3 add headers to postfix summary mail (#919) 2018-03-30 10:24:40 +02:00
Marek Walczak b17ffe85d8 Tls level fix (#916)
* fix for TLS_LEVEL processing. unified spacing for sed.
2018-03-26 20:50:28 +02:00
17Halbe f682dfc15d fixed delalias, added additional tests (Closes: #909) 2018-03-19 20:26:10 +01:00
17Halbe 2167108ec0 introducing ENABLE_SRS env variable (Closes: #906, #852)
* making postsrsd optional
* added tests, added documentation
2018-03-18 20:15:06 +01:00
akmet a420b15370 Adding daily mail review from Issue 839 (#881)
* Added dependencies, binary, startup configuration
* Added env variable to dist files/readme
* send summary after each logrotate, added env variable for mail/logrotate interval
* remove mail.log from rsyslogs logrotate
* rotate mail.log when no email is set
* Added documentation for POSTFIX_LOGROTATE_INTERVAL
* Removed interval option, since its not being tested for.
* changed test to force logrotate to rotate fixed logrotate config
* readded setup_environment, made logrotate_setup being called everytime
* changed documentation for new variable names - again
* Did Documentation, added a default recipient, added test for default config.
* layout fix
* changed variable names apposite the documentation
2018-03-18 19:52:28 +01:00
akmet 68aaeba59f added error messages to letsencrypt on startup (#898) 2018-03-15 08:01:44 +01:00
17Halbe 570237232c Delmailuser (Closes: #878)
* delmailuser:
  + added multiple address deletion
  + added alias deletion
  + added maildir deletion (upon confirmation)
  + introduced optional "assume yes" argument
* updated addalias,delalias,delmailuser,updatemailuser and added modified tests
* added config check and repair to start-mailserver for old postfix-virtual.cf files
2018-03-14 20:00:38 +01:00
Johan Smits 50a76ba91e
Update docker-configomat (Resolves: #680) 2018-03-13 08:10:16 +01:00
James ef79e9a65d Generate SRS secret on first run and store it (#891) 2018-03-10 13:41:20 +01:00
Benedict Endemann e6c32a03e5 Add /var/lib/dovecot to mailstate persistence (Closes: #887)
Added `/var/lib/dovecot/` to the list of folders that get persisted in `mailstate`. So the creation of `ssl-parameters.dat` has not to be done every restart again. This may only take some dozen seconds, but can be very long on systems with high load.
2018-03-09 19:46:49 +01:00
James 2e8bb4ae34 Allow configuring SRS secrets using the environment (#885) 2018-03-08 22:51:10 +01:00
akmet 34cb3a14cc Removed unneeded check for Let's encrypt cert.pem (Closes: #843) 2018-03-07 20:21:46 +01:00
17Halbe a73692cc9f Added reject_authenticated_sender_login_mismatch (#872)
* added reject_authenticated_sender_login_mismatch handling including tests
* removed obsolete reject_sender_login_mismatch
* introduced SPOOF_PROTECTION env variable, tests, documentation and missing documentation for TLS_LEVEL
* added missing email template
2018-03-07 19:33:43 +01:00
Alexander Elbracht d9502ab6e7 Implement undef option for SA_SPAM_SUBJECT (#767)
* Implement undef option for SA_SPAM_SUBJECT in amavis config
* Add test for undef spam subject
2018-03-02 22:38:57 +01:00
Marek Walczak c505177486 Dkim key size (#868)
Allow to change the keysize for the dkim key
2018-03-02 22:17:18 +01:00
Andreas Gerstmayr 2687469f38 update postmaster_address in dovecot config according to POSTMASTER_ADDRESS env var (#866)
* update postmaster_address in dovecot config according to POSTMASTER_ADDRESS env var
* tests: add another test for postmaster_address with default settings
2018-02-27 20:44:45 +01:00
Marek Walczak c36e878d76 Nist tls (#831)
* remove two ciphers according to https://www.htbridge.com/ssl/ (NIST, HIPAA)
* added a switch via an environment variable to choose between modern and intermediate ciphers
2018-02-22 08:36:12 +01:00
Achim Christ eb20722b80 Add environment variable to allow for customizing postsrsd's SRS_EXCLUDE_DOMAINS setting (#849, #842) 2018-02-18 20:53:13 +01:00
17Halbe 5e09074d58 postscreen implementation altered (#846)
* new setup.sh function, new tests, new script and some minor updates to main.cf
* fix for missing files
* removed obsolete test-files
* restart postfix if neccessary.
* see pr  #845
* fixed typo
* fixed branchmixup
* changed postfix reload command & changed to operate on container instead of image
* reload postfix only on adding new restriction
* main.cf is only changed when user is added.
 - Postfix reload changed
 - working on container instead of image now in setup.sh
 - added cleanup after tests
* moved cleanup to makefile
2018-02-18 13:29:43 +01:00
17Halbe 795cbf103d fixed greedy postgrey sed command (#845) 2018-02-18 10:37:31 +01:00
17Halbe b08c9b42ed moved fail2ban function from setup.sh to own file (#837)
* moved fail2ban function out of setup.sh
2018-02-13 08:31:12 +01:00
17Halbe 5394a505b9 Restrict access (Closes #452, #816)
new setup.sh function, new tests, new script
2018-02-07 21:33:07 +01:00
H4R0 f6404156f9 Changed Junk folder to be created and subscribed by default (#806) 2018-02-06 20:21:37 +01:00
TechnicLab f68befdbee Added reject_sender_login_mismatch (Closes: #811) 2018-02-06 19:35:32 +01:00
Jurek Barth e1e4542390 Fix: Add SRS to fix SPF issues on redirect #611 (#814)
* add srs support

* change autorestart behavior

* this may work now

* make postsrsd’s own wrapper file

* fix dockerfile formatting

* fixing tests
2018-02-06 08:11:57 +01:00
17Halbe 3b7fc5930c Introducing Postscreen (#799)
* Introduced Postscreen

cheaper, earlier and simpler blocking of zombies/spambots.
From http://postfix.cs.utah.edu/POSTSCREEN_README.html :
As a first layer, postscreen(8) blocks connections from zombies and other spambots that are responsible for about 90% of all spam. It is implemented as a single process to make this defense as cheap as possible.

Things we need to consider:

 - Do we need a whitelist/backlist file? (http://postfix.cs.utah.edu/postconf.5.html#postscreen_access_list)
   - Via introducing an optional config/postfix-access.cidr
   - The only permanent whitelisting I could imagine are monitoring services(which might (still?) behave weird/hastely) or blacklisting backup servers(since no traffic should be coming from them anyway)
 - Do we need deep inspections? They are desireable, but these tests are expensive: a good client must disconnect after it passes the test, before it can talk to a real Postfix SMTP server. Considered tests are:
   - postscreen_bare_newline_enable (http://postfix.cs.utah.edu/postconf.5.html#postscreen_bare_newline_action)
   - postscreen_non_smtp_command_enable (http://postfix.cs.utah.edu/postconf.5.html#postscreen_non_smtp_command_action)
   - postscreen_pipelining_enable (http://postfix.cs.utah.edu/postconf.5.html#postscreen_pipelining_action)
- Do we need to make the blacklisting via dnsblocking configurable? It's currently set and weighted as follows, where a score of 3 results in blocking, a score of -1 results in whitelisting:
   (*: adds the specified weight to the SMTP client's DNSBL score. Specify a negative number for whitelisting.)
   (http://postfix.cs.utah.edu/postconf.5.html#postscreen_dnsbl_sites)
   - zen.spamhaus.org*3
   - bl.mailspike.net
   - b.barracudacentral.org*2
   - bl.spameatingmonkey.net
   - bl.spamcop.net
   - dnsbl.sorbs.net
   - psbl.surriel.com
   - list.dnswl.org=127.0.[0..255].0*-2
   - list.dnswl.org=127.0.[0..255].1*-3
   - list.dnswl.org=127.0.[0..255].[2..3]*-4
- What to do when blacklisting? I currently set it to drop. We could
   - ignore: Ignore the failure of this test. Allow other tests to complete. Repeat this test the next time the client connects. This option is useful for testing and collecting statistics without blocking mail.
   - enforce: Allow other tests to complete. Reject attempts to deliver mail with a 550 SMTP reply, and log the helo/sender/recipient information. Repeat this test the next time the client connects.
   - drop: Drop the connection immediately with a 521 SMTP reply. Repeat this test the next time the client connects.

In the end I think we could drop postgrey support. Postscreen replaces postgrey in its entirety, while being more selective and not delaying mail. Especially if we consider using the deep inspection options of postscreen.

Hope that wasn't too much to read! ;)

* main.cf got misformatted..
Don't know how, should be ok now.

* fixed malformatted main.cf & repaired master.cf

* reenabled rbl stuff.. It's cached, therefore doesn't hurt

* fixed tests

* added tests, repaired tests, added info, introduced new Variable POSTSCREEN_ACTION, fixes
2018-02-04 21:31:08 +01:00
Marek Walczak b4b19e76b7 Stretch backport (#813)
* install dovecot from backports

* dovecot 2.2.33 has a slightly different TLS-configuration than 2.2.27

* want to have both images a the same time

* make use of the /etc/dovecot/ssl as mkcert.sh (2.2.33) is using that folder for certs.
2018-02-04 21:27:47 +01:00
Mathieu Brunot d270fcdd40 Added support for Dovecot and Postfix LDAP TLS (#800)
* Allow setup of LDAP STARTTLS for Dovecot and Postfix

* Added tests for TLS config override

* Add missing Postfix TLS options

* Added missing new line at the end of the file

* Added STARTTLS tests for Postfix config
2018-01-25 22:38:41 +01:00
17Halbe eea4ec1dbc disable_vrfy_command: (#798)
Prevents Spammers from collecting existing mail-addresses by probing the mailserver for them.
2018-01-25 08:32:00 +01:00
Marek Walczak 49b3867c1b debian stretch slim (#784)
* Switch to stretch-slim as base image.
 - first step correct the testdata, as newer packages are more strict
about the mail-structure.

* Switch to stretch-slim: correcting the test-environment and the build
 - add missing build-step to make
 - clean the userdb aswell
 - use timeout of netcat, as postgrey would not close the connection
 - there is 2 extra mail-logs -> assert_output 5
 - cosmetic: use "" instead of ''

* Switch to stretch-slim:
new image:
 - smaller size
 - 0 CVEs compared to 11 CVEs in ubuntu 16.04 Image
better backport situation
 - postfix 3.1.6 vs 3.1.0
 - fail2ban 0.9.6 vs 0.9.3
 ...
changes needed because of stretch-slim:
- add missing gnupg and iproute2 package
- remove non-free rar, unrar-free should do
- rsyslog does not add syslog user and has different conf-structure
- pyzor command discover was deprecated and is missing in the new
stretch package

- dovecot does not know SSLv2 anymore. removed because of warnings in
log

- iptables does not know imap3, IMAP working group chose imap2 in favor
of imap3

* Switch to debian stretch slim:
SSLv2 seems to be a not known protocol anymore - good!

* switch to debian stretch slim:
make this test more stable. there might be more than only one mail.log
(mail.info, mail.warn, ...)

* switch to debian stretc slim:
 new openssl 1.1.0 needs stronger ciphers, removed some weekers ones.
Please, look through the new list of cipher! this needs to be done in
another commit for all other SSL/TLS-Endpoints aswell.

* Switch to debian stretch slim:
let our server pre-empt the cipher list.
Did a read through, wwwDOTpostfixDOTorg/FORWARD_SECRECY_READMEDOThtml
and
wwwDOTpostfixDOTorg/TLS_READMEDOThtml

* Switch to debian stretch slim: lets give this openssl-based test a new and independent but identical container.  many other test on the main 'mail' container might interfere here.

* Switch to debian stretch slim: remove unused lines
2017-12-31 12:33:48 +01:00
Toru Hisai b0526d0afe fix arguments for [ command (#783) 2017-12-31 10:49:15 +01:00
Alessio Nava c26d02a910 Changed omitted headers for DKIM with mailtrain (#774)
Added List-ID and List-Unsubscribe omitted headers for DKIM verification.
2017-12-18 21:55:50 +01:00
Damian Moore 01a41e9d93 Use PCRE for alias regular expressions instead of the basic type (#751) 2017-12-07 19:44:45 +01:00
Marek Walczak d62ea049e6 Add ability to override fail2ban.conf with fail2ban.local values. (#769)
* Add ability to override fail2ban.conf with fail2ban.local values.
2017-12-07 19:27:31 +01:00
kamuri 835939d856 Issue 747 (#748)
* fix for issue #747 (NOT TESTED YET)

Need to test this. Dont merge it yet.

* Small Cleanup and bug fixes Not done Yet!

Not done yet. Dont merge. See comment in issue #747

* Add --ignore-missing. Now is fixed.
2017-10-18 07:43:30 +02:00
kamuri 420e7741a1 Check for account changes and reload (Closes: #552)
Restart the daemons when changes are made to 'postfix-account.cf' and/or 'postfix-virtual.cf'
2017-10-10 08:15:18 +02:00
Johan Smits c7311f280f Fix spamassassin directory typo (Closes: #739) 2017-10-08 14:47:45 +02:00
Darren McGrandle 5961b31e91 Enable user definable fetchmail poll times (#731)
* Enable user definable fetchmail poll times
* create new ENV variable FETCHMAIL_POLL in target/start-mailserver.sh
* change --daemon setting in supervisor-app.conf to use ENV var
* Put FETCHMAIL_POLL env variable in Dockerfile to handle case where
  user does not specify it in their docker-compose.yml
2017-10-04 22:10:18 +02:00
Johan Smits a2efdab5dd Merge pull request #719 from johansmitsnl/supervisor-sock (closes: #707)
fix(): Supervisor socket issue with overlay (closes: #707)
2017-09-17 08:58:46 +02:00
Jean-Sebastien Legare c4cf848826 [opendmarc] Skip dmarc checks for email sent over authenticated sockets
opendmarc checks fail for mail sent over (SMTP AUTH) submission
   ports. Adding this directive skips checks for those emails, and
   clears the logs of related errors.

   See https://github.com/tomav/docker-mailserver/issues/703
2017-09-11 17:02:47 -07:00
Johan Smits ba62096550 fix(): Supervisor socket issue with overlay 2017-09-10 15:38:21 +02:00
Johan Smits 20a6eda79b Add newline to the end of the file 2017-09-10 09:52:22 +02:00
Hannu Shemeikka 984537526a New command: generate-dkim-domain
This command can be used for generating DKIM key for a domain,
which is not included in any configuration files. For example,
when using SQL database for transport maps.
2017-09-09 23:35:26 +03:00
Johan Smits 97e296162f Merge pull request #710 from johansmitsnl/improve-security-dhparams
Generate a new dhparams file if one_dir is set. (Resolves: #530)
2017-09-08 18:51:47 +02:00
Johan Smits 4cb8f4d4ae Improve the privacy of the client by removing sensitive details 2017-09-07 19:29:50 +02:00
Johan Smits 0fe86e796b Listen also on the ssl port 465 for clients (#709) 2017-09-07 18:08:25 +02:00
Johan Smits 91d34bc54e Generate a new dhparams file if one_dir is set. (Resolves: #530)
This improves security because each installation has it own generated
dhparams file. See ticket #530 for more details.
2017-09-06 23:41:23 +02:00
Johan Smits 1c75cabcfd Clean any leftover pid file from a stop (#700)
* Clean any leftover pid file from a stop

* More time needed for travis. It can be busy and fail tests.
2017-08-24 18:07:20 +02:00
Johan Smits 04904e77c4 Also search on the domain name for the virtual domain name in the ldap (Solves: #638) (#642)
Added test to check email delivery for a other domain then the primary
of the mailserver.
2017-08-19 10:32:00 +02:00
Johan Smits 9e7959fafe Issue 631 run services with supervisor (#676)
* installed supervisor. Still need to set tasks to run in foreground.

* setting programs to run in foreground

* seems to work now

* cleanup

* final fixes

* tests

* show startup output on stdout

* set Dovecot config files before starting it

* make all processes log to console

* Use the supervisor as the main process. The start-mailserver is started
from the supervisord and then this process triggers others.

Defined some default variable in the Dockerfile. In order for
supervisored to build the command lines the ENV variable need to be set.
Therefore the defaults are defined.

Some processes are not single processes like postfix and fail2ban and
they have a wrapper. The wrapper takes care of proper shutdown and checking
if the process is running or not. Supervisored will restart the wrapping
script if the process is gone.

Increased some delays between tests because sometimes they where to short
for all containers to be running.

* Remove obsolete comments, reset timeout value to old one, added new lines

* Add more time for analyzing the emails.

Sometimes it fails the tests and gives a wrong state about
the test. During testing 40 seconds was the safe value.
2017-08-07 17:39:40 +02:00
Daniel Panteleit 60afbe1d16 Disable logrotate and cron job for updating clamav if clamav is disabled (fixes #660) (#667) 2017-07-23 21:31:41 +02:00
Thomas VIAL 88e3d88de1 Fixed Postgrey re-startup by reoving pid file, suggested by @Sharsie (#658)
Fixes #649
2017-07-20 10:59:41 +02:00
alinmear dbf65789f2 Integrate docker-configomat for configuration parts of start-mailserver.sh #648 (#650)
* Add submodule docker-configomat

* Add configomat.sh to Dockerfile

* Replaced override_config with configomat.sh
2017-07-10 00:11:00 +02:00
alinmear 21fb3f3c86 Fix ldap related critical Problems (#644)
* Fix Dovecot Ldap Problems
* Fix typo within DEFAULT_VARS Definitions
* Fix wrong ldap hosts value within the bats test
* Fix override_config for strings containing &
* Fix erroneous removal of an conditional within the postfix override function
* Renamed Test 129, to be clear that this belongs to ldap
* Fix mail_with_ldap setting dn pass explicit
* Add 3 env variables for ldap: LDAP_QUERY_FILTER_{USER,GROUP,ALIAS}
* Update README.md
2017-07-03 13:16:15 +02:00
Richard Février 1effcdebd7 Letsencrypt : do not check the optional cert.pem (#639) 2017-07-01 14:32:12 +02:00
Alexander Elbracht 5a86193dbf Environment variable for amavis subject tag (#596)
* Environment variable for spam subject tag
* Add SA_SPAM_SUBJECT to readme
* Add integration tests for spam subject tag
* Fix overwrite environment variable in config file
2017-06-23 21:50:01 +02:00
MadsRC 3569aebcb6 Support for modifying Postfix' master.cf (#595)
* Support for modifying Postfix' master.cf, using the  syntax, in postfix-master.cf
2017-06-13 13:20:25 +02:00
alinmear 2e4e65b705 Fix Container Startup Fails on daemon start: opendkim #621 (#627) 2017-06-07 15:35:42 +02:00
Thomas VIAL b2922935ff This should fix most of 2.3 issues reported in #545 & #586 (#612)
* Fixes most of 2.3 issues reported in #545 & 586
2017-05-22 09:28:32 +02:00
Arne Kepp c0530491c3 Add sieve pipe and filter (#574)
* First pass at adding support for pipe and filter in Sieve, excluding unit tests.
* Reduce insight into copied scripts
* Added test
* Adjustments related to switch to 16.04
2017-05-10 09:54:02 +02:00
Michael Als 070f0da014 Fixes Postgrey whitelist_local copy issue 2017-05-10 09:42:44 +02:00
Thomas A. Kilian 95d3375010 Upgrade to 16.04 (#571)
* Upgrade to ubuntu:16.04
2017-04-27 17:59:28 +02:00
alinmear 50ac2bdc07 Fix #526: fatal: no SASL authentication mechanisms (#556)
* Fix #526: fatal: no SASL authentication mechanisms

When using the container with SMTP_ONLY = 1, then the container fails
on ehlo because there is no valid sasl authentication mechanism
available. This happens because sasl has been enabled within
postfix/main.cf per default but sasl is not configured.

To fix this _setup_postfix_sasl does not depend anymore on
ENABLE_SASLAUTHD and will check in it's logic, whether to enable sasl
or not within postfix/main.cf.

* Fix #526: fatal: no SASL authentication mechanisms

When using the container with SMTP_ONLY = 1, then the container fails
on ehlo because there is no valid sasl authentication mechanism
available. This happens because sasl has been enabled within
postfix/main.cf per default but sasl is not configured.

To fix this _setup_postfix_sasl does not depend anymore on
ENABLE_SASLAUTHD and will check in it's logic, whether to enable sasl
or not within postfix/main.cf.

* Fix test
2017-04-26 14:56:32 +02:00
alinmear 26992bb66f #503 (#522)
* Add method overwrite_config()
This method takes 2 arguments:
  1.) Environment Variable Prefix
  2.) String of files separated by whitespace

e.g.
  export LDAP_SEARCH_BASE=dc=domain,dc=loc
  export LDAP_BIND_PW=test

  overwrite_config "LDAP_" "/etc/postfix/ldap-users.cf
  /etc/postfix/ldap-groups.cf"

Logic:
  + all env vars will be search for vars with the prefix LDAP_
  + afterwards they will be dissembled in key value pairs
    LDAP_BIND_PW=test --> bind_pw test
  + the key and value will be substituted within the provided files
  via sed

* Fix #503 added logic for custom configs provided at container
provisioning within /tmp/docker-mailserver

* Add additional unit tests for postfix ldap integration

    * check custom configs copied
    * check environment variables substituted

* Fix quoting problems in tests.bats

* Fix missing brackets in function _fix_var_amavis_permissions()

* Fix typo in _setup_ldap

* Fix notify in overwrite_config

* Fix typo

* Fix added dovecot ldap config provisioning again and Add notify for tasks
2017-04-26 14:56:08 +02:00
Thomas VIAL 62f6fbbaae Fixes #496 enabling all domains to get spam headers and spam checks (#563)
* Fixes #496 enabling all domains to get spam headers and spam checks (integration tests included)
2017-04-18 14:18:42 +02:00
Thomas A. Kilian a144f3811c Issue 538 (#541)
* adapted setup.sh to handle email aliases
* added needed scripts for alias management
* added integration tests
2017-04-17 18:27:28 +02:00
Thomas A. Kilian 7753d59d72 fixed postgrey inet parameter (#570)
* fixed postgrey inet parameter

* adapted test cases

	modified:   target/start-mailserver.sh
	modified:   test/tests.bats
2017-04-12 19:45:47 +02:00