diff options
author | Andrew Lewis <nerf@judo.za.org> | 2017-12-08 15:40:21 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2017-12-08 15:40:21 +0200 |
commit | 03cf7aff97c45a3fdbae75da0d7596cef9578a81 (patch) | |
tree | c6e6c356b44b8b78e44692d18c46d2ed13ca19fa /test | |
parent | 09f3015da643b82e24b054f1704aa6783bfc79e8 (diff) | |
download | rspamd-03cf7aff97c45a3fdbae75da0d7596cef9578a81.tar.gz rspamd-03cf7aff97c45a3fdbae75da0d7596cef9578a81.zip |
[Test] Redis key expansion & antivirus ordered patterns
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/cases/102_multimap.robot | 9 | ||||
-rw-r--r-- | test/functional/cases/160_antivirus.robot | 14 | ||||
-rw-r--r-- | test/functional/configs/antivirus.conf | 15 | ||||
-rw-r--r-- | test/functional/configs/multimap.conf | 16 | ||||
-rw-r--r-- | test/functional/lib/vars.py | 1 | ||||
-rwxr-xr-x | test/functional/util/dummy_fprot.py | 5 |
6 files changed, 56 insertions, 4 deletions
diff --git a/test/functional/cases/102_multimap.robot b/test/functional/cases/102_multimap.robot index 977a84991..569f75e3b 100644 --- a/test/functional/cases/102_multimap.robot +++ b/test/functional/cases/102_multimap.robot @@ -148,6 +148,15 @@ MAP - REDIS - HOSTNAME MISS ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname rspamd.com Check Rspamc ${result} REDIS_HOSTNAME inverse=1 +MAP - REDIS - HOSTNAME - EXPANSION - HIT + Redis HSET 127.0.0.1.foo.com redistest.example.net ${EMPTY} + ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname redistest.example.net --rcpt bob@foo.com + Check Rspamc ${result} REDIS_HOSTNAME_EXPANSION + +MAP - REDIS - HOSTNAME - EXPANSION - MISS + ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname redistest.example.net --rcpt bob@bar.com + Check Rspamc ${result} REDIS_HOSTNAME_EXPANSION inverse=1 + MAP - REDIS - IP Redis HSET ipaddr 127.0.0.1 ${EMPTY} ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 diff --git a/test/functional/cases/160_antivirus.robot b/test/functional/cases/160_antivirus.robot index ec43329e3..edc063445 100644 --- a/test/functional/cases/160_antivirus.robot +++ b/test/functional/cases/160_antivirus.robot @@ -44,14 +44,22 @@ FPROT MISS FPROT HIT - PATTERN Run Dummy Fprot ${PORT_FPROT} 1 + Run Dummy Fprot ${PORT_FPROT_DUPLICATE} 1 /tmp/dummy_fprot_dupe.pid ${result} = Scan Message With Rspamc ${MESSAGE} Check Rspamc ${result} FPROT_EICAR (1.00)[EICAR_Test_File] Should Not Contain ${result.stdout} CLAMAV_VIRUS + # Also check ordered pattern match + Should Contain ${result.stdout} FPROT_VIRUS_DUPLICATE_PATTERN + Should Not Contain ${result.stdout} FPROT_VIRUS_DUPLICATE_DEFAULT + Should Not Contain ${result.stdout} FPROT_VIRUS_DUPLICATE_NOPE FPROT CACHE HIT ${result} = Scan Message With Rspamc ${MESSAGE} Check Rspamc ${result} FPROT_EICAR (1.00)[EICAR_Test_File] Should Not Contain ${result.stdout} CLAMAV_VIRUS + # Also check ordered pattern match + Should Contain ${result.stdout} FPROT_VIRUS_DUPLICATE_PATTERN + Should Not Contain ${result.stdout} FPROT_VIRUS_DUPLICATE_DEFAULT FPROT CACHE MISS ${result} = Scan Message With Rspamc ${MESSAGE2} @@ -74,6 +82,6 @@ Run Dummy Clam Wait Until Created /tmp/dummy_clamav.pid Run Dummy Fprot - [Arguments] ${port} ${found}= - ${result} = Start Process ${TESTDIR}/util/dummy_fprot.py ${port} ${found} - Wait Until Created /tmp/dummy_fprot.pid + [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_fprot.pid + ${result} = Start Process ${TESTDIR}/util/dummy_fprot.py ${port} ${found} ${pid} + Wait Until Created ${pid} diff --git a/test/functional/configs/antivirus.conf b/test/functional/configs/antivirus.conf index a4b0739aa..432d9a2de 100644 --- a/test/functional/configs/antivirus.conf +++ b/test/functional/configs/antivirus.conf @@ -17,4 +17,19 @@ antivirus { FPROT_EICAR = "^EICAR_Test_File$"; } } + fprot_duplicate { + prefix = "fp_dupe"; + attachments_only = false; + symbol = "FPROT_VIRUS_DUPLICATE_DEFAULT"; + type = "fprot"; + servers = "127.0.0.1:${PORT_FPROT_DUPLICATE}"; + patterns = [ + {FPROT_VIRUS_DUPLICATE_PATTERN = "^E"}, + {FPROT_VIRUS_DUPLICATE_NOPE1 = "^EI", + FPROT_VIRUS_DUPLICATE_NOPE2 = "^EIC", + FPROT_VIRUS_DUPLICATE_NOPE3 = "^EICA", + FPROT_VIRUS_DUPLICATE_NOPE4 = "^EICAR", + FPROT_VIRUS_DUPLICATE_NOPE5 = "^EICAR_"} + ]; + } } diff --git a/test/functional/configs/multimap.conf b/test/functional/configs/multimap.conf index 1c262a287..28d84f38e 100644 --- a/test/functional/configs/multimap.conf +++ b/test/functional/configs/multimap.conf @@ -2,6 +2,7 @@ asn { } redis { servers = "${REDIS_ADDR}:${REDIS_PORT}"; + expand_keys = true; } multimap { DNSBL_MAP { @@ -65,6 +66,10 @@ multimap { type = "hostname"; map = "redis://hostname"; } + REDIS_HOSTNAME_EXPANSION { + type = "hostname"; + map = "redis://\${ip}.\${principal_recipient_domain}"; + } REDIS_IPADDR { type = "ip"; map = "redis://ipaddr"; @@ -136,4 +141,15 @@ multimap { type = "received"; map = "redis://RCVD_TEST"; } + RCVD_AUTHED_ONE { + type = "received"; + map = "${TESTDIR}/configs/maps/rcvd2.list"; + flags = ["authenticated"]; + nflags = ["ssl"]; + } + RCVD_AUTHED_TWO { + type = "received"; + map = "${TESTDIR}/configs/maps/rcvd2.list"; + flags = ["authenticated", "ssl"]; + } } diff --git a/test/functional/lib/vars.py b/test/functional/lib/vars.py index f053422d1..07ac9889d 100644 --- a/test/functional/lib/vars.py +++ b/test/functional/lib/vars.py @@ -14,6 +14,7 @@ PORT_NORMAL_SLAVE = 56794 PORT_PROXY = 56795 PORT_CLAM = 56796 PORT_FPROT = 56797 +PORT_FPROT_DUPLICATE = 56798 REDIS_ADDR = u'127.0.0.1' REDIS_PORT = 56379 RSPAMD_GROUP = 'nogroup' diff --git a/test/functional/util/dummy_fprot.py b/test/functional/util/dummy_fprot.py index 082934f4d..3bcdb7292 100755 --- a/test/functional/util/dummy_fprot.py +++ b/test/functional/util/dummy_fprot.py @@ -32,7 +32,10 @@ if __name__ == "__main__": alen = len(sys.argv) if alen > 1: port = int(sys.argv[1]) - if alen >= 3: + if alen >= 4: + PID = sys.argv[3] + foundvirus = bool(sys.argv[2]) + elif alen >= 3: foundvirus = bool(sys.argv[2]) else: foundvirus = False |