2020-04-22 09:06:03 +00:00
|
|
|
load 'test_helper/common'
|
|
|
|
|
|
|
|
function setup() {
|
|
|
|
run_setup_file_if_necessary
|
|
|
|
}
|
|
|
|
|
|
|
|
function teardown() {
|
|
|
|
run_teardown_file_if_necessary
|
|
|
|
}
|
|
|
|
|
|
|
|
function setup_file() {
|
2020-04-26 19:36:03 +00:00
|
|
|
docker run -d --name mail_manual_dhparams_one_dir \
|
2020-04-22 09:06:03 +00:00
|
|
|
-v "`pwd`/test/config":/tmp/docker-mailserver \
|
|
|
|
-v "`pwd`/test/test-files":/tmp/docker-mailserver-test:ro \
|
|
|
|
-v "`pwd`/test/test-files/ssl/ffdhe2048.pem":/var/mail-state/lib-shared/dhparams.pem:ro \
|
|
|
|
-e DMS_DEBUG=0 \
|
|
|
|
-e ONE_DIR=1 \
|
|
|
|
-h mail.my-domain.com -t ${NAME}
|
2020-04-26 19:36:03 +00:00
|
|
|
|
|
|
|
wait_for_finished_setup_in_container mail_manual_dhparams_one_dir
|
2020-04-22 09:06:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function teardown_file() {
|
2020-04-26 19:36:03 +00:00
|
|
|
docker rm -f mail_manual_dhparams_one_dir
|
2020-04-22 09:06:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "first" {
|
|
|
|
skip 'this test must come first to reliably identify when to run setup_file'
|
|
|
|
}
|
|
|
|
|
2020-04-26 19:36:03 +00:00
|
|
|
@test "checking dhparams: ONE_DIR=1 check manual dhparams is used" {
|
2020-04-22 09:06:03 +00:00
|
|
|
test_checksum=$(sha512sum "$(pwd)/test/test-files/ssl/ffdhe2048.pem" | awk '{print $1}')
|
|
|
|
run echo "$test_checksum"
|
|
|
|
refute_output '' # checksum must not be empty
|
|
|
|
|
2020-04-26 19:36:03 +00:00
|
|
|
docker_dovecot_checksum=$(docker exec mail_manual_dhparams_one_dir sha512sum /etc/dovecot/dh.pem | awk '{print $1}')
|
|
|
|
docker_postfix_checksum=$(docker exec mail_manual_dhparams_one_dir sha512sum /etc/postfix/dhparams.pem | awk '{print $1}')
|
2020-04-22 09:06:03 +00:00
|
|
|
assert_equal "$docker_dovecot_checksum" "$test_checksum"
|
|
|
|
assert_equal "$docker_postfix_checksum" "$test_checksum"
|
|
|
|
}
|
|
|
|
|
2020-04-26 19:36:03 +00:00
|
|
|
@test "checking dhparams: ONE_DIR=1 check warning output when using manual dhparams" {
|
|
|
|
run sh -c "docker logs mail_manual_dhparams_one_dir | grep 'Using self-generated dhparams is considered as insecure'"
|
2020-04-22 09:06:03 +00:00
|
|
|
assert_success
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "last" {
|
|
|
|
skip 'this test is only there to reliably mark the end for the teardown_file'
|
|
|
|
}
|