Commit Graph

338 Commits

Author SHA1 Message Date
youtous dff7355fa9
fix #1459 2020-04-26 23:07:34 +02:00
youtous 4d031f73e3
test dhparams ONE_DIR both cases 2020-04-26 22:25:48 +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 bdcf5e0cf1
fix send mail test quota
fix quota warning test: wait for postfix to be UP


increase postfix restart delay
2020-04-24 19:03:27 +02:00
youtous 2e149b74c2
fix async quota tests 2020-04-24 17:03:09 +02:00
youtous 04de46dc41
test quota reached 2020-04-24 15:53:44 +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
Erik Wramner dde6acd1a1 Search in rotated logs and limit to RelayedInbound 2020-01-26 21:05:24 +01:00
Erik Wramner f342151b80 Fixed several amavis tests and removed commented code 2020-01-26 16:39:58 +01:00
Erik Wramner 42ccae2642 Test stop with a less central container than mail 2020-01-26 08:36:31 +01:00
Erik Wramner 27d66cf11f Restored test removed by accident 2020-01-22 19:11:59 +01:00
Erik Wramner 881ac71601 Show delivered mails with more details in test 2020-01-20 21:59:34 +01:00
Erik Wramner 1c73290ba0 Show found and expected decoders in test 2020-01-19 09:20:50 +01:00
Erik Wramner a66b2bff0c Make test result easier to evaluate 2020-01-18 21:01:24 +01:00
Erik Wramner 2ad667209c
Merge pull request #1323 from ap-wtioit/master-remove_tty_necessity
fix: dont use TTY in docker if not present, rem TTY necessity in tests
2019-11-13 09:59:01 +01:00
Andreas Perhab bbab4ef3fc fix: fix test setup.sh debug fetchmail on wildcard domains
on hosts that belong to wildcard domains pop3.example.com might
 actually resolve to pop3.example.com.[mydomain.com] and give a valid ip
 the return code of fetchmail then no longer is 11 (dns failure) but
 something else (2 for socket error in our case)

