Commit graph

2214 commits

Author SHA1 Message Date
Georg Lauterbach c7b16a599c
log: adjust level and message(s) slightly for four messages (#2532)
Co-authored-by: Casper <casperklein@users.noreply.github.com>
2022-04-05 16:21:07 +02:00
Georg Lauterbach a9305a073f
firewall: replace iptables with nftables (#2505)
* first adjustments to use Fail2Ban with nftables

* replace `iptables` -> `nftables` and adjust tests

nftables lists IPs a bit differently , so the order was adjusted for the
tests to be more flexible.

* line correction in mailserver.env

* change from `.conf` -> `.local` and remove redundant config

* revert HEREDOC to `echo`

Co-authored-by: Casper <casperklein@users.noreply.github.com>
2022-04-05 15:13:59 +02:00
dependabot[bot] 7c150402a0
chore(deps): Bump peterjgrainger/action-create-branch (#2528)
Bumps [peterjgrainger/action-create-branch](https://github.com/peterjgrainger/action-create-branch) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/peterjgrainger/action-create-branch/releases)
- [Commits](https://github.com/peterjgrainger/action-create-branch/compare/v2.1.0...v2.2.0)

---
updated-dependencies:
- dependency-name: peterjgrainger/action-create-branch
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-05 10:43:58 +12:00
Georg Lauterbach 21c218ac68
scripts: remove DMS_DEBUG (#2523)
* remove DMS_DEBUG from tests
* remove DMS_DEBUG from doc and scripts
* updated issue template
* re-add description about removal of DMS_DEBUG
2022-04-03 13:29:10 +02:00
Georg Lauterbach 35fb744ffb
scripts: refactored check-for-changes.sh (#2498)
* refactored `check-for-changes.sh`

I refactored `check-for-changes.sh` and used the new log. `_notify` can
therefore be deleted as it is used no more.
I opted to source `/etc/dms-settings` as a whole to
future-proof the script. When the DNS adjustments PRs (that do not exist
by now but will exit in the future) are done, we can then remove
`_obtain_hostname_and_domainname` because we're already writing the
variables to `/etc/dms-settings`. I left instructions in the script in
the form of TODO comments.

Because we now log the date for all messages of the changedetector, we
need to `tail` a bit more log than before.
2022-04-02 19:39:15 +02:00
Georg Lauterbach d651f3bd93
create .github/FUNDING.yml (#2512) 2022-04-02 15:56:29 +02:00
Georg Lauterbach a1ecd781c8
scripts: introduce _log to sedfile (#2507) 2022-04-02 15:52:30 +02:00
Ikko Ashimine 05f680b472
fix: typo in setup-stack.sh (#2521) 2022-04-02 10:41:46 +02:00
Georg Lauterbach 04e452a1ee
tests: disabled "quota exceeded" test (#2511)
* disabled unreliable test

The "quota exceeded" test is unreliable and failed too often lately for
my taste. Therefore, I'd like to disable it because there is no use in
having such a test.

* corrected PR id in URL
2022-04-02 10:13:34 +02:00
github-actions[bot] aeb8cc1900
docs(CONTRIBUTORS): update contributors (#2517) 2022-04-01 19:32:36 +02:00
Georg Lauterbach 2707474361
add compatibility for Bash 4 to setup.sh (#2519)
The command `shopt -s inherit_errexit` does not work in Bash < v4.4. This is now fixed.
2022-04-01 19:10:39 +02:00
Frederic Werner 7655c788ee
docs(deps): bump mkdocs-material to v8.2.8 (#2516) 2022-03-31 14:21:43 +02:00
Georg Lauterbach a54d774587
scripts: refactored daemon-stack.sh (#2496)
* refactored `daemon-stack.sh`

A new method was introduced to uniformaly start daemons and log output
accordingly. The methods for daemon start were renamed (plural ->
singular), therefore the adjustments in `start-mailserver.sh`.

* cleaned Fetchmail setup from `daemon-stack.sh`

Not sure why, but the Fetchmail setup was somehow happening in
`daemon-stack.sh` - this is not supposed to be the case. I relocated the
setup into `setup-stack.sh`, where it belong.

* delete old, unnecessary script in `target/bin/`

These are unused leftovers from the last commit, that relocated the
setup of Fetchmail into `setup.stack.sh`.

* corrected changedetector function name

* Apply suggestions from code review

* adjusted `debug-fetchmail` script

It is absolutely fine to source `setup-stack.sh` because sourcing the
script does not execute a single function (by desing of the script).
This way, we retain functionality.

* praise be ShellCheck

* added `log.sh` to `debug-fetchmail` as a dependency

* final cleanup

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
Co-authored-by: Casper <casperklein@users.noreply.github.com>
2022-03-27 09:43:39 +02:00
Georg Lauterbach 7721a48b9b
scripts: refactoring & miscellaneous small changes (#2499)
* `update-check.sh` now uses the new log

* refactored `setup-stack.sh`

The changes are:

1. Replaced `""` wiht `''` where possible (reasoning: Bash is very
   implicit and I'd like to use `''` where possible to indicate no
   variables are expanded here)
2. `> /file` -> `>/file` according to our style guide
3. Some log adjustments for messages where I deemed it appropriate
4. Then, an error message from a Dovecot setup was also prevented (by
   adding a check whether the directory is present before a `: >...`
   command would create a file in this directory).

These are all small, miscellaneous changes that I wanted to combine into
one commit and ultimately one PR because I see no point in opening a PR
for every small change here. I hope this is fine.

* added a small `sleep` to the `_shutdown` function

This ensure the last log message is actually logged before Supervisor
logs the message that it received a SIGTERM. This makes reading the log
easier because now the causal relationship is shown (we are terminating
Supervisor, and not someone else and we're just logging it).

I forgot to replace `""` with `''` in `update-check.sh`, so I included
it here because this is the last commit before PR review.

* re-add exit on successful update (only)

* re-added date information to update-check log messages

* added `_log_with_date` function

The new function will log a message with a proper timestamp. This is all
handled in `log.sh`, we therefore not need to source other files too.

This will be used in the future by `check-for-changes.sh` as well :)

Co-authored-by: Casper <casperklein@users.noreply.github.com>
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2022-03-26 10:17:08 +01:00
Georg Lauterbach b9dbec3276
scripts: refactored scripts located under target/bin/ (#2500)
* refactored scripts located under `target/bin/`

The scripts under `target/bin/` now use the new log and I replaced some
`""` with `''` on the way. The functionality stays the same, this mostly
style and log.

* corrected fail2ban (script and tests)

* corrected OpenDKIM log output in tests

* reverted (some) changes to `sedfile`

Moreover, a few messages for BATS were streamlined and a regression in
the linting script reverted.

* apple PR feedback

* improve log output from `fail2ban` script

The new output has a single, clear message with the '[  ERROR  ]  '
prefix, and then output that explains the error afterwards. This is
coherent with the logging style which should be used while providing
more information than just a single line about IPTables not functioning.

* simplified `setquota` script

* consistently named the `__usage` function

Before, scripts located under `target/bin/` were using `usage` or
`__usage`. Now, they're using `__usage` as they should.

* improved `sedfile`

With `sedfile`, we cannot use the helper functions in a nice way because
it is used early in the Dockerfile at a stage where the helper scripts
are not yet copied. The script has been adjusted to be canonical with
all the other scripts under `target/bin/`.

* fixed tests

* removed `__usage` from places where it does not belong

`__usage` is to be used on wrong user input, not on other failures as
well. This was fixed in `delquota` and `setquota`.

* apply PR review feedback
2022-03-26 09:30:09 +01:00
Casper f22d75fa62
Remove invalid URL from SPF message (#2503) 2022-03-22 17:53:12 +01:00
dependabot[bot] 00dffb21f0
chore(deps): Bump actions/cache from 2.1.7 to 3 (#2502) 2022-03-21 18:43:58 +01:00
dependabot[bot] 0dc80e6d13
chore(deps): Bump docker/build-push-action from 2.9.0 to 2.10.0 (#2501) 2022-03-21 15:03:38 +01:00
Georg Lauterbach b7bf40ac21
renamed function _errex -> _exit_with_error (#2497) 2022-03-21 15:01:07 +01:00
Casper 37c8e44566
Restart supervisord early (#2494) 2022-03-21 13:42:12 +01:00
Georg Lauterbach 24031ae365
scripts: new log (#2493)
* added new `_log` function

With `_log`, the `_notify` method wa rendered obsolete. `_notify` was
not completely removed due to test failures in `check-for-changes.sh`.

The new `_log` function properly uses log levels such as `trace`,
`debug`, `info`, `warn` and `error`. It provides a cleaner solution
and renders `DMS_DEBUG` obsolete too (as only `_notify` depends on it).

* converted all helper script to new `_log` function

* converted all startup stacks to new `log` function

* `start-mailserver.sh` now uses new `_log` function

* final test and misc small script adjustments

* updated documentation
2022-03-21 07:07:52 +01:00
Casper d8d4b6a189
Improve test, get rid of sleep (#2492) 2022-03-20 13:26:23 +01:00
Casper 1bfc6d944a
Use FQDN as REPORT_SENDER default value. (#2487) 2022-03-18 19:41:02 +01:00
Nathan Pierce 1f174ce211
Merge pull request #2468 from docker-mailserver/issues/2467 2022-03-18 13:07:46 -04:00
Nathan Pierce a435c32661
Merge branch 'master' into issues/2467 2022-03-17 09:24:55 -04:00
Georg Lauterbach 321ae744fa
scripts: small refactorings (#2485)
Co-authored-by: Casper <casperklein@users.noreply.github.com>
2022-03-17 11:24:30 +01:00
Nathan Pierce 6dd8d48a04
Merge branch 'master' into issues/2467 2022-03-15 10:18:52 -04:00
Casper b730942b96
Makefile: Remove backup/restore of obsolete config directory (#2479) 2022-03-15 13:47:13 +01:00
Casper 5b5b444094
docs(fail2ban): Use the correct example config location (#2484) 2022-03-15 14:51:47 +13:00
Nathan Pierce 67533d7029
Merge pull request #2466 from docker-mailserver/revert-macos-logic
Remove macOS specific code / support + shellcheck should avoid python, regardless of permissions
2022-03-09 07:11:15 -05:00
Casper 45068ff2a5
Merge branch 'master' into revert-macos-logic 2022-03-09 10:39:15 +01:00
NorseGaud 66cf4f3a54
${@:+$@} -> ${@} 2022-03-08 18:32:15 -05:00
dependabot[bot] 542c1f4e8d
chore(deps): bump docker/login-action from 1.14.0 to 1.14.1 (#2471)
Bumps [docker/login-action](https://github.com/docker/login-action) from 1.14.0 to 1.14.1.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v1.14.0...v1.14.1)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2022-03-09 11:59:00 +13:00
dependabot[bot] bf7fba68bd
chore(deps): bump actions/checkout from 2 to 3 (#2470)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Frederic Werner <20406381+wernerfred@users.noreply.github.com>
2022-03-09 11:57:01 +13:00
Casper a2f22422ca
docs: Enhance logrotate description (#2469) 2022-03-07 23:00:32 +01:00
NorseGaud 1ab8ea96b2
acme_extract -> acme_extract.py + F_BIN to avoid .py 2022-03-06 22:17:29 -05:00
NorseGaud f14945c52d
issues/2023: postfix is not able to install due to incorrect hostname in container 2022-03-06 19:57:31 -05:00
NorseGaud 3be5879fcf
prevent piling up build intermediate containers 2022-03-06 13:37:34 -05:00
NorseGaud c56db1380e
only shellcheck shell scripts 2022-03-06 13:37:07 -05:00
NorseGaud 54e41d04f7
removed Darwin specific code and modified the docs to indicate macOS is not supported 2022-03-06 11:59:53 -05:00
Georg Lauterbach d101d0aa0a
fix: remove SA reload for KAM (#2456)
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2022-03-04 23:38:29 +01:00
Casper b9fdb1e7b5
Introduce CLAMAV_MESSAGE_SIZE_LIMIT env (#2453) 2022-03-03 16:17:01 +01:00
Casper 1911f9a4b4
setup.sh: Remove obsolete 'debug inspect' command from usage text (#2454) 2022-03-03 11:38:28 +00:00
sportshead fd4bebaf54
[docs] faq.md: update naked/bare domain section (#2446) 2022-03-03 08:24:02 +01:00
Casper a8a8c859dc
Rename config examples directory (#2438) 2022-03-02 22:54:14 +00:00
Nathan Pierce 1eca829cc1
Merge pull request #2448 from docker-mailserver/macos-linting-support
macos support: lint.sh doesn't find proper bash under /usr/local/bin + acme_extract (python) is trying to be shellchecked
2022-03-02 17:34:27 -05:00
Nathan Pierce c4d2605790
Merge branch 'master' into macos-linting-support 2022-03-02 16:26:04 -05:00
Georg Lauterbach e6af5a118f
Adjust envrionment variables - more sensible defaults (#2428)
The new setup will now set env variables on one place and on one place
only. The old setup used two separate places wich is not DRY and
confusing.

Some default values changed:

1. PFLOGSUMM_TRIGGER: logrotate => none
2. REPORT_SENDER: mailserver-report@HOSTNAME => mailserver-report@DOMAIN
3. REPORT_RECIPIENT: "0" => POSTMASTER_ADDRESS

One env variable was renamed: REPORT_INTERVAL => LOGROTATE_INTERVAL

I believe these defaults to be more sensible, especially the REPORT_RECIPIENT
address. The PFLOGSUMM_TRIGGER value was changed to `none` because otherwise
people would start getting daily Postfix log summary reports automatically.
Now, this is opt-in, and reports are sent only when enabled properly.

Some of the variables changed were marked as deprecated. I removed the note,
as the variables now bear some (sane) defaults again for other variables
(i.e.) REPORT_RECIPIENT is now default for other recipient addresses.

Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
Co-authored-by: Casper <casperklein@users.noreply.github.com>
2022-03-03 10:22:17 +13:00
Nathan Pierce 81f1d8410e
Merge branch 'master' into macos-linting-support 2022-03-02 15:03:25 -05:00
Casper 57c52d7b5b
PERMIT_DOCKER=none as new default value (#2424)
Co-authored-by: Brennan Kinney <5098581+polarathene@users.noreply.github.com>
2022-03-02 16:03:40 +01:00