forked from hardware/mailserver
-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
467 lines (438 loc) · 20.1 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
NAME = mailserver2/mailserver:testing
all: build-no-cache default reverse ldap ldap2 sieve ecdsa traefik_acmev1 traefik_acmev2 clean
no-build: default reverse ldap ldap2 sieve ecdsa traefik_acmev1 traefik_acmev2 clean
default: init_default fixtures_default run_default stop_default
reverse: init_reverse fixtures_reverse run_reverse stop_reverse
ldap: init_ldap fixtures_ldap run_ldap stop_ldap
ldap2: init_ldap2 fixtures_ldap2 run_ldap2 stop_ldap2
sieve: init_sieve fixtures_sieve run_sieve stop_sieve
ecdsa: init_ecdsa run_ecdsa stop_ecdsa
traefik_acmev1: init_traefik_acmev1 run_traefik_acmev1 stop_traefik_acmev1
traefik_acmev2: init_traefik_acmev2 run_traefik_acmev2 stop_traefik_acmev2
build-no-cache:
docker build --no-cache -t $(NAME) .
build:
docker build -t $(NAME) .
init_openldap:
-docker rm -f \
openldap || true
docker run \
-d \
--name openldap \
-e LDAP_ORGANISATION="Test LDAP" \
-e LDAP_DOMAIN="domain.tld" \
-e LDAP_ADMIN_PASSWORD="testpasswd" \
-e LDAP_TLS=false \
-v "`pwd`/test/config/ldap/struct.ldif":/container/service/slapd/assets/config/bootstrap/ldif/custom/struct.ldif \
-t osixia/openldap:1.4.0 --copy-service
init_redis:
-docker rm -f \
redis || true
docker run \
-d \
--name redis \
-t redis:7.0-alpine
sleep 10
init_mariadb:
-docker rm -f \
mariadb || true
docker run \
-d \
--name mariadb \
-e MYSQL_RANDOM_ROOT_PASSWORD=yes \
-e MYSQL_DATABASE=postfix \
-e MYSQL_USER=postfix \
-e MYSQL_PASSWORD=testpasswd \
-v "`pwd`/test/config/mariadb/struct.sql":/docker-entrypoint-initdb.d/struct.sql \
-v "`pwd`/test/config/mariadb/bind.cnf":/etc/mysql/conf.d/bind.cnf \
-t mysql:8
init_postgres:
-docker rm -f \
postgres || true
docker run \
-d \
--name postgres \
-e POSTGRES_DB=postfix \
-e POSTGRES_USER=postfix \
-e POSTGRES_PASSWORD=testpasswd \
-v "`pwd`/test/config/postgres":/docker-entrypoint-initdb.d \
-t postgres:16-alpine
init_ldap: init_openldap init_redis
-docker rm -f \
mailserver_ldap || true
docker run \
-d \
--name mailserver_ldap \
--link openldap \
--link redis:redis \
-e DBDRIVER=ldap \
-e DBHOST=openldap \
-e DBPORT=389 \
-e LDAP_BIND_DN="cn=admin,dc=domain,dc=tld" \
-e LDAP_BIND_PW="testpasswd" \
-e LDAP_DEFAULT_SEARCH_BASE="o=mx,dc=domain,dc=tld" \
-e LDAP_DOMAIN_FILTER="(&(mail=*@%s)(objectClass=mailAccount))" \
-e LDAP_DOMAIN_ATTRIBUTE="mail" \
-e LDAP_DOMAIN_FORMAT="%d" \
-e LDAP_MAILBOX_FILTER="(&(mail=%s)(objectClass=mailAccount))" \
-e LDAP_MAILBOX_ATTRIBUTE="mail" \
-e LDAP_MAILBOX_FORMAT="/var/mail/vhosts/%d/%s/mail/" \
-e LDAP_ALIAS_FILTER="(&(mailalias=%s)(objectClass=mailAccount))" \
-e LDAP_ALIAS_ATTRIBUTE="mail" \
-e LDAP_FORWARD_FILTER="(&(mailalias=%s)(objectClass=mailAlias))" \
-e LDAP_FORWARD_ATTRIBUTE="mail" \
-e LDAP_GROUP_FILTER="(&(mail=%s)(objectClass=mailGroup))" \
-e LDAP_GROUP_ATTRIBUTE="uid" \
-e LDAP_GROUP_RESULT_ATTRIBUTE="mail" \
-e LDAP_GROUP_RESULT_MEMBER="member" \
-e LDAP_SENDER_FILTER="(&(|(mail=%s)(mailalias=%s))(objectClass=mailAccount))" \
-e LDAP_SENDER_ATTRIBUTE="mail" \
-e LDAP_DOVECOT_USER_ATTRS="=home=/var/mail/vhosts/%d/%n/,=mail=maildir:/var/mail/vhosts/%d/%n/mail/,mailuserquota=quota_rule=*:bytes=%\$$" \
-e LDAP_DOVECOT_USER_FILTER="(&(mail=%u)(objectClass=mailAccount))" \
-e LDAP_DOVECOT_PASS_ATTRS="mail=user,userPassword=password" \
-e LDAP_DOVECOT_PASS_FILTER="(&(mail=%u)(objectClass=mailAccount))" \
-e LDAP_DOVECOT_ITERATE_ATTRS="mail=user" \
-e LDAP_DOVECOT_ITERATE_FILTER="(objectClass=mailAccount)" \
-e DKIM_SELECTOR="mail20190101" \
-e VMAILUID=`id -u` \
-e VMAILGID=`id -g` \
-e RSPAMD_PASSWORD=testpasswd \
-e ADD_DOMAINS=domain2.tld,domain3.tld \
-e RECIPIENT_DELIMITER=: \
-e TESTING=true \
-v "`pwd`/test/share/tests":/tmp/tests \
-v "`pwd`/test/share/ssl/rsa":/var/mail/ssl \
-v "`pwd`/test/share/postfix/custom.conf":/var/mail/postfix/custom.conf \
-v "`pwd`/test/share/postfix/sender_access":/var/mail/postfix/sender_access \
-v "`pwd`/test/share/dovecot/conf.d":/var/mail/dovecot/conf.d \
-v "`pwd`/test/share/clamav-unofficial-sigs/user.conf":/var/mail/clamav-unofficial-sigs/user.conf \
-h mail.domain.tld \
-t $(NAME)
fixtures_ldap:
# Wait for clamav unofficial sigs database update (ldap)
docker exec mailserver_ldap /bin/sh -c "while [ -f /var/lib/clamav-unofficial-sigs/pid/clamav-unofficial-sigs.pid ] ; do sleep 1 ; done"
# Wait for clamav load databases (ldap)
docker exec mailserver_ldap /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 3310 ; do sleep 1 ; done"
# Wait for rspamd to start (ldap)
docker exec mailserver_ldap /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 11332 ; do sleep 1 ; done"
docker exec mailserver_ldap /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user.txt"
docker exec mailserver_ldap /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user-spam-learning.txt"
docker exec mailserver_ldap /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-valid-user-subaddress.txt"
docker exec mailserver_ldap /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-non-existing-user.txt"
docker exec mailserver_ldap /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-alias.txt"
docker exec mailserver_ldap /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-alias-forward.txt"
docker exec mailserver_ldap /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-alias-group.txt"
docker exec mailserver_ldap /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-spam-to-existing-user.txt"
docker exec mailserver_ldap /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-virus-to-existing-user.txt"
docker exec mailserver_ldap /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp < /tmp/tests/email-templates/internal-user-to-existing-user.txt"
docker exec mailserver_ldap /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp < /tmp/tests/email-templates/internal-rejected-user-to-existing-user.txt"
sleep 2
docker exec mailserver_ldap /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:993 < /tmp/tests/sieve/trigger-spam-ham-learning.txt"
run_ldap:
./test/bats/bin/bats test/ldap.bats
stop_ldap:
-docker rm -f \
mailserver_ldap || true
init_ldap2: init_openldap init_redis
-docker rm -f \
mailserver_ldap2 || true
docker run \
-d \
--name mailserver_ldap2 \
--link openldap \
--link redis:redis \
-e DBDRIVER=ldap \
-e DBHOST=openldap \
-e DBPORT=389 \
-e LDAP_BIND_DN="cn=admin,dc=domain,dc=tld" \
-e LDAP_BIND_PW="testpasswd" \
-e LDAP_DEFAULT_SEARCH_BASE="o=mx,dc=domain,dc=tld" \
-e LDAP_DOMAIN_FILTER="(&(mail=*@%s)(objectClass=mailAccount))" \
-e LDAP_DOMAIN_ATTRIBUTE="mail" \
-e LDAP_DOMAIN_FORMAT="%d" \
-e LDAP_MAILBOX_FILTER="(&(mail=%s)(objectClass=mailAccount))" \
-e LDAP_MAILBOX_ATTRIBUTE="mail" \
-e LDAP_MAILBOX_FORMAT="/var/mail/vhosts/%d/%s/mail/" \
-e LDAP_ALIAS_FILTER="(&(mailalias=%s)(objectClass=mailAccount))" \
-e LDAP_ALIAS_ATTRIBUTE="mail" \
-e LDAP_SENDER_FILTER="(&(|(mail=%s)(mailalias=%s))(objectClass=mailAccount))" \
-e LDAP_SENDER_ATTRIBUTE="mail" \
-e LDAP_DOVECOT_USER_ATTRS="=home=/var/mail/vhosts/%d/%n/,=mail=maildir:/var/mail/vhosts/%d/%n/mail/,mailuserquota=quota_rule=*:bytes=%\$$" \
-e LDAP_DOVECOT_USER_FILTER="(&(mail=%u)(objectClass=mailAccount))" \
-e LDAP_DOVECOT_PASS_ATTRS="mail=user,userPassword=password" \
-e LDAP_DOVECOT_PASS_FILTER="(&(mail=%u)(objectClass=mailAccount))" \
-e LDAP_DOVECOT_ITERATE_ATTRS="mail=user" \
-e LDAP_DOVECOT_ITERATE_FILTER="(objectClass=mailAccount)" \
-e LDAP_MASTER_USER_ENABLED=true \
-e LDAP_DOVECOT_MASTER_PASS_ATTRS="mail=user,userPassword=password" \
-e LDAP_DOVECOT_MASTER_PASS_FILTER="(&(mail=%u)(st=%{login_user})(objectClass=mailAccount))" \
-e DISABLE_CLAMAV=true \
-e DISABLE_SIEVE=true \
-e DISABLE_SIGNING=true \
-e DISABLE_GREYLISTING=true \
-e DISABLE_RATELIMITING=true \
-e DISABLE_DNS_RESOLVER=true \
-e VMAILUID=`id -u` \
-e VMAILGID=`id -g` \
-e RSPAMD_PASSWORD=testpasswd \
-e ADD_DOMAINS=domain2.tld,domain3.tld \
-e RECIPIENT_DELIMITER=: \
-e TESTING=true \
-v "`pwd`/test/share/tests":/tmp/tests \
-v "`pwd`/test/share/ssl/rsa":/var/mail/ssl \
-v "`pwd`/test/share/postfix/custom.conf":/var/mail/postfix/custom.conf \
-v "`pwd`/test/share/postfix/sender_access":/var/mail/postfix/sender_access \
-v "`pwd`/test/share/dovecot/conf.d":/var/mail/dovecot/conf.d \
-v "`pwd`/test/share/clamav-unofficial-sigs/user.conf":/var/mail/clamav-unofficial-sigs/user.conf \
-h mail.domain.tld \
-t $(NAME)
fixtures_ldap2:
docker exec mailserver_ldap2 /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 25 ; do sleep 1 ; done"
sleep 30
docker exec mailserver_ldap2 /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user.txt"
docker exec mailserver_ldap2 /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-valid-user-subaddress.txt"
docker exec mailserver_ldap2 /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-non-existing-user.txt"
docker exec mailserver_ldap2 /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-alias.txt"
docker exec mailserver_ldap2 /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-alias-forward.txt"
docker exec mailserver_ldap2 /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-alias-group.txt"
docker exec mailserver_ldap2 /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp < /tmp/tests/email-templates/internal-user-to-existing-user.txt"
sleep 10
run_ldap2:
./test/bats/bin/bats test/ldap2.bats
stop_ldap2:
-docker rm -f \
mailserver_ldap2 || true
init_default: init_redis init_mariadb
-docker rm -f \
mailserver_default || true
sleep 60
docker run \
-d \
--name mailserver_default \
--link mariadb:mariadb \
--link redis:redis \
-e DBPASS=testpasswd \
-e RSPAMD_PASSWORD=testpasswd \
-e VMAILUID=`id -u` \
-e VMAILGID=`id -g` \
-e ADD_DOMAINS=domain2.tld,domain3.tld \
-e RECIPIENT_DELIMITER=: \
-e TESTING=true \
-v "`pwd`/test/share/tests":/tmp/tests \
-v "`pwd`/test/share/ssl/rsa":/var/mail/ssl \
-v "`pwd`/test/share/postfix/custom.conf":/var/mail/postfix/custom.conf \
-v "`pwd`/test/share/postfix/sender_access":/var/mail/postfix/sender_access \
-v "`pwd`/test/share/dovecot/conf.d":/var/mail/dovecot/conf.d \
-v "`pwd`/test/share/clamav-unofficial-sigs/user.conf":/var/mail/clamav-unofficial-sigs/user.conf \
-h mail.domain.tld \
-t $(NAME)
init_reverse: init_redis init_postgres
-docker rm -f \
mailserver_reverse || true
sleep 10
docker run \
-d \
--name mailserver_reverse \
--link postgres:postgres \
--link redis:redis \
-e FQDN=mail.domain.tld \
-e DOMAIN=domain.tld \
-e DBDRIVER=pgsql \
-e DBHOST=postgres \
-e DBPORT=5432 \
-e DBPASS=/tmp/passwd/postgres \
-e REDIS_HOST=redis \
-e REDIS_PORT=6379 \
-e REDIS_PASS=/tmp/passwd/redis \
-e RSPAMD_PASSWORD=/tmp/passwd/rspamd \
-e VMAILUID=`id -u` \
-e VMAILGID=`id -g` \
-e VMAIL_SUBDIR=subdir \
-e RELAY_NETWORKS="192.168.0.0/16 172.16.0.0/12 10.0.0.0/8" \
-e DISABLE_CLAMAV=true \
-e DISABLE_SIEVE=true \
-e DISABLE_SIGNING=true \
-e DISABLE_GREYLISTING=true \
-e DISABLE_RATELIMITING=true \
-e DISABLE_DNS_RESOLVER=true \
-e ENABLE_POP3=true \
-e ENABLE_ENCRYPTION=true \
-e ENABLE_FETCHMAIL=true \
-e DKIM_KEY_LENGTH=4096 \
-e DKIM_SELECTOR="other" \
-e TESTING=true \
-v "`pwd`/test/share/tests":/tmp/tests \
-v "`pwd`/test/share/passwd":/tmp/passwd \
-v "`pwd`/test/share/ssl/rsa":/var/mail/ssl \
-v "`pwd`/test/share/sieve/custom.sieve":/var/mail/sieve/custom.sieve \
-v "`pwd`/test/share/letsencrypt":/etc/letsencrypt \
-t $(NAME)
fixtures_reverse:
docker exec mailserver_reverse /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 25 ; do sleep 1 ; done"
sleep 30
docker exec mailserver_reverse /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user.txt"
docker exec mailserver_reverse /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-valid-user-subaddress-with-default-separator.txt"
docker exec mailserver_reverse /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-non-existing-user.txt"
docker exec mailserver_reverse /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-alias.txt"
docker exec mailserver_reverse /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-spam-to-existing-user.txt"
docker exec mailserver_reverse /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp < /tmp/tests/email-templates/internal-user-to-existing-user.txt"
# Wait until all mails have been processed
sleep 10
run_reverse:
./test/bats/bin/bats test/reverse.bats
stop_reverse:
-docker rm -f \
mailserver_reverse || true
init_ecdsa: init_redis init_mariadb
-docker rm -f \
mailserver_ecdsa || true
sleep 10
docker run \
-d \
--name mailserver_ecdsa \
--link mariadb:mariadb \
--link redis:redis \
-e DBPASS=testpasswd \
-e RSPAMD_PASSWORD=testpasswd \
-e VMAILUID=`id -u` \
-e VMAILGID=`id -g` \
-e DISABLE_CLAMAV=true \
-e DISABLE_RSPAMD_MODULE=rbl,mx_check,url_redirector \
-e TESTING=true \
-v "`pwd`/test/share/ssl/ecdsa":/var/mail/ssl \
-v "`pwd`/test/share/postfix/custom.ecdsa.conf":/var/mail/postfix/custom.conf \
-h mail.domain.tld \
-t $(NAME)
run_ecdsa:
docker exec mailserver_ecdsa /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 587 ; do sleep 1 ; done"
./test/bats/bin/bats test/ecdsa.bats
stop_ecdsa:
-docker rm -f \
mailserver_ecdsa || true
init_traefik_acmev1: init_redis init_mariadb
-docker rm -f \
mailserver_traefik_acmev1 || true
docker run \
-d \
--name mailserver_traefik_acmev1 \
--link mariadb:mariadb \
--link redis:redis \
-e DEBUG_MODE=dovecot,postfix \
-e DBPASS=testpasswd \
-e RSPAMD_PASSWORD=testpasswd \
-e VMAILUID=`id -u` \
-e VMAILGID=`id -g` \
-e DISABLE_CLAMAV=true \
-e TESTING=true \
-v "`pwd`/test/share/traefik/acme.v1.json":/etc/letsencrypt/acme/acme.json \
-h mail.domain.tld \
-t $(NAME)
run_traefik_acmev1:
docker exec mailserver_traefik_acmev1 /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 587 ; do sleep 1 ; done"
./test/bats/bin/bats test/traefik_acmev1.bats
stop_traefik_acmev1:
-docker rm -f \
mailserver_traefik_acmev1 || true
init_traefik_acmev2: init_redis init_mariadb
-docker rm -f \
mailserver_traefik_acmev2 || true
docker run \
-d \
--name mailserver_traefik_acmev2 \
--link mariadb:mariadb \
--link redis:redis \
-e DEBUG_MODE=true \
-e DBPASS=testpasswd \
-e RSPAMD_PASSWORD=testpasswd \
-e VMAILUID=`id -u` \
-e VMAILGID=`id -g` \
-e DISABLE_CLAMAV=true \
-e TESTING=true \
-v "`pwd`/test/share/traefik/acme.v2.json":/etc/letsencrypt/acme/acme.json \
-h mail.domain.tld \
-t $(NAME)
run_traefik_acmev2:
docker exec mailserver_traefik_acmev2 /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 587 ; do sleep 1 ; done"
./test/bats/bin/bats test/traefik_acmev2.bats
stop_traefik_acmev2:
-docker rm -f \
mailserver_traefik_acmev2 || true
fixtures_default:
# Wait for clamav unofficial sigs database update (default)
docker exec mailserver_default /bin/sh -c "while [ -f /var/lib/clamav-unofficial-sigs/pid/clamav-unofficial-sigs.pid ] ; do sleep 1 ; done"
# Wait for clamav load databases (default)
docker exec mailserver_default /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 3310 ; do sleep 1 ; done"
# Wait for rspamd to start (default)
docker exec mailserver_default /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 11332 ; do sleep 1 ; done"
docker exec mailserver_default /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user.txt"
docker exec mailserver_default /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user-spam-learning.txt"
docker exec mailserver_default /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-valid-user-subaddress.txt"
docker exec mailserver_default /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-non-existing-user.txt"
docker exec mailserver_default /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-alias.txt"
docker exec mailserver_default /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-spam-to-existing-user.txt"
docker exec mailserver_default /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-virus-to-existing-user.txt"
docker exec mailserver_default /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp < /tmp/tests/email-templates/internal-user-to-existing-user.txt"
docker exec mailserver_default /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp < /tmp/tests/email-templates/internal-rejected-user-to-existing-user.txt"
sleep 2
docker exec mailserver_default /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:993 < /tmp/tests/sieve/trigger-spam-ham-learning.txt"
# Wait until all mails have been processed
sleep 10
run_default:
./test/bats/bin/bats test/default.bats
stop_default:
-docker rm -f \
mailserver_default || true
init_sieve: init_redis init_mariadb
-docker rm -f \
mailserver_sieve || true
docker run \
-d \
--name mailserver_sieve \
--link mariadb:mariadb \
--link redis:redis \
-e DBHOST=mariadb \
-e DBPASS=testpasswd \
-e RSPAMD_PASSWORD=testpasswd \
-e VMAILUID=`id -u` \
-e VMAILGID=`id -g` \
-e ADD_DOMAINS=domain2.tld,domain3.tld \
-e RECIPIENT_DELIMITER=: \
-e TESTING=true \
-e DEBUG_MODE=true \
-v "`pwd`/test/share/tests":/tmp/tests \
-v "`pwd`/test/share/ssl/rsa":/var/mail/ssl \
-v "`pwd`/test/share/postfix/custom.conf":/var/mail/postfix/custom.conf \
-v "`pwd`/test/share/postfix/sender_access":/var/mail/postfix/sender_access \
-v "`pwd`/test/share/dovecot/conf.d":/var/mail/dovecot/conf.d \
-v "`pwd`/test/share/clamav-unofficial-sigs/user.conf":/var/mail/clamav-unofficial-sigs/user.conf \
-h mail.domain.tld \
-t $(NAME)
fixtures_sieve:
# Wait for clamav unofficial sigs database update (sieve)
docker exec mailserver_sieve /bin/sh -c "while [ -f /var/lib/clamav-unofficial-sigs/pid/clamav-unofficial-sigs.pid ] ; do sleep 1 ; done"
# Wait for clamav load databases (sieve)
docker exec mailserver_sieve /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 3310 ; do sleep 1 ; done"
# Wait for rspamd to start (sieve)
docker exec mailserver_sieve /bin/sh -c "while ! echo PING | nc -z 0.0.0.0 11332 ; do sleep 1 ; done"
docker exec mailserver_sieve /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user.txt"
docker exec mailserver_sieve /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-user-spam-learning.txt"
docker exec mailserver_sieve /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-valid-user-subaddress.txt"
docker exec mailserver_sieve /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-non-existing-user.txt"
docker exec mailserver_sieve /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-to-existing-alias.txt"
docker exec mailserver_sieve /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-spam-to-existing-user.txt"
docker exec mailserver_sieve /bin/sh -c "nc 0.0.0.0 25 < /tmp/tests/email-templates/external-virus-to-existing-user.txt"
docker exec mailserver_sieve /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp < /tmp/tests/email-templates/internal-user-to-existing-user.txt"
docker exec mailserver_sieve /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:587 -starttls smtp < /tmp/tests/email-templates/internal-rejected-user-to-existing-user.txt"
sleep 2
docker exec mailserver_sieve /bin/sh -c "openssl s_client -ign_eof -connect 0.0.0.0:993 < /tmp/tests/sieve/trigger-spam-ham-learning.txt"
# Wait until all mails have been processed
sleep 10
run_sieve:
./test/bats/bin/bats test/sieve.bats
stop_sieve:
-docker rm -f \
mailserver_sieve || true
clean:
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi
docker volume ls -qf dangling=true | xargs -r docker volume rm