[pmg-devel] [PATCH pmg-log-tracker 3/3] add testcase for mixed '-t' and '-x' options in before-queue filtering
Mira Limbeck
m.limbeck at proxmox.com
Tue May 19 15:31:07 CEST 2020
Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
.../test_input_before_queue_to_search_string | 91 ++++++++++++++++
.../test_output_before_queue_to_search_string | 101 ++++++++++++++++++
tests/tests_before_queue.rs | 25 +++++
3 files changed, 217 insertions(+)
create mode 100644 tests/test_input_before_queue_to_search_string
create mode 100644 tests/test_output_before_queue_to_search_string
diff --git a/tests/test_input_before_queue_to_search_string b/tests/test_input_before_queue_to_search_string
new file mode 100644
index 0000000..ce26b9a
--- /dev/null
+++ b/tests/test_input_before_queue_to_search_string
@@ -0,0 +1,91 @@
+May 18 15:57:43 pmg-demo postfix/postscreen[16981]: CONNECT from [192.168.30.128]:52990 to [192.168.30.128]:25
+May 18 15:57:43 pmg-demo postfix/postscreen[16981]: WHITELISTED [192.168.30.128]:52990
+May 18 15:57:43 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
+May 18 15:57:43 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
+May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 2020/05/18-15:57:43 CONNECT TCP Peer: "[127.0.0.1]:50042" Local: "[127.0.0.1]:10024"
+May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: new mail message-id=
+May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: SA score=1001/5 time=0.288 bayes=undefined autolearn=no autolearn_force=no hits=ALL_TRUSTED(-1),AWL(-0.397),DKIM_ADSP_NXDOMAIN(0.8),GTUBE(1000),KAM_DMARC_STATUS(0.01),KAM_NUMSUBJECT(0.5),MISSING_DATE(1.396),MISSING_MID(0.14),NO_DNS_FOR_FROM(0.379)
+May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: block mail to <ferdl at example.proxmox.com> (rule: block-ferdl)
+May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: moved mail for <ceo at example.proxmox.com> to spam quarantine - 3209E25EC29457CC507 (rule: Quarantine/Mark Spam (Level 3))
+May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: processing time: 0.302 seconds (0.288, 0.007, 0)
+May 18 15:57:43 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (3204C55EC294578338F); from=<mailtestsender.bad at proxtest.com> to=<ceo at example.proxmox.com> proto=ESMTP helo=<localhost.localdomain>
+May 18 15:57:43 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
+May 18 15:58:38 pmg-demo postfix/postscreen[16981]: CONNECT from [192.168.30.128]:53002 to [192.168.30.128]:25
+May 18 15:58:38 pmg-demo postfix/postscreen[16981]: WHITELISTED [192.168.30.128]:53002
+May 18 15:58:38 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
+May 18 15:58:38 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
+May 18 15:58:38 pmg-demo pmg-smtp-filter[17046]: 2020/05/18-15:58:38 CONNECT TCP Peer: "[127.0.0.1]:50054" Local: "[127.0.0.1]:10024"
+May 18 15:58:38 pmg-demo pmg-smtp-filter[17046]: 32031E5EC2948ECE5AB: new mail message-id=
+May 18 15:58:39 pmg-demo pmg-smtp-filter[17046]: 32031E5EC2948ECE5AB: SA score=1/5 time=0.333 bayes=undefined autolearn=no autolearn_force=no hits=ALL_TRUSTED(-1),AWL(-0.378),DKIM_ADSP_NXDOMAIN(0.8),KAM_DMARC_STATUS(0.01),KAM_NUMSUBJECT(0.5),MISSING_DATE(1.396),MISSING_MID(0.14),NO_DNS_FOR_FROM(0.379)
+May 18 15:58:39 pmg-demo postfix/smtpd[17725]: connect from localhost.localdomain[127.0.0.1]
+May 18 15:58:39 pmg-demo postfix/smtpd[17725]: 315103209E0: client=localhost.localdomain[127.0.0.1], orig_client=pmg-demo.proxmox.com[192.168.30.128]
+May 18 15:58:39 pmg-demo postfix/cleanup[17727]: 315103209E0: message-id=<20200518135839.315103209E0 at pmg-demo.proxmox.com>
+May 18 15:58:39 pmg-demo postfix/qmgr[1097]: 315103209E0: from=<mailtestsender.good at proxtest.com>, size=2311, nrcpt=2 (queue active)
+May 18 15:58:39 pmg-demo postfix/smtpd[17725]: disconnect from localhost.localdomain[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=2 data=1 commands=6
+May 18 15:58:39 pmg-demo pmg-smtp-filter[17046]: 32031E5EC2948ECE5AB: accept mail to <office at example.proxmox.com> (315103209E0) (rule: default-accept)
+May 18 15:58:39 pmg-demo pmg-smtp-filter[17046]: 32031E5EC2948ECE5AB: accept mail to <t.last at example.proxmox.com> (315103209E0) (rule: default-accept)
+May 18 15:58:39 pmg-demo pmg-smtp-filter[17046]: 32031E5EC2948ECE5AB: processing time: 0.359 seconds (0.333, 0.006, 0)
+May 18 15:58:39 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (32031E5EC2948ECE5AB); from=<mailtestsender.good at proxtest.com> to=<office at example.proxmox.com> proto=ESMTP helo=<localhost.localdomain>
+May 18 15:58:39 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
+May 18 15:58:39 pmg-demo pmg-smtp-filter[1060]: Starting "1" children
+May 18 15:58:39 pmg-demo postfix/smtp[17728]: 315103209E0: to=<office at example.proxmox.com>, relay=192.168.30.48[192.168.30.48]:25, delay=0.05, delays=0.01/0/0.02/0.02, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 3A97E10162E)
+May 18 15:58:39 pmg-demo postfix/smtp[17728]: 315103209E0: to=<t.last at example.proxmox.com>, relay=192.168.30.48[192.168.30.48]:25, delay=0.05, delays=0.01/0/0.02/0.02, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 3A97E10162E)
+May 18 15:58:39 pmg-demo postfix/qmgr[1097]: 315103209E0: removed
+May 18 16:03:55 pmg-demo postfix/postscreen[16981]: CONNECT from [192.168.30.128]:53066 to [192.168.30.128]:25
+May 18 16:03:55 pmg-demo postfix/postscreen[16981]: WHITELISTED [192.168.30.128]:53066
+May 18 16:03:55 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
+May 18 16:03:55 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
+May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 2020/05/18-16:03:55 CONNECT TCP Peer: "[127.0.0.1]:50118" Local: "[127.0.0.1]:10024"
+May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: new mail message-id=
+May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: SA score=1/5 time=0.347 bayes=undefined autolearn=no autolearn_force=no hits=ALL_TRUSTED(-1),AWL(-0.377),DKIM_ADSP_NXDOMAIN(0.8),KAM_DMARC_STATUS(0.01),KAM_NUMSUBJECT(0.5),MISSING_DATE(1.396),MISSING_MID(0.14),NO_DNS_FOR_FROM(0.379)
+May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: block mail to <ferdl at example.proxmox.com> (rule: block-ferdl)
+May 18 16:03:55 pmg-demo postfix/smtpd[17725]: connect from localhost.localdomain[127.0.0.1]
+May 18 16:03:55 pmg-demo postfix/smtpd[17725]: 6B2CD3209E0: client=localhost.localdomain[127.0.0.1], orig_client=pmg-demo.proxmox.com[192.168.30.128]
+May 18 16:03:55 pmg-demo postfix/cleanup[17727]: 6B2CD3209E0: message-id=<20200518140355.6B2CD3209E0 at pmg-demo.proxmox.com>
+May 18 16:03:55 pmg-demo postfix/smtpd[17725]: disconnect from localhost.localdomain[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 commands=5
+May 18 16:03:55 pmg-demo postfix/qmgr[1097]: 6B2CD3209E0: from=<mailtestsender.good at proxtest.com>, size=2342, nrcpt=1 (queue active)
+May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: accept mail to <office at example.proxmox.com> (6B2CD3209E0) (rule: default-accept)
+May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: processing time: 0.362 seconds (0.347, 0.008, 0)
+May 18 16:03:55 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (3204C55EC295CB131DB); from=<mailtestsender.good at proxtest.com> to=<ferdl at example.proxmox.com> proto=ESMTP helo=<localhost.localdomain>
+May 18 16:03:55 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
+May 18 16:03:55 pmg-demo postfix/smtp[17728]: 6B2CD3209E0: to=<office at example.proxmox.com>, relay=192.168.30.48[192.168.30.48]:25, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 6C1DE10162E)
+May 18 16:03:55 pmg-demo postfix/qmgr[1097]: 6B2CD3209E0: removed
+May 18 16:08:34 pmg-demo postfix/postscreen[16981]: CONNECT from [192.168.30.128]:53156 to [192.168.30.128]:25
+May 18 16:08:34 pmg-demo postfix/postscreen[16981]: WHITELISTED [192.168.30.128]:53156
+May 18 16:08:34 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
+May 18 16:08:34 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
+May 18 16:08:34 pmg-demo pmg-smtp-filter[17740]: 2020/05/18-16:08:34 CONNECT TCP Peer: "[127.0.0.1]:50208" Local: "[127.0.0.1]:10024"
+May 18 16:08:34 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: new mail message-id=
+May 18 16:08:35 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: SA score=1/5 time=0.334 bayes=undefined autolearn=no autolearn_force=no hits=ALL_TRUSTED(-1),AWL(-0.377),DKIM_ADSP_NXDOMAIN(0.8),KAM_DMARC_STATUS(0.01),KAM_NUMSUBJECT(0.5),MISSING_DATE(1.396),MISSING_MID(0.14),NO_DNS_FOR_FROM(0.379)
+May 18 16:08:35 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: block mail to <ferdl at example.proxmox.com> (rule: block-ferdl)
+May 18 16:08:35 pmg-demo postfix/smtpd[17725]: connect from localhost.localdomain[127.0.0.1]
+May 18 16:08:35 pmg-demo postfix/smtpd[17725]: 264C33209E0: client=localhost.localdomain[127.0.0.1], orig_client=pmg-demo.proxmox.com[192.168.30.128]
+May 18 16:08:35 pmg-demo postfix/cleanup[17727]: 264C33209E0: message-id=<20200518140835.264C33209E0 at pmg-demo.proxmox.com>
+May 18 16:08:35 pmg-demo postfix/qmgr[1097]: 264C33209E0: from=<mailtestsender.good at proxtest.com>, size=2339, nrcpt=1 (queue active)
+May 18 16:08:35 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: accept mail to <ceo at example.proxmox.com> (264C33209E0) (rule: default-accept)
+May 18 16:08:35 pmg-demo postfix/smtpd[17725]: disconnect from localhost.localdomain[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 commands=5
+May 18 16:08:35 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: processing time: 0.348 seconds (0.334, 0.007, 0)
+May 18 16:08:35 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (32031E5EC296E2C5FFB); from=<mailtestsender.good at proxtest.com> to=<ferdl at example.proxmox.com> proto=ESMTP helo=<localhost.localdomain>
+May 18 16:08:35 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
+May 18 16:08:35 pmg-demo postfix/smtp[17728]: 264C33209E0: to=<ceo at example.proxmox.com>, relay=192.168.30.48[192.168.30.48]:25, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 2749D10162E)
+May 18 16:08:35 pmg-demo postfix/qmgr[1097]: 264C33209E0: removed
+
+May 18 16:09:39 pmg-demo postfix/postscreen[16981]: CONNECT from [192.168.30.128]:53184 to [192.168.30.128]:25
+May 18 16:09:39 pmg-demo postfix/postscreen[16981]: WHITELISTED [192.168.30.128]:53184
+May 18 16:09:39 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
+May 18 16:09:39 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
+May 18 16:09:39 pmg-demo pmg-smtp-filter[17729]: 2020/05/18-16:09:39 CONNECT TCP Peer: "[127.0.0.1]:50236" Local: "[127.0.0.1]:10024"
+May 18 16:09:39 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: new mail message-id=
+May 18 16:09:40 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: SA score=1/5 time=1.372 bayes=undefined autolearn=no autolearn_force=no hits=ALL_TRUSTED(-1),AWL(-0.377),DKIM_ADSP_NXDOMAIN(0.8),KAM_DMARC_STATUS(0.01),KAM_NUMSUBJECT(0.5),MISSING_DATE(1.396),MISSING_MID(0.14),NO_DNS_FOR_FROM(0.379)
+May 18 16:09:40 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: block mail to <ferdl at example.proxmox.com> (rule: block-ferdl)
+May 18 16:09:40 pmg-demo postfix/smtpd[17725]: connect from localhost.localdomain[127.0.0.1]
+May 18 16:09:40 pmg-demo postfix/smtpd[17725]: 86D0C3209DE: client=localhost.localdomain[127.0.0.1], orig_client=pmg-demo.proxmox.com[192.168.30.128]
+May 18 16:09:40 pmg-demo postfix/cleanup[17727]: 86D0C3209DE: message-id=<20200518140940.86D0C3209DE at pmg-demo.proxmox.com>
+May 18 16:09:40 pmg-demo postfix/qmgr[1097]: 86D0C3209DE: from=<mailtestsender.good at proxtest.com>, size=2932, nrcpt=1 (queue active)
+May 18 16:09:40 pmg-demo postfix/smtpd[17725]: disconnect from localhost.localdomain[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 commands=5
+May 18 16:09:40 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: accept mail to <ceo at example.proxmox.com> (86D0C3209DE) (rule: default-accept)
+May 18 16:09:40 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: processing time: 1.391 seconds (1.372, 0.01, 0)
+May 18 16:09:40 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (32031E5EC29723280EB); from=<mailtestsender.good at proxtest.com> to=<ceo at example.proxmox.com> proto=ESMTP helo=<localhost.localdomain>
+May 18 16:09:40 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
+May 18 16:09:40 pmg-demo postfix/smtp[17728]: 86D0C3209DE: to=<ceo at example.proxmox.com>, relay=192.168.30.48[192.168.30.48]:25, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 87BEF10E1B3)
+May 18 16:09:40 pmg-demo postfix/qmgr[1097]: 86D0C3209DE: removed
diff --git a/tests/test_output_before_queue_to_search_string b/tests/test_output_before_queue_to_search_string
new file mode 100644
index 0000000..5fe963a
--- /dev/null
+++ b/tests/test_output_before_queue_to_search_string
@@ -0,0 +1,101 @@
+# LogReader: 12864
+# Query options
+# Recipient: ferdl@
+# Match: ferdl@
+# Start: 2020-05-18 15:55:00 (1589817300)
+# End: 2020-05-18 16:10:00 (1589818200)
+# End Query Options
+
+SMTPD: T5EC2B077L00000002
+CTIME: 5EC2B077
+CLIENT: pmg-demo.proxmox.com[192.168.30.128]
+TO:5EC2B077:T5EC2B077L00000002:B: from <mailtestsender.bad at proxtest.com> to <ferdl at example.proxmox.com>
+LOGS:
+L00000003 May 18 15:57:43 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
+L00000004 May 18 15:57:43 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
+L00000006 May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: new mail message-id=
+L00000007 May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: SA score=1001/5 time=0.288 bayes=undefined autolearn=no autolearn_force=no hits=ALL_TRUSTED(-1),AWL(-0.397),DKIM_ADSP_NXDOMAIN(0.8),GTUBE(1000),KAM_DMARC_STATUS(0.01),KAM_NUMSUBJECT(0.5),MISSING_DATE(1.396),MISSING_MID(0.14),NO_DNS_FOR_FROM(0.379)
+L00000008 May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: block mail to <ferdl at example.proxmox.com> (rule: block-ferdl)
+L00000009 May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: moved mail for <ceo at example.proxmox.com> to spam quarantine - 3209E25EC29457CC507 (rule: Quarantine/Mark Spam (Level 3))
+L0000000A May 18 15:57:43 pmg-demo pmg-smtp-filter[17051]: 3204C55EC294578338F: processing time: 0.302 seconds (0.288, 0.007, 0)
+L0000000B May 18 15:57:43 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (3204C55EC294578338F); from=<mailtestsender.bad at proxtest.com> to=<ceo at example.proxmox.com> proto=ESMTP helo=<localhost.localdomain>
+L0000000C May 18 15:57:43 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
+
+QENTRY: 6B2CD3209E0
+CTIME: 5EC2B1EB
+SIZE: 2342
+CLIENT: localhost.localdomain[127.0.0.1],
+MSGID: <20200518140355.6B2CD3209E0 at pmg-demo.proxmox.com>
+TO:5EC2B1EB:6B2CD3209E0:B: from <mailtestsender.good at proxtest.com> to <ferdl at example.proxmox.com> (none)
+SMTP:
+L00000024 May 18 16:03:55 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
+L00000025 May 18 16:03:55 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
+L0000002A May 18 16:03:55 pmg-demo postfix/smtpd[17725]: connect from localhost.localdomain[127.0.0.1]
+L0000002B May 18 16:03:55 pmg-demo postfix/smtpd[17725]: 6B2CD3209E0: client=localhost.localdomain[127.0.0.1], orig_client=pmg-demo.proxmox.com[192.168.30.128]
+L0000002D May 18 16:03:55 pmg-demo postfix/smtpd[17725]: disconnect from localhost.localdomain[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 commands=5
+L00000031 May 18 16:03:55 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (3204C55EC295CB131DB); from=<mailtestsender.good at proxtest.com> to=<ferdl at example.proxmox.com> proto=ESMTP helo=<localhost.localdomain>
+L00000032 May 18 16:03:55 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
+FILTER: 3204C55EC295CB131DB
+L00000027 May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: new mail message-id=
+L00000028 May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: SA score=1/5 time=0.347 bayes=undefined autolearn=no autolearn_force=no hits=ALL_TRUSTED(-1),AWL(-0.377),DKIM_ADSP_NXDOMAIN(0.8),KAM_DMARC_STATUS(0.01),KAM_NUMSUBJECT(0.5),MISSING_DATE(1.396),MISSING_MID(0.14),NO_DNS_FOR_FROM(0.379)
+L00000029 May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: block mail to <ferdl at example.proxmox.com> (rule: block-ferdl)
+L0000002F May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: accept mail to <office at example.proxmox.com> (6B2CD3209E0) (rule: default-accept)
+L00000030 May 18 16:03:55 pmg-demo pmg-smtp-filter[17729]: 3204C55EC295CB131DB: processing time: 0.362 seconds (0.347, 0.008, 0)
+QMGR:
+L0000002C May 18 16:03:55 pmg-demo postfix/cleanup[17727]: 6B2CD3209E0: message-id=<20200518140355.6B2CD3209E0 at pmg-demo.proxmox.com>
+L0000002E May 18 16:03:55 pmg-demo postfix/qmgr[1097]: 6B2CD3209E0: from=<mailtestsender.good at proxtest.com>, size=2342, nrcpt=1 (queue active)
+L00000033 May 18 16:03:55 pmg-demo postfix/smtp[17728]: 6B2CD3209E0: to=<office at example.proxmox.com>, relay=192.168.30.48[192.168.30.48]:25, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 6C1DE10162E)
+L00000034 May 18 16:03:55 pmg-demo postfix/qmgr[1097]: 6B2CD3209E0: removed
+
+QENTRY: 264C33209E0
+CTIME: 5EC2B303
+SIZE: 2339
+CLIENT: localhost.localdomain[127.0.0.1],
+MSGID: <20200518140835.264C33209E0 at pmg-demo.proxmox.com>
+TO:5EC2B303:264C33209E0:B: from <mailtestsender.good at proxtest.com> to <ferdl at example.proxmox.com> (none)
+SMTP:
+L00000037 May 18 16:08:34 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
+L00000038 May 18 16:08:34 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
+L0000003D May 18 16:08:35 pmg-demo postfix/smtpd[17725]: connect from localhost.localdomain[127.0.0.1]
+L0000003E May 18 16:08:35 pmg-demo postfix/smtpd[17725]: 264C33209E0: client=localhost.localdomain[127.0.0.1], orig_client=pmg-demo.proxmox.com[192.168.30.128]
+L00000042 May 18 16:08:35 pmg-demo postfix/smtpd[17725]: disconnect from localhost.localdomain[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 commands=5
+L00000044 May 18 16:08:35 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (32031E5EC296E2C5FFB); from=<mailtestsender.good at proxtest.com> to=<ferdl at example.proxmox.com> proto=ESMTP helo=<localhost.localdomain>
+L00000045 May 18 16:08:35 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
+FILTER: 32031E5EC296E2C5FFB
+L0000003A May 18 16:08:34 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: new mail message-id=
+L0000003B May 18 16:08:35 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: SA score=1/5 time=0.334 bayes=undefined autolearn=no autolearn_force=no hits=ALL_TRUSTED(-1),AWL(-0.377),DKIM_ADSP_NXDOMAIN(0.8),KAM_DMARC_STATUS(0.01),KAM_NUMSUBJECT(0.5),MISSING_DATE(1.396),MISSING_MID(0.14),NO_DNS_FOR_FROM(0.379)
+L0000003C May 18 16:08:35 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: block mail to <ferdl at example.proxmox.com> (rule: block-ferdl)
+L00000041 May 18 16:08:35 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: accept mail to <ceo at example.proxmox.com> (264C33209E0) (rule: default-accept)
+L00000043 May 18 16:08:35 pmg-demo pmg-smtp-filter[17740]: 32031E5EC296E2C5FFB: processing time: 0.348 seconds (0.334, 0.007, 0)
+QMGR:
+L0000003F May 18 16:08:35 pmg-demo postfix/cleanup[17727]: 264C33209E0: message-id=<20200518140835.264C33209E0 at pmg-demo.proxmox.com>
+L00000040 May 18 16:08:35 pmg-demo postfix/qmgr[1097]: 264C33209E0: from=<mailtestsender.good at proxtest.com>, size=2339, nrcpt=1 (queue active)
+L00000046 May 18 16:08:35 pmg-demo postfix/smtp[17728]: 264C33209E0: to=<ceo at example.proxmox.com>, relay=192.168.30.48[192.168.30.48]:25, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 2749D10162E)
+L00000047 May 18 16:08:35 pmg-demo postfix/qmgr[1097]: 264C33209E0: removed
+
+QENTRY: 86D0C3209DE
+CTIME: 5EC2B344
+SIZE: 2932
+CLIENT: localhost.localdomain[127.0.0.1],
+MSGID: <20200518140940.86D0C3209DE at pmg-demo.proxmox.com>
+TO:5EC2B344:86D0C3209DE:B: from <mailtestsender.good at proxtest.com> to <ferdl at example.proxmox.com> (none)
+SMTP:
+L0000004A May 18 16:09:39 pmg-demo postfix/smtpd[16982]: connect from pmg-demo.proxmox.com[192.168.30.128]
+L0000004B May 18 16:09:39 pmg-demo postfix/smtpd[16982]: NOQUEUE: client=pmg-demo.proxmox.com[192.168.30.128]
+L00000050 May 18 16:09:40 pmg-demo postfix/smtpd[17725]: connect from localhost.localdomain[127.0.0.1]
+L00000051 May 18 16:09:40 pmg-demo postfix/smtpd[17725]: 86D0C3209DE: client=localhost.localdomain[127.0.0.1], orig_client=pmg-demo.proxmox.com[192.168.30.128]
+L00000054 May 18 16:09:40 pmg-demo postfix/smtpd[17725]: disconnect from localhost.localdomain[127.0.0.1] ehlo=1 xforward=1 mail=1 rcpt=1 data=1 commands=5
+L00000057 May 18 16:09:40 pmg-demo postfix/smtpd[16982]: proxy-accept: END-OF-MESSAGE: 250 2.5.0 OK (32031E5EC29723280EB); from=<mailtestsender.good at proxtest.com> to=<ceo at example.proxmox.com> proto=ESMTP helo=<localhost.localdomain>
+L00000058 May 18 16:09:40 pmg-demo postfix/smtpd[16982]: disconnect from pmg-demo.proxmox.com[192.168.30.128] ehlo=1 mail=1 rcpt=2 data=1 commands=5
+FILTER: 32031E5EC29723280EB
+L0000004D May 18 16:09:39 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: new mail message-id=
+L0000004E May 18 16:09:40 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: SA score=1/5 time=1.372 bayes=undefined autolearn=no autolearn_force=no hits=ALL_TRUSTED(-1),AWL(-0.377),DKIM_ADSP_NXDOMAIN(0.8),KAM_DMARC_STATUS(0.01),KAM_NUMSUBJECT(0.5),MISSING_DATE(1.396),MISSING_MID(0.14),NO_DNS_FOR_FROM(0.379)
+L0000004F May 18 16:09:40 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: block mail to <ferdl at example.proxmox.com> (rule: block-ferdl)
+L00000055 May 18 16:09:40 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: accept mail to <ceo at example.proxmox.com> (86D0C3209DE) (rule: default-accept)
+L00000056 May 18 16:09:40 pmg-demo pmg-smtp-filter[17729]: 32031E5EC29723280EB: processing time: 1.391 seconds (1.372, 0.01, 0)
+QMGR:
+L00000052 May 18 16:09:40 pmg-demo postfix/cleanup[17727]: 86D0C3209DE: message-id=<20200518140940.86D0C3209DE at pmg-demo.proxmox.com>
+L00000053 May 18 16:09:40 pmg-demo postfix/qmgr[1097]: 86D0C3209DE: from=<mailtestsender.good at proxtest.com>, size=2932, nrcpt=1 (queue active)
+L00000059 May 18 16:09:40 pmg-demo postfix/smtp[17728]: 86D0C3209DE: to=<ceo at example.proxmox.com>, relay=192.168.30.48[192.168.30.48]:25, delay=0.01, delays=0/0/0/0.01, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 87BEF10E1B3)
+L0000005A May 18 16:09:40 pmg-demo postfix/qmgr[1097]: 86D0C3209DE: removed
+
diff --git a/tests/tests_before_queue.rs b/tests/tests_before_queue.rs
index e654cab..128ffad 100644
--- a/tests/tests_before_queue.rs
+++ b/tests/tests_before_queue.rs
@@ -227,3 +227,28 @@ fn before_queue_mixed_accept_block_quarantine() {
let output_reader = BufReader::new(&output.stdout[..]);
utils::compare_output(output_reader, expected_output);
}
+
+#[test]
+fn before_queue_to_search_string() {
+ let output = Command::new(utils::log_tracker_path())
+ .arg("-vv")
+ .arg("-s")
+ .arg("1589810100")
+ .arg("-e")
+ .arg("1589812000")
+ .arg("-i")
+ .arg("tests/test_input_before_queue_to_search_string")
+ .arg("-t")
+ .arg("ferdl at example.proxmox.com")
+ .arg("-x")
+ .arg("ferdl at example.proxmox.com")
+ .output()
+ .expect("failed to execute pmg-log-tracker");
+
+ let expected_file = File::open("tests/test_output_before_queue_to_search_string")
+ .expect("failed to open test_output");
+
+ let expected_output = BufReader::new(&expected_file);
+ let output_reader = BufReader::new(&output.stdout[..]);
+ utils::compare_output(output_reader, expected_output);
+}
--
2.20.1
More information about the pmg-devel
mailing list