Files
Georg Lauterbach 08b3cf3bb2 breaking(networking): replace PERMIT_DOCKER with DMS_TRUSTED_NETWORKS (#4848)
`_setup_docker_permit` always parsed an IPv4 address from
`NETWORK_INTERFACE` and aborted startup when there was none, even for the
default `PERMIT_DOCKER=none`, which does not need it. DMS therefore
failed to start in IPv6-only networks.

Replace `PERMIT_DOCKER` with `DMS_TRUSTED_NETWORKS`, which no longer
implies Docker, carries the `DMS_` prefix and supports IPv6:

- `none` (default): trust no client
- `host`, `subnet`: delegate to Postfix `mynetworks_style`, so no
  `ip addr` parsing is needed
- a list of CIDR ranges (IPv4 and IPv6, separated by spaces or commas)

The ranges Postfix derives or the user provides are normalized (lower
case, compressed IPv6, host bits masked) before they are added to the
OpenDKIM and OpenDMARC trust lists, as both only match that text form.
An invalid value now stops the startup instead of being cleared with a
warning.

`NETWORK_INTERFACE` is removed together with `helpers/network.sh`.
`PERMIT_DOCKER` and `NETWORK_INTERFACE` log an error when still set and
are ignored, so no client is trusted until the user migrates:

- `container` => `host`
- `host`, `connected-networks` => `subnet`
- `network` => `172.16.0.0/12` (or the exact range of the network)

- docs: document `DMS_TRUSTED_NETWORKS` with a migration table and update
  all pages and demo setups that used the old variables
- tests: add `trusted_networks.bats` (no IPv4 address, `host`, CIDR list,
  invalid value, legacy variables), rename `permit_docker.bats` and
  migrate all tests to the new variable
- changelog: add `Breaking` and `Fixed` entries

Closes #4634
Closes #3478
2026-11-11 19:50:14 +01:00

46 lines
1.1 KiB
Bash

load "${REPOSITORY_ROOT}/test/helper/common"
load "${REPOSITORY_ROOT}/test/helper/setup"
BATS_TEST_NAME_PREFIX='[POP3] '
CONTAINER_NAME='dms-test_pop3'
function setup_file() {
_init_with_defaults
local CUSTOM_SETUP_ARGUMENTS=(
--env ENABLE_POP3=1
--env DMS_TRUSTED_NETWORKS=host
)
_common_container_setup 'CUSTOM_SETUP_ARGUMENTS'
}
function teardown_file() { _default_teardown ; }
@test 'server is ready' {
_run_in_container nc -w 1 0.0.0.0 110
assert_success
assert_output --partial '+OK'
}
@test 'authentication works' {
_send_raw_transaction 'auth/pop3-auth.txt' '-w 1 0.0.0.0 110'
assert_success
}
@test 'added user authentication works' {
_send_raw_transaction 'auth/added-pop3-auth.txt' '-w 1 0.0.0.0 110'
assert_success
}
# TODO: Remove in favor of a common helper method, as described in vmail-id.bats equivalent test-case
@test 'Mail log is error free' {
_service_log_should_not_contain_string 'mail' 'non-null host address bits in'
_service_log_should_not_contain_string 'mail' ': Error:'
}
@test '(Manage Sieve) disabled per default' {
_run_in_container nc -z 0.0.0.0 4190
assert_failure
}