to make sure we always get return code 11 we use the domain name
pop3.example.com. that is not allowed to be resolved to a subdomain.
2019-11-12 15:35:03 +01:00
Andreas Perhab d8be2bd3cc fix: dont use TTY in docker if not present, rem TTY necessity in tests
Gitlab CI has not TTY present and TTY is not really required for
automated testing
2019-11-12 09:32:27 +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
Sebastian Kaiser 37540509dc - test for user-patches.sh 2019-11-08 02:22:33 +01:00
Germain Masse d764d89ea9 Test for DOVECOT_MAILBOX_FORMAT 2019-11-04 15:49:29 +00:00
Germain Masse fa167a9e51 Test special-use folders are available in IMAP 2019-11-01 20:04:37 +00:00
Germain Masse e465e659ad Remove unnecessary maildir folders creation 2019-11-01 20:04:37 +00:00
vortex852456 34f52c6ad0
only "assert_success" for user-patches.sh check 2019-10-31 09:51:40 +01:00
Vortex def8400c17 added default "user-patches.sh" to the first container "mail" 2019-10-31 09:01:44 +01:00
Vortex 437d3b74cc added test for "checking configuration: user-patches.sh executed" - should fail with this commit 2019-10-31 02:38:45 +01:00
Felix Bartels 7ff9764285
Provide version information through labels (#1256)
* Provide version information through labels

Can be retrieved by calling e.g. `docker inspect -f {{.Config.Labels}} tvial/docker-mailserver:testing`

Signed-off-by: Felix Bartels <felix@host-consultants.de>

* add build hook so that Docker Hub can work with the build args

Signed-off-by: Felix Bartels <felix@host-consultants.de>

* remove obsolete build-no-cache

build args invalidate build cache already

Signed-off-by: Felix Bartels <felix@host-consultants.de>

* adapt travis file

Signed-off-by: Felix Bartels <felix@host-consultants.de>

* shellcheck

Signed-off-by: Felix Bartels <felix@host-consultants.de>
2019-10-23 11:22:23 +02:00
Germain Masse b34a79310a Privacy test email no more tagged as SPAM. ClamAV and SA disabled to avoid time-out on low perf system 2019-10-14 13:25:44 +00:00
Martin Schulze e2bbf12524 Tests fx: Also wait for smtp port 2019-10-08 23:39:04 +02:00
Martin Schulze 604a65024e Tests: extract mail_privacy into own .bats file 2019-10-08 23:11:27 +02:00
Martin Schulze 533ac7ed29 Tests: extract mail_pop3 into own .bats file 2019-10-08 22:24:05 +02:00
Martin Schulze 81fd83525c Tests: extract mail_smtponly into own .bats file 2019-10-08 22:15:27 +02:00
Martin Schulze 56f47db0f2 Tests: Extract mail_fail2ban into own .bats file 2019-10-08 22:03:56 +02:00
Martin Schulze d05255cb04 Tests: Extract mail_fetchmail into own .bats file 2019-10-08 21:45:05 +02:00
Martin Schulze a03c741e1b Extract mail_manual_ssl into own .bats file 2019-10-08 21:36:13 +02:00
Martin Schulze d3e2dfe3ba Move mail_with_ldap into its own .bats file 2019-10-08 21:31:56 +02:00
Martin Schulze d9a48878c9 Print last 10 log lines on container setup timeout 2019-09-12 00:43:44 +02:00
Martin Schulze 3f9dd4180a Fix setup_file marker logic 2019-09-12 00:42:04 +02:00
Martin Schulze a20f2c4199 Add pregenerated test/config dh params 2019-09-12 00:42:04 +02:00
Erik Wramner ca821fa51a
Merge pull request #1259 from martin-schulze-vireso/bugfix/no_error_printed_on_timeout
Fix missing error output from timeout
2019-09-11 14:04:04 +02:00
Martin Schulze 3513944d0a Skip all tests of file after failed setup_file 2019-09-11 01:01:51 +02:00
Martin Schulze 8e6152ff2f Fix missing error output from timeout
The exits would prevent the printing code from running
2019-09-11 00:02:16 +02:00
Erik Wramner 8f23cb7b35 Adjust wait for tests as they often fail 2019-09-05 21:35:23 +02:00
Martin Schulze 596563ae64 Make failed test output more readable 2019-08-21 21:16:39 +02:00
Martin Schulze bfc4f5693e Don't use run in repeat_until_success_or_timeout
it overwrites the return code of its command
2019-08-17 21:23:48 +02:00
Martin Schulze a933ef27ac Fix polling with pipes 2019-08-17 20:58:33 +02:00
Martin Schulze 43ae814776 Extract mail_with_imap into its own test file 2019-08-17 20:58:33 +02:00
Martin Schulze 9019b98394 Extract mail_postscreen into own test file 2019-08-17 20:58:33 +02:00
Martin Schulze 3b728848bb Extract mail_lmtp_ip into own test file 2019-08-17 20:58:33 +02:00
Martin Schulze 82ab286291 Extract mail_undef_spam_subject into own test file 2019-08-17 20:58:33 +02:00
Martin Schulze 5be2fdc3cd Use correct container name 2019-08-17 20:58:33 +02:00
Martin Schulze 9d90df7064 Fix integer check 2019-08-17 20:58:33 +02:00
Martin Schulze 85fa5d242f Fix setup/teardown_file to work in full suite run
The previous mechanism would only run them once for the whole suite
2019-08-17 20:58:33 +02:00
Martin Schulze d8956d3b29 Extract mail_with_postgrey into own test files 2019-08-17 20:58:33 +02:00
Martin Schulze fcddf578d2 Extract mail with relay tests into own file 2019-08-17 20:58:33 +02:00
Martin Schulze db160bd977 Extract default relay host test
centralize common test variables and functions
2019-08-17 20:58:33 +02:00
Erik Wramner bf773cc8b7 Use assert_output for better diagnostics of failures 2019-08-16 12:02:23 +02:00
Felix Bartels 1ba0991d80
Fix linting errors reported by hadolint (#1211)
* Fix linting errors reported by hadolint
* use full path for folders when listing contents
* add linting task to makefile
2019-08-13 11:41:38 +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
Felix Bartels a7408b73e0 Do not remove dh*.pem as they do not exist at this point in time
Signed-off-by: Felix Bartels <felix@host-consultants.de>
2019-08-12 19:31:24 +02:00
Erik Wramner f5dac6e71c Disable SMTPUTF8 as Dovecot can't handle it 2019-08-11 17:14:00 +02:00
Erik Wramner c9bd3f3e83 Added sleep to test that keeps failing randomly 2019-08-10 08:34:18 +02:00
Erik Wramner fc8d684994 Generate dhparams at startup, not build 2019-08-09 22:13:50 +02:00
Martin Schulze 41dfe43c71 Remove code duplication 2019-08-07 22:03:17 +02:00
Martin Schulze d712a29baf Check for PERMIT_DOCKER correct postfix settings 2019-08-07 21:45:52 +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
Felix Bartels 83b4cda0bf update bats to latest version 2019-08-05 21:40:09 +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 2f0e516d42 added test to check for nameservers in opendkim.conf 2019-08-04 20:29:39 +10:00
Martin Schulze 9c1a5d76af Fix tests for PERMIT_DOCKER=connected-networks 2019-08-03 20:49:10 +02:00
Martin Schulze 234632913e Add PERMIT_DOCKER=connected-networks 2019-08-02 15:05:00 +02:00
Erik Wramner d6861881ab Parse logs to ensure changes are processed 2019-08-01 15:24:47 +02:00
Erik Wramner 21c89b3364 Added TODO as per code review and removed one sleep 2019-07-31 12:59:49 +02:00
Erik Wramner b23a7ddc1c Added newline as suggested in code review 2019-07-31 10:43:12 +02:00
Erik Wramner 311bdfa1ba Keep checksum file outside shared/mounted area 2019-07-30 16:10:51 +02:00
Erik Wramner f849b46462 Moved test files and mounted read-only 2019-07-30 16:10:51 +02:00
Erik Wramner e47c73f789 Wait and retry if pre-defined user login fails 2019-07-30 16:10:51 +02:00
Erik Wramner 1f298e3a76 Wait and retry if added user fails to login in tests 2019-07-30 16:10:51 +02:00
Erik Wramner 7299be1284 Split tests to find out why they fail 2019-07-30 16:10:51 +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
Daniel Panteleit cc56b4f89e Calling supervisord directly instead of via shell (Closes: #1047, #1074) 2018-11-04 20:23:50 +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
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
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
magnus anderssen c1118af66d Support for detecting running container mount (#884)
This modification proposes to support the running configured mounted
volume for configuration.

This removes the need to pass a path from the command line when the
container is running and configured in another way that yours.
2018-04-28 10:27:42 +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 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
17Halbe a7589aa353 test/config backup & restore (#907)
* backup and restore of test/config folder as done for the regular config folder as well.
* permissions fix
* preserving permissions and ownership
* new backup rule
2018-03-21 19:55:41 +01:00
17Halbe ee4b434a5c Restore userdb for tests (#913) 2018-03-20 08:17:24 +01: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 ad40c00546 Backup config folder while testing (#901)
* Backup whole config while testing
2018-03-16 18:52:49 +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
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
Marek Walczak 253c8faef6 Dkim key size - Addon (#871)
* added Tests
2018-03-03 09:20:23 +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
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
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 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
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
17Halbe c2f4220016 fail2ban handling integrated in setup.sh (#797)
* fail2ban handling integrated in setup.sh

- calling \"./setup debug fail2ban\" lists all iptable chains whith blocked IPs (like: Banned in dovecot: 91.200.12.164
										       Banned in postfix-sasl: 91.200.12.164)
- calling \"./setup debug fail2ban unban xxx.xxx.xxx.xxx [yyy.yyy.yyy.yyy ...]\" unbans/removes those IPs from all jails.
- calling \"./setup debug fail2ban unban\" (without an IP) gives an descriptive error: (You need to specify an IP address. Run "./setup.sh debug fail2ban" to get a list of banned IP addresses.)

* disable_vrfy_command: (#798)

Prevents Spammers from collecting existing mail-addresses by probing the mailserver for them.

* 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

* tests added
and made the script output look more shiny.

* setup.sh enhancements
2018-01-31 22:25:29 +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
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
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 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
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 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 9978bccbb6 Also test on the submission port if the login is succesful (#685)
Fixed location so that opendkim is happy with the correct
file location
2017-08-19 10:32:47 +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
Johan Smits 8b19d54218 Expand the decoders for amavis (Resolves: #659) (#677)
Use the guidelines from Ubuntu and added some more.
Added a test to ensure the number of decoders are present.
Guideline: https://help.ubuntu.com/community/PostfixAmavisNew
2017-08-07 17:37:16 +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
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
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
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
Michael Als ec6e5eea39 Include whitelist_clients.local in postgrey setup from config folder (#564) 2017-04-12 17:59:04 +02:00
mplx 4536113a30 allow accounts which do not start with a-z (#568) 2017-04-07 22:28:19 +02:00
Thomas VIAL 912cb5676b Fixes #546 & #560 - comments and new lines should not be parsed (#562)
* Fixes #546 & #560 - comments and new lines should not be parsed
2017-03-28 10:59:02 +02:00
Daniel S. Reichenbach 62c20295f9 Fixes #451 - add incoming mail SPF policy checks (#543) 2017-03-14 17:21:17 +01:00
Kai Ren cb0714ff77 Integration test for extension address delivery (#528)
* Add integration test for extension address Dovecot LMTP delivery
2017-03-03 18:27:22 +01:00
Florian 7e4e3662b3 Hostname override fixes for docker option --net=host in conjunction with OVERRIDE_HOSTNAME (#517)
* Fixed wrong mail headers when using OVERRIDE_HOSTNAME by setting the the hostname explicitly

* Added tests and fixed hostname in dovecot conf

* Added missing tests

* Improved function naming and task notification message
2017-02-13 11:07:30 +01:00
Sven Kauber c7e4206466 Added greylisting using postgrey (#495)
* Added greylisting using postgrey
* Updated the documentation
2017-02-06 10:21:18 +01:00
Kai Ren d40ae81d09 Hardening TLS ciphers (#492)
* Hardening Dovecot TLS ciphers
* Mitigate Logjam vulnerability on Dovecot
* Mitigate Logjam vulnerability on Postfix
* Add Nmap tests of PCI compliance for Postfix and Dovecot
* Increase sleep duration on Makefile steps to avoid races
2017-01-25 14:10:40 +01:00
Kevin Crawley 16c90fc52a kubernetes fix (#484)
* Allow OVERRIDE_HOSTNAME
* Document the new environment variable
2017-01-20 23:30:29 +01:00
Thomas VIAL 805506fbea Fixes #468: cron (virus wiper) (#469)
* Fixes #468: cron (virus wiper)
2017-01-11 10:52:39 +01:00
Thomas VIAL 69d3bac45e Add bats asserts (#463)
* Added `bats-assert` for more detailed error, very useful locally and on Travis
* Moved `bats` to git submodule

Example:

```
not ok 52 checking opendkim: generator creates keys, tables and TrustedHosts
# (from function `assert_output' in file test/test_helper/bats-assert/src/assert.bash, line 239,
#  in test file test/tests.bats, line 368)
#   `assert_output 2' failed
# 
# -- output differs --
# expected : 2
# actual   : 4
# --
# 
```
2017-01-10 14:15:41 +01:00
Kai Ren 414413a5c9 Add .editorconfig rules and fix some indents (#462) 2017-01-09 23:53:09 +01:00
alinmear a7670ac5c1 Add #394: Postfix Virtual Transport (#461)
* Add #394: Postfix Virtual Transport
This makes it possible to specify a lmtp config file, by providing
POSTFIX_DAGENT.

Update - Readme with informations about #394

    * Add Variable ENABLE_POSTFIX_VIRTUAL_TRANSPORT (task)
    * Add Variable POSTFIX_DAGENT (section)

Added Unit tests for virtual transport

* Fix syntax error in test/tests.bats

* Fix Unit Test
2017-01-09 23:52:36 +01:00
Wolfgang Ocker 9095ba3803 Fix #443 - RIMAP support (#448)
* Add unit tests for #443 (rimap auth)
* Fix #443 - configure rimap for saslauth
* Fix #443 - reuse smtp-auth-login.txt when testing rimap auth
2017-01-03 10:55:03 +01:00
Wolfgang Ocker 461c88e6ae Fix mailuser tools (#441)
* Add some checks for user name matching in mail user scripts
* Fix user matching problems in mail user scripts
** fix matching problems at several places:
    "delmailuser a@example.com" deletes also user "aa@example.com"
    "delmailuser a@sub.example.com" deletes also user "a@sub-example.com"
** similar problems when inserting
** refactor and clean up
2016-12-30 20:06:44 +01:00