From 5f7dd6e1f27ebec013ed74865f9c1873414380cb Mon Sep 17 00:00:00 2001 From: Andrew Lewis Date: Tue, 11 May 2021 13:50:29 +0200 Subject: [Test] Merge test suites; use settings --- test/functional/cases/001_merged/100_general.robot | 51 ++ test/functional/cases/001_merged/101_lua.robot | 41 + .../functional/cases/001_merged/102_multimap.robot | 402 +++++++++ .../functional/cases/001_merged/104_get_from.robot | 57 ++ .../cases/001_merged/105_mimetypes.robot | 74 ++ test/functional/cases/001_merged/106_mid.robot | 36 + .../functional/cases/001_merged/114_phishing.robot | 26 + test/functional/cases/001_merged/115_dmarc.robot | 101 +++ test/functional/cases/001_merged/117_spf.robot | 157 ++++ .../cases/001_merged/160_antivirus.robot | 149 ++++ test/functional/cases/001_merged/220_http.robot | 77 ++ test/functional/cases/001_merged/230_tcp.robot | 72 ++ .../functional/cases/001_merged/231_tcp_down.robot | 21 + test/functional/cases/001_merged/240_redis.robot | 16 + test/functional/cases/001_merged/250_dns.robot | 21 + .../functional/cases/001_merged/270_selector.robot | 15 + test/functional/cases/001_merged/280_rules.robot | 125 +++ test/functional/cases/001_merged/281_fnames.robot | 13 + .../functional/cases/001_merged/290_greylist.robot | 25 + test/functional/cases/001_merged/300_rbl.robot | 77 ++ test/functional/cases/001_merged/310_udp.robot | 40 + .../cases/001_merged/321_arc_check.robot | 19 + test/functional/cases/001_merged/340_surbl.robot | 182 +++++ test/functional/cases/001_merged/350_magic.robot | 66 ++ test/functional/cases/001_merged/__init__.robot | 14 + test/functional/cases/100_general.robot | 50 -- test/functional/cases/101_lua.robot | 58 -- test/functional/cases/102_multimap.robot | 337 -------- test/functional/cases/104_get_from.robot | 52 -- test/functional/cases/105_mimetypes.robot | 66 -- test/functional/cases/106_mid.robot | 36 - test/functional/cases/114_phishing.robot | 27 - test/functional/cases/115_dmarc.robot | 88 -- test/functional/cases/117_spf.robot | 137 ---- test/functional/cases/160_antivirus.robot | 142 ---- test/functional/cases/220_http.robot | 68 -- test/functional/cases/230_tcp.robot | 72 -- test/functional/cases/231_tcp_down.robot | 31 - test/functional/cases/240_redis.robot | 26 - test/functional/cases/241_redis_is_dead.robot | 1 - test/functional/cases/250_dns.robot | 25 - test/functional/cases/260_regex.robot | 5 + test/functional/cases/270_selector.robot | 21 - test/functional/cases/280_rules.robot | 116 --- test/functional/cases/281_fnames.robot | 19 - test/functional/cases/290_greylist.robot | 27 - test/functional/cases/300_rbl.robot | 70 -- test/functional/cases/310_udp.robot | 42 - test/functional/cases/321_arc_check.robot | 21 - test/functional/cases/340_surbl.robot | 162 ---- test/functional/cases/350_magic.robot | 71 -- test/functional/configs/antivirus.conf | 43 - test/functional/configs/arc.conf | 3 - test/functional/configs/dmarc.conf | 8 - test/functional/configs/greylist.conf | 13 - test/functional/configs/merged-local.conf | 905 +++++++++++++++++++++ test/functional/configs/merged-override.conf | 391 +++++++++ test/functional/configs/merged.conf | 41 + test/functional/configs/mid.conf | 11 - test/functional/configs/mime_types.conf | 21 - test/functional/configs/multimap.conf | 216 ----- test/functional/configs/phishing.conf | 13 - test/functional/configs/rbl.conf | 77 -- test/functional/configs/selector.conf | 10 - test/functional/configs/surbl.conf | 93 --- test/functional/lib/rspamd.robot | 5 + test/functional/lua/get_from.lua | 8 +- test/functional/lua/http.lua | 6 +- test/functional/lua/maps_kv.lua | 6 +- 69 files changed, 3235 insertions(+), 2282 deletions(-) create mode 100644 test/functional/cases/001_merged/100_general.robot create mode 100644 test/functional/cases/001_merged/101_lua.robot create mode 100644 test/functional/cases/001_merged/102_multimap.robot create mode 100644 test/functional/cases/001_merged/104_get_from.robot create mode 100644 test/functional/cases/001_merged/105_mimetypes.robot create mode 100644 test/functional/cases/001_merged/106_mid.robot create mode 100644 test/functional/cases/001_merged/114_phishing.robot create mode 100644 test/functional/cases/001_merged/115_dmarc.robot create mode 100644 test/functional/cases/001_merged/117_spf.robot create mode 100644 test/functional/cases/001_merged/160_antivirus.robot create mode 100644 test/functional/cases/001_merged/220_http.robot create mode 100644 test/functional/cases/001_merged/230_tcp.robot create mode 100644 test/functional/cases/001_merged/231_tcp_down.robot create mode 100644 test/functional/cases/001_merged/240_redis.robot create mode 100644 test/functional/cases/001_merged/250_dns.robot create mode 100644 test/functional/cases/001_merged/270_selector.robot create mode 100644 test/functional/cases/001_merged/280_rules.robot create mode 100644 test/functional/cases/001_merged/281_fnames.robot create mode 100644 test/functional/cases/001_merged/290_greylist.robot create mode 100644 test/functional/cases/001_merged/300_rbl.robot create mode 100644 test/functional/cases/001_merged/310_udp.robot create mode 100644 test/functional/cases/001_merged/321_arc_check.robot create mode 100644 test/functional/cases/001_merged/340_surbl.robot create mode 100644 test/functional/cases/001_merged/350_magic.robot create mode 100644 test/functional/cases/001_merged/__init__.robot delete mode 100644 test/functional/cases/100_general.robot delete mode 100644 test/functional/cases/102_multimap.robot delete mode 100644 test/functional/cases/104_get_from.robot delete mode 100644 test/functional/cases/105_mimetypes.robot delete mode 100644 test/functional/cases/106_mid.robot delete mode 100644 test/functional/cases/114_phishing.robot delete mode 100644 test/functional/cases/115_dmarc.robot delete mode 100644 test/functional/cases/117_spf.robot delete mode 100644 test/functional/cases/160_antivirus.robot delete mode 100644 test/functional/cases/220_http.robot delete mode 100644 test/functional/cases/230_tcp.robot delete mode 100644 test/functional/cases/231_tcp_down.robot delete mode 100644 test/functional/cases/240_redis.robot delete mode 100644 test/functional/cases/250_dns.robot delete mode 100644 test/functional/cases/270_selector.robot delete mode 100644 test/functional/cases/280_rules.robot delete mode 100644 test/functional/cases/281_fnames.robot delete mode 100644 test/functional/cases/290_greylist.robot delete mode 100644 test/functional/cases/300_rbl.robot delete mode 100644 test/functional/cases/310_udp.robot delete mode 100644 test/functional/cases/321_arc_check.robot delete mode 100644 test/functional/cases/340_surbl.robot delete mode 100644 test/functional/cases/350_magic.robot delete mode 100644 test/functional/configs/antivirus.conf delete mode 100644 test/functional/configs/arc.conf delete mode 100644 test/functional/configs/dmarc.conf delete mode 100644 test/functional/configs/greylist.conf create mode 100644 test/functional/configs/merged-local.conf create mode 100644 test/functional/configs/merged-override.conf create mode 100644 test/functional/configs/merged.conf delete mode 100644 test/functional/configs/mid.conf delete mode 100644 test/functional/configs/mime_types.conf delete mode 100644 test/functional/configs/multimap.conf delete mode 100644 test/functional/configs/phishing.conf delete mode 100644 test/functional/configs/rbl.conf delete mode 100644 test/functional/configs/selector.conf delete mode 100644 test/functional/configs/surbl.conf (limited to 'test') diff --git a/test/functional/cases/001_merged/100_general.robot b/test/functional/cases/001_merged/100_general.robot new file mode 100644 index 000000000..b06dd1492 --- /dev/null +++ b/test/functional/cases/001_merged/100_general.robot @@ -0,0 +1,51 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${GTUBE} ${RSPAMD_TESTDIR}/messages/gtube.eml +${SETTINGS_NOSYMBOLS} {symbols_enabled = []} + +*** Test Cases *** +GTUBE + Scan File ${GTUBE} + ... Settings=${SETTINGS_NOSYMBOLS} + Expect Symbol GTUBE + +GTUBE - Encrypted + ${result} = Run Rspamc -p -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_NORMAL} --key ${RSPAMD_KEY_PUB1} + ... ${GTUBE} --header=Settings=${SETTINGS_NOSYMBOLS} + Check Rspamc ${result} GTUBE ( + +GTUBE - Scan File feature + Scan File By Reference ${GTUBE} + ... Settings=${SETTINGS_NOSYMBOLS} + Expect Symbol GTUBE + +GTUBE - Scan File feature (encoded) + ${encoded} = Encode Filename ${GTUBE} + Scan File By Reference ${encoded} + ... Settings=${SETTINGS_NOSYMBOLS} + Expect Symbol GTUBE + +GTUBE - SPAMC + ${result} = Spamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} ${GTUBE} + Should Contain ${result} GTUBE + +GTUBE - RSPAMC + ${result} = Rspamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} ${GTUBE} + Should Contain ${result} GTUBE + +EMAILS DETECTION 1 + Scan File ${RSPAMD_TESTDIR}/messages/emails1.eml + ... URL-Format=Extended Settings=${SETTINGS_NOSYMBOLS} + Expect Email jim@example.net + Expect Email bob@example.net + Expect Email rupert@example.net + +EMAILS DETECTION ZEROFONT + Scan File ${RSPAMD_TESTDIR}/messages/zerofont.eml + ... Settings={symbols_enabled = [MANY_INVISIBLE_PARTS, ZERO_FONT]} + Expect Symbol MANY_INVISIBLE_PARTS + Expect Symbol ZERO_FONT diff --git a/test/functional/cases/001_merged/101_lua.robot b/test/functional/cases/001_merged/101_lua.robot new file mode 100644 index 000000000..23637396a --- /dev/null +++ b/test/functional/cases/001_merged/101_lua.robot @@ -0,0 +1,41 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RSPAMD_MAP_MAP} ${RSPAMD_TESTDIR}/configs/maps/map.list +${RSPAMD_RADIX_MAP} ${RSPAMD_TESTDIR}/configs/maps/ip2.list +${RSPAMD_REGEXP_MAP} ${RSPAMD_TESTDIR}/configs/maps/regexp.list + +*** Test Cases *** +Recipient Parsing Sanity + Scan File ${MESSAGE} Rcpt=rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar + ... Settings={symbols_enabled = [TEST_RCPT]} + Expect Symbol With Exact Options TEST_RCPT rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar + +TLD parts + Scan File ${MESSAGE} Settings={symbols_enabled = [TEST_TLD]} + Expect Symbol With Exact Options TEST_TLD no worry + +Hashes + Scan File ${MESSAGE} Settings={symbols_enabled = [TEST_HASHES]} + Expect Symbol With Exact Options TEST_HASHES no worry + +Maps Key Values + Scan File ${MESSAGE} Settings={symbols_enabled = [RADIX_KV, REGEXP_KV, MAP_KV]} + Expect Symbol With Exact Options RADIX_KV no worry + Expect Symbol With Exact Options REGEXP_KV no worry + Expect Symbol With Exact Options MAP_KV no worry + +Option Order + Scan File ${MESSAGE} Settings={symbols_enabled = [OPTION_ORDER, TBL_OPTION_ORDER]} + Expect Symbol With Exact Options OPTION_ORDER one two three 4 5 a + Expect Symbol With Exact Options TBL_OPTION_ORDER one two three 4 5 a + +Rule conditions + Scan File ${MESSAGE} Settings={symbols_enabled = [ANY_A]} + Expect Symbol With Option ANY_A hello3 + Expect Symbol With Option ANY_A hello1 + Expect Symbol With Option ANY_A hello2 diff --git a/test/functional/cases/001_merged/102_multimap.robot b/test/functional/cases/001_merged/102_multimap.robot new file mode 100644 index 000000000..fcd75a8bc --- /dev/null +++ b/test/functional/cases/001_merged/102_multimap.robot @@ -0,0 +1,402 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${FREEMAIL_CC} ${RSPAMD_TESTDIR}/messages/freemailcc.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RCVD1} ${RSPAMD_TESTDIR}/messages/received1.eml +${RCVD2} ${RSPAMD_TESTDIR}/messages/received2.eml +${RCVD3} ${RSPAMD_TESTDIR}/messages/received3.eml +${RCVD4} ${RSPAMD_TESTDIR}/messages/received4.eml +${URL1} ${RSPAMD_TESTDIR}/messages/url1.eml +${URL2} ${RSPAMD_TESTDIR}/messages/url2.eml +${URL3} ${RSPAMD_TESTDIR}/messages/url3.eml +${URL4} ${RSPAMD_TESTDIR}/messages/url4.eml +${URL5} ${RSPAMD_TESTDIR}/messages/url5.eml +${URL_ICS} ${RSPAMD_TESTDIR}/messages/ics.eml +${UTF_MESSAGE} ${RSPAMD_TESTDIR}/messages/utf.eml + +*** Test Cases *** +URL_ICS + Scan File ${URL_ICS} + ... Settings={symbols_enabled = []} + Expect URL test.com + +MAP - DNSBL HIT + Scan File ${MESSAGE} IP=127.0.0.2 + ... Settings={symbols_enabled = [DNSBL_MAP]} + Expect Symbol DNSBL_MAP + +MAP - DNSBL MISS + Scan File ${MESSAGE} IP=127.0.0.1 + ... Settings={symbols_enabled = [DNSBL_MAP]} + Do Not Expect Symbol DNSBL_MAP + +MAP - IP HIT + Scan File ${MESSAGE} IP=127.0.0.1 + ... Settings={symbols_enabled = [IP_MAP]} + Expect Symbol IP_MAP + +MAP - IP MISS + Scan File ${MESSAGE} IP=127.0.0.2 + ... Settings={symbols_enabled = [IP_MAP]} + Do Not Expect Symbol IP_MAP + +MAP - IP MASK + Scan File ${MESSAGE} IP=10.1.0.10 + ... Settings={symbols_enabled = [IP_MAP]} + Expect Symbol IP_MAP + +MAP - IP MASK MISS + Scan File ${MESSAGE} IP=11.1.0.10 + ... Settings={symbols_enabled = [IP_MAP]} + Do Not Expect Symbol IP_MAP + +MAP - IP V6 + Scan File ${MESSAGE} IP=::1 + ... Settings={symbols_enabled = [IP_MAP]} + Expect Symbol IP_MAP + +MAP - IP V6 MISS + Scan File ${MESSAGE} IP=fe80::1 + ... Settings={symbols_enabled = [IP_MAP]} + Do Not Expect Symbol IP_MAP + +MAP - FROM + Scan File ${MESSAGE} From=user@example.com + ... Settings={symbols_enabled = [FROM_MAP]} + Expect Symbol FROM_MAP + +MAP - COMBINED IP MASK FROM + Scan File ${MESSAGE} IP=10.1.0.10 From=user@example.com + ... Settings={symbols_enabled = [COMBINED_MAP_AND, COMBINED_MAP_OR]} + Expect Symbol With Score COMBINED_MAP_AND 10 + Expect Symbol COMBINED_MAP_OR + +MAP - COMBINED IP MASK ONLY + Scan File ${MESSAGE} IP=10.1.0.10 + ... Settings={symbols_enabled = [COMBINED_MAP_AND, COMBINED_MAP_OR]} + Do Not Expect Symbol COMBINED_MAP_AND + Expect Symbol COMBINED_MAP_OR + +MAP - COMBINED FROM ONLY + Scan File ${MESSAGE} From=user@example.com + ... Settings={symbols_enabled = [COMBINED_MAP_AND, COMBINED_MAP_OR]} + Do Not Expect Symbol COMBINED_MAP_AND + Expect Symbol COMBINED_MAP_OR + +MAP - COMBINED MISS + Scan File ${MESSAGE} IP=11.1.0.10 From=user@other.com + ... Settings={symbols_enabled = [COMBINED_MAP_AND, COMBINED_MAP_OR]} + Do Not Expect Symbol COMBINED_MAP_AND + Do Not Expect Symbol COMBINED_MAP_OR + +MAP - FROM MISS + Scan File ${MESSAGE} From=user@other.com + ... Settings={symbols_enabled = [FROM_MAP]} + Do Not Expect Symbol FROM_MAP + +MAP - FROM REGEXP + Scan File ${MESSAGE} From=user123@test.com + ... Settings={symbols_enabled = [REGEXP_MAP]} + Expect Symbol REGEXP_MAP + Scan File ${MESSAGE} From=somebody@example.com + ... Settings={symbols_enabled = [REGEXP_MAP]} + Expect Symbol REGEXP_MAP + +MAP - FROM REGEXP MISS + Scan File ${MESSAGE} From=user@other.org + ... Settings={symbols_enabled = [REGEXP_MAP]} + Do Not Expect Symbol REGEXP_MAP + +MAP - RCPT DOMAIN HIT + Scan File ${MESSAGE} Rcpt=user@example.com + ... Settings={symbols_enabled = [RCPT_DOMAIN]} + Expect Symbol RCPT_DOMAIN + +MAP - RCPT DOMAIN MISS + Scan File ${MESSAGE} Rcpt=example.com@user + ... Settings={symbols_enabled = [RCPT_DOMAIN]} + Do Not Expect Symbol RCPT_DOMAIN + +MAP - RCPT USER HIT + Scan File ${MESSAGE} Rcpt=bob@example.com + ... Settings={symbols_enabled = [RCPT_USER]} + Expect Symbol RCPT_USER + +MAP - RCPT USER MISS + Scan File ${MESSAGE} From=example.com@bob + ... Settings={symbols_enabled = [RCPT_USER]} + Do Not Expect Symbol RCPT_USER + +MAP - DEPENDS HIT + Scan File ${MESSAGE} IP=88.99.142.95 From=user123@rspamd.com + ... Settings={symbols_enabled = [DEPS_MAP,REGEXP_MAP,FROM_MAP,SPF_CHECK]} + Expect Symbol DEPS_MAP + +MAP - DEPENDS MISS + Scan File ${MESSAGE} IP=1.2.3.4 From=user123@rspamd.com + ... Settings={symbols_enabled = [DEPS_MAP,REGEXP_MAP,FROM_MAP,SPF_CHECK]} + Do Not Expect Symbol DEPS_MAP + +MAP - MULSYM PLAIN + Scan File ${MESSAGE} Rcpt=user1@example.com + ... Settings={symbols_enabled = [RCPT_MAP, SYM1]} + Expect Symbol RCPT_MAP + +MAP - MULSYM SCORE + Scan File ${MESSAGE} Rcpt=user2@example.com + ... Settings={symbols_enabled = [RCPT_MAP, SYM1]} + Expect Symbol With Score RCPT_MAP 10.0 + +MAP - MULSYM SYMBOL + Scan File ${MESSAGE} Rcpt=user3@example.com + ... Settings={symbols_enabled = [RCPT_MAP, SYM1]} + Expect Symbol With Score SYM1 1.0 + +MAP - MULSYM SYMBOL MISS + Scan File ${MESSAGE} Rcpt=user4@example.com + ... Settings={symbols_enabled = [RCPT_MAP, SYM1]} + Expect Symbol With Score RCPT_MAP 1.0 + +MAP - MULSYM SYMBOL + SCORE + Scan File ${MESSAGE} Rcpt=user5@example.com + ... Settings={symbols_enabled = [RCPT_MAP, SYM1]} + Expect Symbol With Score SYM1 -10.1 + +MAP - UTF + Scan File ${UTF_MESSAGE} + ... Settings={symbols_enabled = [HEADER_MAP]} + Expect Symbol HEADER_MAP + +MAP - UTF MISS + Scan File ${MESSAGE} + ... Settings={symbols_enabled = [HEADER_MAP]} + Do Not Expect Symbol HEADER_MAP + +MAP - HOSTNAME + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com + ... Settings={symbols_enabled = [HOSTNAME_MAP]} + Expect Symbol HOSTNAME_MAP + +MAP - HOSTNAME MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com + ... Settings={symbols_enabled = [HOSTNAME_MAP]} + Do Not Expect Symbol HOSTNAME_MAP + +MAP - TOP + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.au + ... Settings={symbols_enabled = [HOSTNAME_TOP_MAP]} + Expect Symbol HOSTNAME_TOP_MAP + +MAP - TOP MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.bg + ... Settings={symbols_enabled = [HOSTNAME_TOP_MAP]} + Do Not Expect Symbol HOSTNAME_TOP_MAP + +MAP - CDB - HOSTNAME + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com + ... Settings={symbols_enabled = [CDB_HOSTNAME]} + Expect Symbol CDB_HOSTNAME + +MAP - CDB - HOSTNAME MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com + ... Settings={symbols_enabled = [CDB_HOSTNAME]} + Do Not Expect Symbol CDB_HOSTNAME + +MAP - REDIS - HOSTNAME + Redis HSET hostname redistest.example.net ${EMPTY} + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net + ... Settings={symbols_enabled = [REDIS_HOSTNAME]} + Expect Symbol REDIS_HOSTNAME + +MAP - REDIS - HOSTNAME MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com + ... Settings={symbols_enabled = [REDIS_HOSTNAME]} + Do Not Expect Symbol REDIS_HOSTNAME + +MAP - REDIS - HOSTNAME - EXPANSION - HIT + Redis HSET 127.0.0.1.foo.com redistest.example.net ${EMPTY} + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net Rcpt=bob@foo.com + ... Settings={symbols_enabled = [REDIS_HOSTNAME_EXPANSION]} + Expect Symbol REDIS_HOSTNAME_EXPANSION + +MAP - REDIS - HOSTNAME - EXPANSION - MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net Rcpt=bob@bar.com + ... Settings={symbols_enabled = [REDIS_HOSTNAME_EXPANSION]} + Do Not Expect Symbol REDIS_HOSTNAME_EXPANSION + +MAP - REDIS - IP + Redis HSET ipaddr 127.0.0.1 ${EMPTY} + Scan File ${MESSAGE} IP=127.0.0.1 + ... Settings={symbols_enabled = [REDIS_IPADDR]} + Expect Symbol REDIS_IPADDR + +MAP - REDIS - IP - MISS + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [REDIS_IPADDR]} + Do Not Expect Symbol REDIS_IPADDR + +MAP - REDIS - FROM + Redis HSET emailaddr from@rspamd.tk ${EMPTY} + Scan File ${MESSAGE} From=from@rspamd.tk + ... Settings={symbols_enabled = [REDIS_FROMADDR]} + Expect Symbol REDIS_FROMADDR + +MAP - REDIS - FROM MISS + Scan File ${MESSAGE} From=user@other.com + ... Settings={symbols_enabled = [REDIS_FROMADDR]} + Do Not Expect Symbol REDIS_FROMADDR + +MAP - REDIS - URL TLD - HIT + Redis HSET hostname example.com ${EMPTY} + Scan File ${URL1} + ... Settings={symbols_enabled = [REDIS_URL_TLD]} + Expect Symbol REDIS_URL_TLD + +MAP - REDIS - URL TLD - MISS + Scan File ${URL2} + ... Settings={symbols_enabled = [REDIS_URL_TLD]} + Do Not Expect Symbol REDIS_URL_TLD + +MAP - REDIS - URL RE FULL - HIT + Redis HSET fullurlre html ${EMPTY} + Scan File ${URL2} + ... Settings={symbols_enabled = [REDIS_URL_RE_FULL]} + Expect Symbol REDIS_URL_RE_FULL + +MAP - REDIS - URL RE FULL - MISS + Scan File ${URL1} + ... Settings={symbols_enabled = [REDIS_URL_RE_FULL]} + Do Not Expect Symbol REDIS_URL_RE_FULL + +MAP - REDIS - URL FULL - HIT + Redis HSET fullurl https://www.example.com/foo?a=b ${EMPTY} + Scan File ${URL1} + ... Settings={symbols_enabled = [REDIS_URL_FULL]} + Expect Symbol REDIS_URL_FULL + +MAP - REDIS - URL FULL - MISS + Scan File ${URL2} + ... Settings={symbols_enabled = [REDIS_URL_FULL]} + Do Not Expect Symbol REDIS_URL_FULL + +MAP - REDIS - URL PHISHED - HIT + Redis HSET phishedurl www.rspamd.com ${EMPTY} + Scan File ${URL3} + ... Settings={symbols_enabled = [REDIS_URL_PHISHED]} + Expect Symbol REDIS_URL_PHISHED + +MAP - REDIS - URL PHISHED - MISS + Scan File ${URL4} + ... Settings={symbols_enabled = [REDIS_URL_PHISHED]} + Do Not Expect Symbol REDIS_URL_PHISHED + +MAP - REDIS - URL PLAIN REGEX - HIT + Redis HSET urlre www ${EMPTY} + Scan File ${URL3} + ... Settings={symbols_enabled = [REDIS_URL_RE_PLAIN]} + Expect Symbol REDIS_URL_RE_PLAIN + +MAP - REDIS - URL PLAIN REGEX - MISS + Scan File ${URL4} + ... Settings={symbols_enabled = [REDIS_URL_RE_PLAIN]} + Do Not Expect Symbol REDIS_URL_RE_PLAIN + +MAP - REDIS - URL TLD REGEX - HIT + Redis HSET tldre net ${EMPTY} + Scan File ${URL5} + ... Settings={symbols_enabled = [REDIS_URL_RE_TLD]} + Expect Symbol REDIS_URL_RE_TLD + +MAP - REDIS - URL TLD REGEX - MISS + Scan File ${URL4} + ... Settings={symbols_enabled = [REDIS_URL_RE_TLD]} + Do Not Expect Symbol REDIS_URL_RE_TLD + +MAP - REDIS - URL NOFILTER - HIT + Redis HSET urlnofilter www.example.net ${EMPTY} + Scan File ${URL5} + ... Settings={symbols_enabled = [REDIS_URL_NOFILTER]} + Expect Symbol REDIS_URL_NOFILTER + +MAP - REDIS - URL NOFILTER - MISS + Scan File ${URL4} + ... Settings={symbols_enabled = [REDIS_URL_NOFILTER]} + Do Not Expect Symbol REDIS_URL_NOFILTER + +MAP - REDIS - ASN - HIT + Redis HSET asn 15169 ${EMPTY} + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [REDIS_ASN, ASN_CHECK]} + Expect Symbol REDIS_ASN + +MAP - REDIS - ASN - MISS + Scan File ${MESSAGE} IP=46.228.47.114 + ... Settings={symbols_enabled = [REDIS_ASN, ASN_CHECK]} + Do Not Expect Symbol REDIS_ASN + +MAP - REDIS - CC - HIT + Redis HSET cc US ${EMPTY} + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [REDIS_COUNTRY, ASN_CHECK]} + Expect Symbol REDIS_COUNTRY + +MAP - REDIS - CC - MISS + Scan File ${MESSAGE} IP=46.228.47.114 + ... Settings={symbols_enabled = [REDIS_COUNTRY, ASN_CHECK]} + Do Not Expect Symbol REDIS_COUNTRY + +MAP - REDIS - ASN FILTERED - HIT + Redis HSET asn 1 ${EMPTY} + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [REDIS_ASN_FILTERED, ASN_CHECK]} + Expect Symbol REDIS_ASN_FILTERED + +MAP - REDIS - ASN FILTERED - MISS + Scan File ${MESSAGE} IP=46.228.47.114 + ... Settings={symbols_enabled = [REDIS_ASN_FILTERED, ASN_CHECK]} + Do Not Expect Symbol REDIS_ASN_FILTERED + +MAP - RECEIVED - IP MINMAX POS - ONE + Scan File ${RCVD1} + ... Settings={symbols_enabled = [RCVD_TEST_01, RCVD_TEST02]} + Expect Symbol RCVD_TEST_01 + Do Not Expect Symbol RCVD_TEST_02 + +# Relies on parsing of shitty received +#MAP - RECEIVED - IP MINMAX POS - TWO / RCVD_AUTHED_ONE HIT +# Scan File ${RCVD2} +# Expect Symbol RCVD_TEST_02 +# Do Not Expect Symbol RCVD_TEST_01 +# Expect Symbol RCVD_AUTHED_ONE + +MAP - RECEIVED - REDIS + Redis HSET RCVD_TEST 2a01:7c8:aab6:26d:5054:ff:fed1:1da2 ${EMPTY} + Scan File ${RCVD1} + ... Settings={symbols_enabled = [RCVD_TEST_REDIS_01]} + Expect Symbol RCVD_TEST_REDIS_01 + +RCVD_AUTHED_ONE & RCVD_AUTHED_TWO - MISS + Scan File ${RCVD3} + ... Settings={symbols_enabled = [RCVD_AUTHED_ONE, RCVD_AUTHED_TWO]} + Do Not Expect Symbol RCVD_AUTHED_ONE + Do Not Expect Symbol RCVD_AUTHED_TWO + +RCVD_AUTHED_TWO HIT / RCVD_AUTHED_ONE MISS + Scan File ${RCVD4} + ... Settings={symbols_enabled = [RCVD_AUTHED_ONE, RCVD_AUTHED_TWO]} + Expect Symbol RCVD_AUTHED_TWO + Do Not Expect Symbol RCVD_AUTHED_ONE + +FREEMAIL_CC + Scan File ${FREEMAIL_CC} + ... Settings={symbols_enabled = [FREEMAIL_CC]} + Expect Symbol With Score And Exact Options FREEMAIL_CC 19.00 test.com test1.com test2.com test3.com test4.com test5.com test6.com test7.com test8.com test9.com test10.com test11.com test12.com test13.com test14.com + +MAP - MULTISYMBOL DISABLED + Scan File ${MESSAGE} Rcpt=user3@example.com + ... Settings={symbols_enabled = [RCPT_MAP_NOMULTISYM, SYM1]} + Expect Symbol With Exact Options RCPT_MAP_NOMULTISYM user3@example.com SYM1 diff --git a/test/functional/cases/001_merged/104_get_from.robot b/test/functional/cases/001_merged/104_get_from.robot new file mode 100644 index 000000000..f01119f86 --- /dev/null +++ b/test/functional/cases/001_merged/104_get_from.robot @@ -0,0 +1,57 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${OPTIONS1} ,user@example.org,user,example.org +${OPTIONS2} First Last,user@example.org,user,example.org +${OPTIONS3} First M. Last,user@example.org,user,example.org +${SETTINGS_GETFROM} {symbols_enabled = [${SYMBOL}]} +${SYMBOL} GET_FROM + +*** Test Cases *** +task:get_from('mime') - address only + Scan File ${RSPAMD_TESTDIR}/messages/from/from.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol ${SYMBOL} + +task:get_from('mime') - comment + Scan File ${RSPAMD_TESTDIR}/messages/from/from_comment.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS1} + +task:get_from('mime') - display name + Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2} + +task:get_from('mime') - display name Base64 + Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn_base64.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} Кириллица,user@example.org,user,example.org + +task:get_from('mime') - display name and comment + Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn_comment.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2} + +task:get_from('mime') - quoted display name + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} + +task:get_from('mime') - quoted display name and comment + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_comment.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} + +task:get_from('mime') - quoted in the middle of DN (outer spaces) + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_middle.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} + +task:get_from('mime') - quoted in the middle of DN (inner spaces) + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_middle_inner.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} diff --git a/test/functional/cases/001_merged/105_mimetypes.robot b/test/functional/cases/001_merged/105_mimetypes.robot new file mode 100644 index 000000000..e16150aa8 --- /dev/null +++ b/test/functional/cases/001_merged/105_mimetypes.robot @@ -0,0 +1,74 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_MIMETYPES} {symbols_enabled = [MIME_TYPES_CALLBACK]} + +*** Test Cases *** +Zip + Scan File ${RSPAMD_TESTDIR}/messages/zip.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION exe + +Zip Double Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/zip-doublebad.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_DOUBLE_BAD_EXTENSION .pdf.exe + +Next-to-last Double Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/next2last-doublebad.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_DOUBLE_BAD_EXTENSION .scr.xz + +Date is followed by Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/rar-date-bad-ext.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION scr + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Dotted file name is followed by Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/bad_ext.dotted_file_name.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION exe + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Dotted numbers in parentheses is followed by Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/next2last-digits_in_parens.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION msi + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Dotted numbers in square brackets is followed by Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/next2last-digits_in_brackets.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION msi + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Rar4 + Scan File ${RSPAMD_TESTDIR}/messages/rar4.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION exe + +Cloaked Archive Extension + Scan File ${RSPAMD_TESTDIR}/messages/f.zip.gz.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_ARCHIVE_IN_ARCHIVE .zip.gz zip + +Multipart Archive Extension + Scan File ${RSPAMD_TESTDIR}/messages/f.zip.001.eml + ... Settings=${SETTINGS_MIMETYPES} + Do Not Expect Symbol MIME_ARCHIVE_IN_ARCHIVE + +Exe file, but name in filename_whitelist + Scan File ${RSPAMD_TESTDIR}/messages/exe_attm.eml + ... Settings=${SETTINGS_MIMETYPES} + Do Not Expect Symbol MIME_BAD_EXTENSION + Do Not Expect Symbol MIME_BAD_ATTACHMENT + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Empty text part should not be treat as html + Scan File ${RSPAMD_TESTDIR}/messages/empty-plain-text.eml + ... Settings=${SETTINGS_MIMETYPES} + Do Not Expect Symbol FORGED_OUTLOOK_HTML diff --git a/test/functional/cases/001_merged/106_mid.robot b/test/functional/cases/001_merged/106_mid.robot new file mode 100644 index 000000000..c5510bbb3 --- /dev/null +++ b/test/functional/cases/001_merged/106_mid.robot @@ -0,0 +1,36 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_MID} {symbols_enabled = [DKIM_CHECK,INVALID_MSGID,INVALID_MSGID_ALLOWED,KNOWN_NO_MID,KNOWN_MID,MISSING_MID,MISSING_MID_ALLOWED]} + +*** Test Cases *** +MID - invalid Message-ID + Scan File ${RSPAMD_TESTDIR}/messages/fws_fp.eml + ... Settings=${SETTINGS_MID} + Expect Symbol With Score INVALID_MSGID 1.70 + Do Not Expect Symbol MISSING_MID + Do Not Expect Symbol INVALID_MSGID_ALLOWED + +MID - invalid Message-ID allowed + Scan File ${RSPAMD_TESTDIR}/messages/invalid_mid_allowed.eml + ... Settings=${SETTINGS_MID} + Expect Symbol With Score INVALID_MSGID_ALLOWED 0.00 + Do Not Expect Symbol MISSING_MID + Do Not Expect Symbol INVALID_MSGID + +MID - missing Message-ID + Scan File ${RSPAMD_TESTDIR}/messages/freemail.eml + ... Settings=${SETTINGS_MID} + Expect Symbol With Score MISSING_MID 2.50 + Do Not Expect Symbol MISSING_MID_ALLOWED + Do Not Expect Symbol INVALID_MSGID + +MID - missing Message-ID allowed + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml + ... Settings=${SETTINGS_MID} + Expect Symbol With Score MISSING_MID_ALLOWED 0.00 + Do Not Expect Symbol MISSING_MID + Do Not Expect Symbol INVALID_MSGID diff --git a/test/functional/cases/001_merged/114_phishing.robot b/test/functional/cases/001_merged/114_phishing.robot new file mode 100644 index 000000000..bc7f3981e --- /dev/null +++ b/test/functional/cases/001_merged/114_phishing.robot @@ -0,0 +1,26 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE1} ${RSPAMD_TESTDIR}/messages/phishing1.eml +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/phishing2.eml +${MESSAGE3} ${RSPAMD_TESTDIR}/messages/phishing3.eml +${SETTINGS_PHISHING} {symbols_enabled = [PHISHING,STRICT_PHISHING,STRICTER_PHISHING]} + +*** Test Cases *** +TEST PHISHING + Scan File ${MESSAGE1} + ... Settings=${SETTINGS_PHISHING} + Expect Symbol PHISHING + +TEST PHISHING STRICT ONE + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_PHISHING} + Expect Symbol STRICT_PHISHING + +TEST PHISHING STRICT TWO + Scan File ${MESSAGE3} + ... Settings=${SETTINGS_PHISHING} + Expect Symbol STRICTER_PHISHING diff --git a/test/functional/cases/001_merged/115_dmarc.robot b/test/functional/cases/001_merged/115_dmarc.robot new file mode 100644 index 000000000..e5ed67007 --- /dev/null +++ b/test/functional/cases/001_merged/115_dmarc.robot @@ -0,0 +1,101 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${DMARC_SETTINGS} {symbols_enabled = [DMARC_CHECK, DKIM_CHECK, SPF_CHECK]} + +*** Test Cases *** +DMARC NONE PASS DKIM + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pass_none.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC NONE PASS SPF + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml + ... IP=8.8.4.4 From=foo@spf.cacophony.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC NONE FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_SOFTFAIL + +DMARC REJECT FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_reject.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_REJECT + +DMARC QUARANTINE FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_quarantine.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_QUARANTINE + +DMARC SP NONE FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_none.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_SOFTFAIL + +DMARC SP REJECT FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_reject.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_REJECT + +DMARC SP QUARANTINE FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_quarantine.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_QUARANTINE + +DMARC SUBDOMAIN FAIL DKIM STRICT ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_REJECT + +DMARC SUBDOMAIN PASS DKIM RELAXED ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC SUBDOMAIN PASS SPF STRICT ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml + ... IP=37.48.67.26 From=foo@yo.mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC SUBDOMAIN FAIL SPF STRICT ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_REJECT + +DMARC SUBDOMAIN PASS SPF RELAXED ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC DNSFAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/dmarc_tmpfail.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_DNSFAIL + +DMARC NA NXDOMAIN + Scan File ${RSPAMD_TESTDIR}/messages/utf.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_NA + +DMARC PCT ZERO REJECT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pct_none.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_QUARANTINE + +DMARC PCT ZERO SP QUARANTINE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pct_none1.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_SOFTFAIL diff --git a/test/functional/cases/001_merged/117_spf.robot b/test/functional/cases/001_merged/117_spf.robot new file mode 100644 index 000000000..dda35f671 --- /dev/null +++ b/test/functional/cases/001_merged/117_spf.robot @@ -0,0 +1,157 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_SPF} {symbols_enabled = [SPF_CHECK]} + +*** Test Cases *** +SPF FAIL UNRESOLVEABLE INCLUDE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=37.48.67.26 From=x@fail3.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + +SPF DNSFAIL FAILED INCLUDE UNALIGNED + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail2.org.org.za + ... Settings={symbols_enabled = [SPF_CHECK,DKIM_CHECK,DMARC_CHECK]} + Expect Symbol R_SPF_DNSFAIL + Expect Symbol DMARC_POLICY_SOFTFAIL + +SPF ALLOW UNRESOLVEABLE INCLUDE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail3.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW + +SPF ALLOW FAILED INCLUDE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.4.4 From=x@fail2.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW + +SPF NA NA + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_NA + +SPF NA NOREC + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@co.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_NA + +SPF NA NXDOMAIN + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@zzzzaaaa + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_NA + +SPF PERMFAIL UNRESOLVEABLE REDIRECT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail4.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_PERMFAIL + +SPF REDIRECT NO USEABLE ELEMENTS + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail10.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_PERMFAIL + +SPF DNSFAIL FAILED REDIRECT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail1.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF PERMFAIL NO USEABLE ELEMENTS + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail5.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_PERMFAIL + +SPF FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@example.net + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + +SPF FAIL UNRESOLVEABLE MX + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@fail6.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + +SPF FAIL UNRESOLVEABLE A + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@fail7.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + +SPF DNSFAIL FAILED A + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@fail8.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF DNSFAIL FAILED MX + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@fail9.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF DNSFAIL FAILED RECORD + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@www.dnssec-failed.org + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF PASS INCLUDE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@pass1.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW + +SPF PTRS + Scan File /dev/null + ... IP=88.99.142.95 From=foo@crazyspf.cacophony.za.org + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW + Scan File /dev/null + ... IP=128.66.0.1 From=foo@crazyspf.cacophony.za.org + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + Scan File /dev/null + ... IP=209.85.216.182 From=foo@crazyspf.cacophony.za.org + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + #Scan File /dev/null + #... IP=98.138.91.166 From=foo@crazyspf.cacophony.za.org + #Expect Symbol R_SPF_ALLOW + #Scan File /dev/null + #... IP=98.138.91.167 From=foo@crazyspf.cacophony.za.org + #Expect Symbol R_SPF_ALLOW + #Scan File /dev/null + #... IP=98.138.91.168 From=foo@crazyspf.cacophony.za.org + #Expect Symbol R_SPF_ALLOW + +SPF PERMFAIL REDIRECT WITHOUT SPF + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim4.eml + ... IP=192.0.2.1 From=a@fail1.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF EXTERNAL RELAY + Scan File ${RSPAMD_TESTDIR}/messages/external_relay.eml + ... Settings=${SETTINGS_SPF} + Expect Symbol With Score And Exact Options R_SPF_ALLOW -0.2 +ip4:37.48.67.26 + +SPF UPPERCASE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail11.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW diff --git a/test/functional/cases/001_merged/160_antivirus.robot b/test/functional/cases/001_merged/160_antivirus.robot new file mode 100644 index 000000000..166bdb6a8 --- /dev/null +++ b/test/functional/cases/001_merged/160_antivirus.robot @@ -0,0 +1,149 @@ +*** Settings *** +Suite Teardown Antivirus Teardown +Library Process +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/freemail.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_AVAST} {symbols_enabled = [AVAST_VIRUS]} +${SETTINGS_CLAM} {symbols_enabled = [CLAM_VIRUS]} +${SETTINGS_FPROT} {symbols_enabled = [FPROT_VIRUS, FPROT2_VIRUS_DUPLICATE_DEFAULT]} + +*** Test Cases *** +CLAMAV MISS + Run Dummy Clam ${RSPAMD_PORT_CLAM} + Scan File ${MESSAGE} + ... Settings=${SETTINGS_CLAM} + Do Not Expect Symbol CLAM_VIRUS + Shutdown clamav + +CLAMAV HIT + Run Dummy Clam ${RSPAMD_PORT_CLAM} 1 + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_CLAM} + Expect Symbol CLAM_VIRUS + Do Not Expect Symbol CLAMAV_VIRUS_FAIL + Shutdown clamav + +CLAMAV CACHE HIT + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_CLAM} + Expect Symbol CLAM_VIRUS + Do Not Expect Symbol CLAMAV_VIRUS_FAIL + +CLAMAV CACHE MISS + Scan File ${MESSAGE} + ... Settings=${SETTINGS_CLAM} + Do Not Expect Symbol CLAM_VIRUS + Do Not Expect Symbol CLAMAV_VIRUS_FAIL + +FPROT MISS + Run Dummy Fprot ${RSPAMD_PORT_FPROT} + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_FPROT} + Do Not Expect Symbol FPROT_VIRUS + Do Not Expect Symbol FPROT_EICAR + Shutdown fport + +FPROT HIT - PATTERN + Run Dummy Fprot ${RSPAMD_PORT_FPROT} 1 + Run Dummy Fprot ${RSPAMD_PORT_FPROT2_DUPLICATE} 1 /tmp/dummy_fprot_dupe.pid + Scan File ${MESSAGE} + ... Settings=${SETTINGS_FPROT} + Expect Symbol FPROT_EICAR + # Also check ordered pattern match + Expect Symbol FPROT2_VIRUS_DUPLICATE_PATTERN + Do Not Expect Symbol FPROT2_VIRUS_DUPLICATE_DEFAULT + Do Not Expect Symbol FPROT2_VIRUS_DUPLICATE_NOPE + Shutdown fport + Shutdown fport duplicate + +FPROT CACHE HIT + Scan File ${MESSAGE} + ... Settings=${SETTINGS_FPROT} + Expect Symbol FPROT_EICAR + Do Not Expect Symbol CLAMAV_VIRUS + # Also check ordered pattern match + Expect Symbol FPROT2_VIRUS_DUPLICATE_PATTERN + Do Not Expect Symbol FPROT2_VIRUS_DUPLICATE_DEFAULT + +FPROT CACHE MISS + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_FPROT} + Do Not Expect Symbol FPROT_VIRUS + +AVAST MISS + Run Dummy Avast ${RSPAMD_PORT_AVAST} + Scan File ${MESSAGE} + ... Settings=${SETTINGS_AVAST} + Do Not Expect Symbol AVAST_VIRUS + Shutdown avast + +AVAST HIT + Run Dummy Avast ${RSPAMD_PORT_AVAST} 1 + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_AVAST} + Expect Symbol AVAST_VIRUS + Do Not Expect Symbol AVAST_VIRUS_FAIL + Shutdown avast + +AVAST CACHE HIT + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_AVAST} + Expect Symbol AVAST_VIRUS + Do Not Expect Symbol AVAST_VIRUS_FAIL + +AVAST CACHE MISS + Scan File ${MESSAGE} + ... Settings=${SETTINGS_AVAST} + Do Not Expect Symbol AVAST_VIRUS + Do Not Expect Symbol AVAST_VIRUS_FAIL + +*** Keywords *** +Antivirus Teardown + Shutdown clamav + Shutdown fport + Shutdown avast + +Shutdown clamav + ${clamav_pid} = Get File if exists /tmp/dummy_clamav.pid + Run Keyword if ${clamav_pid} Shutdown Process With Children ${clamav_pid} + +Shutdown fport + ${fport_pid} = Get File if exists /tmp/dummy_fprot.pid + Run Keyword if ${fport_pid} Shutdown Process With Children ${fport_pid} + +Shutdown fport duplicate + ${fport_pid} = Get File if exists /tmp/dummy_fprot_dupe.pid + Run Keyword if ${fport_pid} Shutdown Process With Children ${fport_pid} + +Shutdown avast + ${avast_pid} = Get File if exists /tmp/dummy_avast.pid + Run Keyword if ${avast_pid} Shutdown Process With Children ${avast_pid} + +Run Dummy + [Arguments] @{varargs} + ${process} = Start Process @{varargs} + ${pid} = Get From List ${varargs} -1 + ${pass} = Run Keyword And Return Status Wait Until Created ${pid} + Run Keyword If ${pass} Return From Keyword + Wait For Process ${process} + ${res} = Get Process Result ${process} + Log To Console ${res.stdout} + Log To Console ${res.stderr} + Fail Dummy server failed to start + +Run Dummy Clam + [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_clamav.pid + Run Dummy ${RSPAMD_TESTDIR}/util/dummy_clam.py ${port} ${found} ${pid} + +Run Dummy Fprot + [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_fprot.pid + Run Dummy ${RSPAMD_TESTDIR}/util/dummy_fprot.py ${port} ${found} ${pid} + +Run Dummy Avast + [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_avast.pid + Run Dummy ${RSPAMD_TESTDIR}/util/dummy_avast.py ${port} ${found} ${pid} diff --git a/test/functional/cases/001_merged/220_http.robot b/test/functional/cases/001_merged/220_http.robot new file mode 100644 index 000000000..a6bf5ff65 --- /dev/null +++ b/test/functional/cases/001_merged/220_http.robot @@ -0,0 +1,77 @@ +*** Settings *** +Test Setup Http Setup +Test Teardown Http Teardown +Library Process +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml + +*** Test Cases *** +Simple HTTP request + Scan File ${MESSAGE} Url=/request Method=get + ... Settings={symbols_enabled = [SIMPLE_HTTP_TEST]} + Expect Symbols HTTP_DNS_200 HTTP_200 HTTP_CORO_DNS_200 + Expect Symbol With Exact Options HTTP_CORO_200 hello world + + Scan File ${MESSAGE} Url=/request Method=post + ... Settings={symbols_enabled = [SIMPLE_HTTP_TEST]} + Expect Symbols HTTP_DNS_200 HTTP_200 HTTP_CORO_DNS_200 + Expect Symbol With Exact Options HTTP_CORO_200 hello post + +HTTP request 403 + Scan File ${MESSAGE} Url=/error_403 Method=get + ... Settings={symbols_enabled = [SIMPLE_HTTP_TEST]} + Expect Symbols HTTP_DNS_403 HTTP_403 HTTP_CORO_DNS_403 method_get + + Scan File ${MESSAGE} Url=/error_403 Method=post + ... Settings={symbols_enabled = [SIMPLE_HTTP_TEST]} + Expect Symbols HTTP_DNS_403 HTTP_403 HTTP_CORO_DNS_403 method_post + +HTTP timeout + Scan File ${MESSAGE} Url=/timeout Method=get + ... Settings={symbols_enabled = [SIMPLE_HTTP_TEST]} + Expect Symbols HTTP_ERROR HTTP_ERROR HTTP_CORO_DNS_ERROR HTTP_CORO_ERROR method_get + # FIXME: where is "IO timeout" + + Scan File ${MESSAGE} Url=/timeout Method=post + ... Settings={symbols_enabled = [SIMPLE_HTTP_TEST]} + Expect Symbols HTTP_ERROR HTTP_ERROR HTTP_CORO_DNS_ERROR HTTP_CORO_ERROR method_post + # FIXME: where is "IO timeout" + +HTTP empty response + Scan File ${MESSAGE} Url=/empty Method=get + ... Settings={symbols_enabled = [SIMPLE_HTTP_TEST]} + Expect Symbols HTTP_ERROR HTTP_ERROR HTTP_CORO_DNS_ERROR HTTP_CORO_ERROR method_get + # FIXME: where is "IO read error: unexpected EOF" + + Scan File ${MESSAGE} Url=/empty Method=post + ... Settings={symbols_enabled = [SIMPLE_HTTP_TEST]} + Expect Symbols HTTP_ERROR HTTP_ERROR HTTP_CORO_DNS_ERROR HTTP_CORO_ERROR method_post + # FIXME: where is "IO read error: unexpected EOF" + +SSL Large HTTP request + Scan File ${MESSAGE} + ... Settings={symbols_enabled = [LARGE_HTTP_TEST]} + Expect Symbol HTTP_SSL_LARGE + +*** Keywords *** +Http Setup + Run Dummy Http + Run Dummy Https + +Http Teardown + ${http_pid} = Get File /tmp/dummy_http.pid + Shutdown Process With Children ${http_pid} + ${https_pid} = Get File /tmp/dummy_https.pid + Shutdown Process With Children ${https_pid} + +Run Dummy Http + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_http.py + Wait Until Created /tmp/dummy_http.pid + +Run Dummy Https + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_https.py ${RSPAMD_TESTDIR}/util/server.pem + Wait Until Created /tmp/dummy_https.pid diff --git a/test/functional/cases/001_merged/230_tcp.robot b/test/functional/cases/001_merged/230_tcp.robot new file mode 100644 index 000000000..89ec7ea5a --- /dev/null +++ b/test/functional/cases/001_merged/230_tcp.robot @@ -0,0 +1,72 @@ +*** Settings *** +Suite Setup Servers Setup +Suite Teardown Servers Teardown +Library Process +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml + + +*** Test Cases *** +Simple TCP request + Scan File ${MESSAGE} + ... Settings={symbols_enabled = [SIMPLE_TCP_ASYNC_TEST]} + Expect Symbol HTTP_ASYNC_RESPONSE + Expect Symbol HTTP_ASYNC_RESPONSE_2 + +SSL TCP request + Scan File ${MESSAGE} + ... Settings={symbols_enabled = [SIMPLE_TCP_ASYNC_SSL_TEST]} + Expect Symbol With Exact Options TCP_SSL_RESPONSE hello + Expect Symbol With Exact Options TCP_SSL_RESPONSE_2 hello + +SSL Large TCP request + Scan File ${MESSAGE} + ... Settings={symbols_enabled = [LARGE_TCP_ASYNC_SSL_TEST]} + Expect Symbol TCP_SSL_LARGE + Expect Symbol TCP_SSL_LARGE_2 + +Sync API TCP request + Scan File ${MESSAGE} + ... Settings={symbols_enabled = [SIMPLE_TCP_TEST]} + Expect Symbol HTTP_SYNC_RESPONSE + Should Contain ${SCAN_RESULT}[symbols][HTTP_SYNC_RESPONSE][options][0] hello world + Should Contain ${SCAN_RESULT}[symbols][HTTP_SYNC_RESPONSE_2][options][0] hello post + +Sync API TCP get request + Check url /request get HTTP_SYNC_EOF_get hello world + Check url /content-length get HTTP_SYNC_CONTENT_get hello world + +Sync API TCP post request + Check url /request post HTTP_SYNC_EOF_post hello post + Check url /content-length post HTTP_SYNC_CONTENT_post hello post + +*** Keywords *** +Servers Setup + Run Dummy Http + Run Dummy Ssl + +Servers Teardown + ${http_pid} = Get File /tmp/dummy_http.pid + Shutdown Process With Children ${http_pid} + ${ssl_pid} = Get File /tmp/dummy_ssl.pid + Shutdown Process With Children ${ssl_pid} + +Run Dummy Http + [Arguments] + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_http.py + Wait Until Created /tmp/dummy_http.pid timeout=2 second + +Run Dummy Ssl + [Arguments] + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_ssl.py ${RSPAMD_TESTDIR}/util/server.pem + Wait Until Created /tmp/dummy_ssl.pid timeout=2 second + +Check url + [Arguments] ${url} ${method} ${expect_symbol} @{expect_options} + Scan File ${MESSAGE} URL=${url} Method=${method} + ... Settings={symbols_enabled = [HTTP_TCP_TEST]} + Expect Symbol With Exact Options ${expect_symbol} @{expect_options} diff --git a/test/functional/cases/001_merged/231_tcp_down.robot b/test/functional/cases/001_merged/231_tcp_down.robot new file mode 100644 index 000000000..088a60553 --- /dev/null +++ b/test/functional/cases/001_merged/231_tcp_down.robot @@ -0,0 +1,21 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml + +*** Test Cases *** +Sync API TCP get request when server is down + [Documentation] We don't create HTTP server here, that's why + ... all requests fail with "connection refused" + Check url /request get HTTP_ASYNC_RESPONSE Socket error detected: Connection refused + Check url /content-length get HTTP_SYNC_WRITE_ERROR Socket error detected: Connection refused + +*** Keywords *** +Check url + [Arguments] ${url} ${method} ${expect_symbol} @{expect_options} + Scan File ${MESSAGE} URL=${url} Method=${method} + ... Settings={symbols_enabled = [SIMPLE_TCP_ASYNC_TEST, SIMPLE_TCP_TEST]} + Expect Symbol With Exact Options ${expect_symbol} @{expect_options} diff --git a/test/functional/cases/001_merged/240_redis.robot b/test/functional/cases/001_merged/240_redis.robot new file mode 100644 index 000000000..3196dd0c6 --- /dev/null +++ b/test/functional/cases/001_merged/240_redis.robot @@ -0,0 +1,16 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_REDIS} {symbols_enabled = [REDIS_TEST, SIMPLE_REDIS_ASYNC_TEST, SIMPLE_REDIS_ASYNC201809_TEST]} + +*** Test Cases *** +Redis client + Redis SET test_key test value + Scan File ${MESSAGE} + Expect Symbol With Exact Options REDIS hello from lua on redis + Expect Symbol With Exact Options REDIS_ASYNC test value + Expect Symbol With Exact Options REDIS_ASYNC201809 test value diff --git a/test/functional/cases/001_merged/250_dns.robot b/test/functional/cases/001_merged/250_dns.robot new file mode 100644 index 000000000..d3e64cd34 --- /dev/null +++ b/test/functional/cases/001_merged/250_dns.robot @@ -0,0 +1,21 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_DNS} {symbols_enabled = [SIMPLE_DNS, SIMPLE_DNS_SYNC]} + +*** Test Cases *** +Simple DNS request + Scan File ${MESSAGE} To-Resolve=example.com + ... Settings=${SETTINGS_DNS} + Expect Symbol With Exact Options DNS_SYNC 93.184.216.34 + Expect Symbol With Exact Options DNS 93.184.216.34 + +Faulty DNS request + Scan File ${MESSAGE} To-Resolve=not-resolvable.com + ... Settings=${SETTINGS_DNS} + Expect Symbol With Exact Options DNS_SYNC_ERROR requested record is not found + Expect Symbol With Exact Options DNS_ERROR requested record is not found diff --git a/test/functional/cases/001_merged/270_selector.robot b/test/functional/cases/001_merged/270_selector.robot new file mode 100644 index 000000000..8250db89e --- /dev/null +++ b/test/functional/cases/001_merged/270_selector.robot @@ -0,0 +1,15 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/subject1.eml + +*** Test Cases *** +Newlines + Scan File ${MESSAGE} User=test@user.com Pass=all + ... Settings={symbols_enabled = [CONFIG_SELECTOR_RE_RCPT_SUBJECT, LUA_SELECTOR_RE]} + Expect Symbol CONFIG_SELECTOR_RE_RCPT_SUBJECT + Expect Symbol LUA_SELECTOR_RE + diff --git a/test/functional/cases/001_merged/280_rules.robot b/test/functional/cases/001_merged/280_rules.robot new file mode 100644 index 000000000..52ea1c86d --- /dev/null +++ b/test/functional/cases/001_merged/280_rules.robot @@ -0,0 +1,125 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE1} ${RSPAMD_TESTDIR}/messages/fws_fn.eml +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/fws_fp.eml +${MESSAGE3} ${RSPAMD_TESTDIR}/messages/fws_tp.eml +${MESSAGE4} ${RSPAMD_TESTDIR}/messages/broken_richtext.eml +${MESSAGE5} ${RSPAMD_TESTDIR}/messages/badboundary.eml +${MESSAGE6} ${RSPAMD_TESTDIR}/messages/pdf_encrypted.eml +${MESSAGE7} ${RSPAMD_TESTDIR}/messages/pdf_js.eml +${MESSAGE8} ${RSPAMD_TESTDIR}/messages/yand_forward.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/newlines.eml + +*** Test Cases *** +Broken MIME + Scan File ${MESSAGE3} Settings={symbols_enabled = [MISSING_SUBJECT]} + Expect Symbol MISSING_SUBJECT + +Issue 2584 + Scan File ${MESSAGE1} + ... Settings={symbols_enabled = [BROKEN_CONTENT_TYPE, MISSING_SUBJECT, R_MISSING_CHARSET]} + Do Not Expect Symbol BROKEN_CONTENT_TYPE + Do Not Expect Symbol MISSING_SUBJECT + Do Not Expect Symbol R_MISSING_CHARSET + +Issue 2349 + Scan File ${MESSAGE2} + ... Settings={symbols_enabled = [MULTIPLE_UNIQUE_HEADERS]} + Do Not Expect Symbol MULTIPLE_UNIQUE_HEADERS + +Broken Rich Text + Scan File ${MESSAGE4} + ... Settings={symbols_enabled = [BROKEN_CONTENT_TYPE]} + Expect Symbol BROKEN_CONTENT_TYPE + +Broken boundary + Scan File ${MESSAGE4} + ... Settings={symbols_enabled = [BROKEN_CONTENT_TYPE]} + Expect Symbol BROKEN_CONTENT_TYPE + +PDF encrypted + Scan File ${MESSAGE6} + ... Settings={symbols_enabled = [PDF_ENCRYPTED]} + Expect Symbol PDF_ENCRYPTED + +PDF javascript + Scan File ${MESSAGE7} + ... Settings={symbols_enabled = [PDF_JAVASCRIPT]} + Expect Symbol PDF_JAVASCRIPT + +BITCOIN ADDR + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml + ... Settings={symbols_enabled = [BITCOIN_ADDR]} + Expect Symbol BITCOIN_ADDR + +BITCOIN ADDR 2 + Scan File ${RSPAMD_TESTDIR}/messages/btc2.eml + ... Settings={symbols_enabled = [BITCOIN_ADDR]} + Expect Symbol BITCOIN_ADDR + +BITCOIN ADDR 3 + Scan File ${RSPAMD_TESTDIR}/messages/btc3.eml + ... Settings={symbols_enabled = [BITCOIN_ADDR]} + Expect Symbol BITCOIN_ADDR + +RCVD_COUNT_ONE + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml + ... Settings={symbols_enabled = [RCVD_COUNT_ONE]} + Expect Symbol RCVD_COUNT_ONE + +RCVD_COUNT_FIVE + Scan File ${RSPAMD_TESTDIR}/messages/yand_forward.eml + ... Settings={symbols_enabled = [RCVD_COUNT_ONE]} + Expect Symbol RCVD_COUNT_FIVE + +RCVD_COUNT_SEVEN + Scan File ${RSPAMD_TESTDIR}/messages/rcvd7.eml + ... Settings={symbols_enabled = [RCVD_COUNT_ONE]} + Expect Symbol RCVD_COUNT_SEVEN + +FROM_NEQ_ENVFROM + Scan File ${MESSAGE8} From=test@test.net + ... Settings={symbols_enabled = [FROM_NEQ_ENVFROM]} + Expect Symbol FROM_NEQ_ENVFROM + +PHISH_SENDER_A + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender.eml + ... Settings={symbols_enabled = [MULTIPLE_FROM, MULTIPLE_UNIQUE_HEADERS]} + Expect Symbol With Score And Exact Options MULTIPLE_FROM 9.0 + Expect Symbol With Score And Exact Options MULTIPLE_UNIQUE_HEADERS 7.0 From + +PHISH_SENDER_B + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender2.eml + ... Settings={symbols_enabled = [BROKEN_HEADERS]} + Expect Symbol BROKEN_HEADERS + +PHISH_SENDER_C + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender3.eml + ... Settings={symbols_enabled = [BROKEN_HEADERS]} + Expect Symbol BROKEN_HEADERS + +PHISH_SENDER_D + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender4.eml + ... Settings={symbols_enabled = [BROKEN_HEADERS]} + Expect Symbol BROKEN_HEADERS + +PHISH_SENDER_E + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender5.eml + ... Settings={symbols_enabled = [MULTIPLE_FROM, DMARC_CHECK, DKIM_CHECK, SPF_CHECK]} + Expect Symbol MULTIPLE_FROM + Expect Symbol With Exact Options DMARC_NA Duplicate From header + +PHISH_SENDER_ROUTING_PART + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender6.eml + ... Settings={symbols_enabled = [FROM_INVALID]} + Expect Symbol FROM_INVALID + +REPLYTO_ADDR_EQ_FROM + Scan File ${RSPAMD_TESTDIR}/messages/replyto_addr_eq_from.eml + ... Settings={symbols_enabled = [REPLYTO_ADDR_EQ_FROM]} + Expect Symbol REPLYTO_ADDR_EQ_FROM + diff --git a/test/functional/cases/001_merged/281_fnames.robot b/test/functional/cases/001_merged/281_fnames.robot new file mode 100644 index 000000000..bb600b1a6 --- /dev/null +++ b/test/functional/cases/001_merged/281_fnames.robot @@ -0,0 +1,13 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_FNAME} {symbols_enabled = [TEST_FNAME]} + +*** Test Cases *** +FILE NAMES + Scan File ${RSPAMD_TESTDIR}/messages/fname.eml Settings=${SETTINGS_FNAME} + Expect Symbol With Option TEST_FNAME [삼성생명]2020.08.14 데일리 경제뉴스.pdf + Expect Symbol With Option TEST_FNAME 01029_402110_10620_RGT06902_PRT180ML_20200803_101820.pdf diff --git a/test/functional/cases/001_merged/290_greylist.robot b/test/functional/cases/001_merged/290_greylist.robot new file mode 100644 index 000000000..05ce3d3f0 --- /dev/null +++ b/test/functional/cases/001_merged/290_greylist.robot @@ -0,0 +1,25 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_GREYLIST} {symbols_enabled = [GREYLIST_CHECK, GREYLIST_SAVE], symbols = [FOUR_POINTS]} + +*** Test Cases *** +GREYLIST NEW + Scan File ${MESSAGE} + ... Settings=${SETTINGS_GREYLIST} + Expect Symbol With Option GREYLIST greylisted + +GREYLIST EARLY + Scan File ${MESSAGE} + ... Settings=${SETTINGS_GREYLIST} + Expect Symbol With Option GREYLIST greylisted + +GREYLIST PASS + Sleep 4s Wait greylisting timeout + Scan File ${MESSAGE} + ... Settings=${SETTINGS_GREYLIST} + Expect Symbol With Option GREYLIST pass diff --git a/test/functional/cases/001_merged/300_rbl.robot b/test/functional/cases/001_merged/300_rbl.robot new file mode 100644 index 000000000..094eec409 --- /dev/null +++ b/test/functional/cases/001_merged/300_rbl.robot @@ -0,0 +1,77 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml + +*** Test Cases *** +RBL FROM MISS + Scan File ${MESSAGE} IP=1.2.3.4 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN_CHECK]} + Do Not Expect Symbol FAKE_RBL_CODE_2 + +RBL FROM HIT + Scan File ${MESSAGE} IP=4.3.2.1 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN_CHECK]} + Expect Symbol FAKE_RBL_CODE_2 + +RBL FROM MULTIPLE HIT + Scan File ${MESSAGE} IP=4.3.2.3 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN_CHECK]} + Expect Symbol FAKE_RBL_CODE_2 + Expect Symbol FAKE_RBL_CODE_3 + +RBL FROM UNKNOWN HIT + Scan File ${MESSAGE} IP=4.3.2.2 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN_CHECK]} + Expect Symbol FAKE_RBL_FAKE_RBL_UNKNOWN + +RBL RECEIVED HIT + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [FAKE_RECEIVED_RBL_FAKE_RBL_UNKNOWN]} + Expect Symbol FAKE_RECEIVED_RBL_CODE_3 + +RBL FROM HIT WL + Scan File ${MESSAGE} IP=4.3.2.4 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN, FAKE_WL_RBL_UNKNOWN]} + Do Not Expect Symbol FAKE_RBL_CODE_2 + Expect Symbol With Exact Options FAKE_WL_RBL_CODE_2 4.3.2.4:from + +EMAILBL Compose Map 1 + Scan File ${RSPAMD_TESTDIR}/messages/url14.eml + ... Settings={symbols_enabled = [RSPAMD_EMAILBL]} + Expect Symbol With Exact Options RSPAMD_EMAILBL dirty.sanchez.com:email + +EMAILBL Compose Map 2 + Scan File ${RSPAMD_TESTDIR}/messages/url15.eml + ... Settings={symbols_enabled = [RSPAMD_EMAILBL]} + Expect Symbol With Exact Options RSPAMD_EMAILBL very.dirty.sanchez.com:email + +EMAILBL Compose Map 3 + Scan File ${RSPAMD_TESTDIR}/messages/url16.eml + ... Settings={symbols_enabled = [RSPAMD_EMAILBL]} + Expect Symbol With Exact Options RSPAMD_EMAILBL 41.black.sanchez.com:email + +CONTENT URLS + Scan File ${RSPAMD_TESTDIR}/messages/content_url.eml + ... Settings={symbols_enabled = [URIBL_CONTENTONLY, URIBL_NOCONTENT, URIBL_WITHCONTENT]} + Expect Symbol With Exact Options URIBL_NOCONTENT example.org:url + Expect Symbol With Option URIBL_WITHCONTENT example.com:url + Expect Symbol With Option URIBL_WITHCONTENT example.org:url + Expect Symbol With Option URIBL_WITHCONTENT 8.8.8.8:url + Expect Symbol With Exact Options URIBL_CONTENTONLY example.com:url + +SELECTORS + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml From=user@example.com Helo=example.org + ... Settings={symbols_enabled = [RBL_SELECTOR_SINGLE, RBL_SELECTOR_MULTIPLE]} + Expect Symbol With Exact Options RBL_SELECTOR_SINGLE example.org:selector + Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.com:sel_from + Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_helo + +SELECTORS COMBINED + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml From=user@example.org Helo=example.org + ... Settings={symbols_enabled = [RBL_SELECTOR_MULTIPLE]} + Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_from + Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_helo diff --git a/test/functional/cases/001_merged/310_udp.robot b/test/functional/cases/001_merged/310_udp.robot new file mode 100644 index 000000000..e94ed60e1 --- /dev/null +++ b/test/functional/cases/001_merged/310_udp.robot @@ -0,0 +1,40 @@ +*** Settings *** +Test Setup UDP Setup +Test Teardown UDP Teardown +Library Process +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_UDP} {symbols_enabled = [UDP_FAIL,UDP_SENDTO,UDP_SUCCESS]} + +*** Test Cases *** +Simple UDP request + Scan File ${MESSAGE} + ... Settings=${SETTINGS_UDP} + Expect Symbol With Exact Options UDP_SUCCESS helloworld + +Sendonly UDP request + Scan File ${MESSAGE} + ... Settings=${SETTINGS_UDP} + Expect Symbol UDP_SENDTO + +Errored UDP request + Scan File ${MESSAGE} + ... Settings=${SETTINGS_UDP} + Expect Symbol With Exact Options UDP_FAIL read timeout + +*** Keywords *** +UDP Setup + Run Dummy UDP + +UDP Teardown + ${udp_pid} = Get File /tmp/dummy_udp.pid + Shutdown Process With Children ${udp_pid} + +Run Dummy UDP + [Arguments] + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_udp.py 5005 + Wait Until Created /tmp/dummy_udp.pid diff --git a/test/functional/cases/001_merged/321_arc_check.robot b/test/functional/cases/001_merged/321_arc_check.robot new file mode 100644 index 000000000..3f6488bc4 --- /dev/null +++ b/test/functional/cases/001_merged/321_arc_check.robot @@ -0,0 +1,19 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_ARC} {symbols_enabled = [ARC_CALLBACK]} + +*** Test Cases *** +ARC ALLOW CHECK + Scan File ${RSPAMD_TESTDIR}/messages/arcallow.eml + ... Settings=${SETTINGS_ARC} + Expect Symbol ARC_ALLOW + +ARC BAD CHECK + Scan File ${RSPAMD_TESTDIR}/messages/arcbad.eml + ... Settings=${SETTINGS_ARC} + Expect Symbol ARC_INVALID + diff --git a/test/functional/cases/001_merged/340_surbl.robot b/test/functional/cases/001_merged/340_surbl.robot new file mode 100644 index 000000000..a1d073642 --- /dev/null +++ b/test/functional/cases/001_merged/340_surbl.robot @@ -0,0 +1,182 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_SURBL} {groups_enabled = [rbl]} + +*** Test Cases *** +SURBL resolve ip + Scan File ${RSPAMD_TESTDIR}/messages/url7.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options URIBL_SBL_CSS 8.8.8.9:example.ru:url + Expect Symbol With Exact Options URIBL_XBL 8.8.8.8:example.ru:url + Expect Symbol With Exact Options URIBL_PBL 8.8.8.8:example.ru:url + +SURBL Example.com domain + Scan File ${RSPAMD_TESTDIR}/messages/url4.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options RSPAMD_URIBL example.com:url + Expect Symbol With Exact Options DBL_SPAM example.com:url + Expect Symbol With Exact Options DBL_PHISH rspamd.tk:url + Do Not Expect Symbol URIBL_BLACK + +SURBL Example.net domain + Scan File ${RSPAMD_TESTDIR}/messages/url5.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol DBL_PHISH + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol URIBL_BLACK + +SURBL Example.org domain + Scan File ${RSPAMD_TESTDIR}/messages/url6.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol URIBL_BLACK + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_PHISH + +SURBL Example.ru domain + Scan File ${RSPAMD_TESTDIR}/messages/url7.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol URIBL_GREY + Expect Symbol URIBL_RED + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL Example.ru ZEN domain + Scan File ${RSPAMD_TESTDIR}/messages/url7.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol URIBL_SBL_CSS + Expect Symbol URIBL_XBL + Expect Symbol URIBL_PBL + Do Not Expect Symbol URIBL_SBL + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL Example.com domain image false + Scan File ${RSPAMD_TESTDIR}/messages/urlimage.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL_IMAGES + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL @example.com mail html + Scan File ${RSPAMD_TESTDIR}/messages/mailadr.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol With Exact Options DBL_SPAM example.com:email + Do Not Expect Symbol RSPAMD_URIBL_IMAGES + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL @example.com mail text + Scan File ${RSPAMD_TESTDIR}/messages/mailadr2.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol With Exact Options DBL_SPAM example.com:email + Do Not Expect Symbol RSPAMD_URIBL_IMAGES + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL example.com not encoded url in subject + Scan File ${RSPAMD_TESTDIR}/messages/urlinsubject.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol DBL_SPAM + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL example.com encoded url in subject + Scan File ${RSPAMD_TESTDIR}/messages/urlinsubjectencoded.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol DBL_SPAM + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +WHITELIST + Scan File ${RSPAMD_TESTDIR}/messages/whitelist.eml + ... Settings=${SETTINGS_SURBL} + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL_IMAGES + +EMAILBL full address & domain only + Scan File ${RSPAMD_TESTDIR}/messages/emailbltext.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_FULL + Expect Symbol RSPAMD_EMAILBL_DOMAINONLY + +EMAILBL full subdomain address + Scan File ${RSPAMD_TESTDIR}/messages/emailbltext2.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_FULL + +EMAILBL full subdomain address & domain only + Scan File ${RSPAMD_TESTDIR}/messages/emailbltext3.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options RSPAMD_EMAILBL_DOMAINONLY baddomain.com:email + Expect Symbol With Exact Options RSPAMD_EMAILBL_FULL user.subdomain.baddomain.com:email + +EMAILBL REPLY TO full address + Scan File ${RSPAMD_TESTDIR}/messages/replyto.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_FULL + Do Not Expect Symbol RSPAMD_EMAILBL_DOMAINONLY + +EMAILBL REPLY TO domain only + Scan File ${RSPAMD_TESTDIR}/messages/replyto2.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_DOMAINONLY + Do Not Expect Symbol RSPAMD_EMAILBL_FULL + +EMAILBL REPLY TO full subdomain address + Scan File ${RSPAMD_TESTDIR}/messages/replytosubdomain.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_FULL + Do Not Expect Symbol RSPAMD_EMAILBL_DOMAINONLY + +SURBL IDN domain + Scan File ${RSPAMD_TESTDIR}/messages/url8.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol DBL_SPAM + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL IDN Punycode domain + Scan File ${RSPAMD_TESTDIR}/messages/url9.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol DBL_SPAM + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL html entity­ + Scan File ${RSPAMD_TESTDIR}/messages/url10.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + +SURBL url compose map 1 + Scan File ${RSPAMD_TESTDIR}/messages/url11.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options BAD_SUBDOMAIN clean.dirty.sanchez.com:url + +SURBL url compose map 2 + Scan File ${RSPAMD_TESTDIR}/messages/url12.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options BAD_SUBDOMAIN 4.very.dirty.sanchez.com:url + +SURBL url compose map 3 + Scan File ${RSPAMD_TESTDIR}/messages/url13.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options BAD_SUBDOMAIN 41.black.sanchez.com:url diff --git a/test/functional/cases/001_merged/350_magic.robot b/test/functional/cases/001_merged/350_magic.robot new file mode 100644 index 000000000..b8f6936cb --- /dev/null +++ b/test/functional/cases/001_merged/350_magic.robot @@ -0,0 +1,66 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_MAGIC} {symbols_enabled = [MAGIC_SYM]} + +*** Test Cases *** +Magic detections bundle 1 + Scan File ${RSPAMD_TESTDIR}/messages/gargantua.eml Settings=${SETTINGS_MAGIC} + Expect Symbols MAGIC_SYM_ZIP_2 + ... MAGIC_SYM_RAR_3 + ... MAGIC_SYM_EXE_4 + ... MAGIC_SYM_ELF_5 + ... MAGIC_SYM_LNK_6 + ... MAGIC_SYM_CLASS_7 + ... MAGIC_SYM_RTF_8 + ... MAGIC_SYM_PDF_9 + ... MAGIC_SYM_PS_10 + ... MAGIC_SYM_CHM_11 + ... MAGIC_SYM_DJVU_12 + ... MAGIC_SYM_ARJ_13 + ... MAGIC_SYM_CAB_14 + ... MAGIC_SYM_ACE_15 + ... MAGIC_SYM_TAR_16 + ... MAGIC_SYM_BZ2_17 + ... MAGIC_SYM_XZ_18 + ... MAGIC_SYM_LZ4_19 + ... MAGIC_SYM_ZST_20 + ... MAGIC_SYM_DMG_21 + ... MAGIC_SYM_ISO_22 + ... MAGIC_SYM_ZOO_23 + ... MAGIC_SYM_EPUB_24 + ... MAGIC_SYM_XAR_25 + ... MAGIC_SYM_PSD_26 + ... MAGIC_SYM_PCX_27 + ... MAGIC_SYM_TIFF_28 + ... MAGIC_SYM_ICO_29 + ... MAGIC_SYM_SWF_30 + ... MAGIC_SYM_DOC_31 + ... MAGIC_SYM_XLS_32 + ... MAGIC_SYM_PPT_33 + ... MAGIC_SYM_MSI_34 + ... MAGIC_SYM_MSG_35 + ... MAGIC_SYM_DOCX_36 + ... MAGIC_SYM_XLSX_37 + ... MAGIC_SYM_PPTX_38 + ... MAGIC_SYM_ODT_39 + ... MAGIC_SYM_ODS_40 + ... MAGIC_SYM_ODP_41 + ... MAGIC_SYM_7Z_42 + ... MAGIC_SYM_VSD_43 + ... MAGIC_SYM_PNG_44 + ... MAGIC_SYM_JPG_45 + ... MAGIC_SYM_GIF_46 + ... MAGIC_SYM_BMP_47 + ... MAGIC_SYM_TXT_48 + ... MAGIC_SYM_HTML_49 + ... MAGIC_SYM_CSV_50 + ... MAGIC_SYM_DWG_51 + ... MAGIC_SYM_JAR_52 + ... MAGIC_SYM_APK_53 + ... MAGIC_SYM_BAT_54 + ... MAGIC_SYM_ICS_55 + ... MAGIC_SYM_VCF_56 diff --git a/test/functional/cases/001_merged/__init__.robot b/test/functional/cases/001_merged/__init__.robot new file mode 100644 index 000000000..07f877c46 --- /dev/null +++ b/test/functional/cases/001_merged/__init__.robot @@ -0,0 +1,14 @@ +*** Settings *** +Suite Setup Rspamd Redis Setup +Suite Teardown Rspamd Redis Teardown +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${CONFIG} ${RSPAMD_TESTDIR}/configs/merged.conf +${REDIS_SCOPE} Suite +${RSPAMD_MAP_MAP} ${RSPAMD_TESTDIR}/configs/maps/map.list +${RSPAMD_RADIX_MAP} ${RSPAMD_TESTDIR}/configs/maps/ip2.list +${RSPAMD_REGEXP_MAP} ${RSPAMD_TESTDIR}/configs/maps/regexp.list +${RSPAMD_SCOPE} Suite diff --git a/test/functional/cases/100_general.robot b/test/functional/cases/100_general.robot deleted file mode 100644 index e76b07c54..000000000 --- a/test/functional/cases/100_general.robot +++ /dev/null @@ -1,50 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/trivial.conf -${GTUBE} ${RSPAMD_TESTDIR}/messages/gtube.eml -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -GTUBE - Scan File ${GTUBE} - Expect Symbol GTUBE - -GTUBE - Encrypted - ${result} = Run Rspamc -p -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_NORMAL} --key ${RSPAMD_KEY_PUB1} - ... ${GTUBE} - Check Rspamc ${result} GTUBE ( - -GTUBE - Scan File feature - Scan File By Reference ${GTUBE} - Expect Symbol GTUBE - -GTUBE - Scan File feature (encoded) - ${encoded} = Encode Filename ${GTUBE} - Scan File By Reference ${encoded} - Expect Symbol GTUBE - -GTUBE - SPAMC - ${result} = Spamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} ${GTUBE} - Should Contain ${result} GTUBE - -GTUBE - RSPAMC - ${result} = Rspamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} ${GTUBE} - Should Contain ${result} GTUBE - -EMAILS DETECTION 1 - Scan File ${RSPAMD_TESTDIR}/messages/emails1.eml URL-Format=Extended - Expect Email jim@example.net - Expect Email bob@example.net - Expect Email rupert@example.net - -EMAILS DETECTION ZEROFONT - Scan File ${RSPAMD_TESTDIR}/messages/zerofont.eml - Expect Symbol MANY_INVISIBLE_PARTS - Expect Symbol ZERO_FONT diff --git a/test/functional/cases/101_lua.robot b/test/functional/cases/101_lua.robot index 67e0d35ec..c820d1b84 100644 --- a/test/functional/cases/101_lua.robot +++ b/test/functional/cases/101_lua.robot @@ -6,10 +6,7 @@ Variables ${RSPAMD_TESTDIR}/lib/vars.py *** Variables *** ${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf -${MAP_MAP} ${RSPAMD_TESTDIR}/configs/maps/map.list ${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${RADIX_MAP} ${RSPAMD_TESTDIR}/configs/maps/ip2.list -${REGEXP_MAP} ${RSPAMD_TESTDIR}/configs/maps/regexp.list ${RSPAMD_SCOPE} Test ${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat @@ -31,63 +28,8 @@ Pre and Post Filters Expect Symbol TEST_PRE Expect Symbol TEST_POST -Recipient Parsing Sanity - [Setup] Lua Setup ${RSPAMD_TESTDIR}/lua/recipients.lua - Scan File ${MESSAGE} Rcpt=rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar - Expect Symbol With Exact Options TEST_RCPT rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar - -TLD parts - [Setup] TLD Setup ${RSPAMD_TESTDIR}/lua/tlds.lua - Scan File ${MESSAGE} - Expect Symbol With Exact Options TEST_TLD no worry - -Hashes - [Setup] Lua Setup ${RSPAMD_TESTDIR}/lua/hashes.lua - Scan File ${MESSAGE} - Expect Symbol With Exact Options TEST_HASHES no worry - -Maps Key Values - [Setup] Lua Replace Setup ${RSPAMD_TESTDIR}/lua/maps_kv.lua - [Teardown] Lua Replace Teardown - Scan File ${MESSAGE} - Expect Symbol With Exact Options RADIX_KV no worry - Expect Symbol With Exact Options REGEXP_KV no worry - Expect Symbol With Exact Options MAP_KV no worry - -Option Order - [Setup] Lua Replace Setup ${RSPAMD_TESTDIR}/lua/option_order.lua - [Teardown] Lua Replace Teardown - Scan File ${MESSAGE} - Expect Symbol With Exact Options OPTION_ORDER one two three 4 5 a - Expect Symbol With Exact Options TBL_OPTION_ORDER one two three 4 5 a - -Rule conditions - [Setup] Lua Replace Setup ${RSPAMD_TESTDIR}/lua/conditions.lua - [Teardown] Lua Replace Teardown - Scan File ${MESSAGE} - Expect Symbol With Option ANY_A hello3 - Expect Symbol With Option ANY_A hello1 - Expect Symbol With Option ANY_A hello2 - *** Keywords *** Lua Setup [Arguments] ${RSPAMD_LUA_SCRIPT} Set Test Variable ${RSPAMD_LUA_SCRIPT} Rspamd Setup - -Lua Replace Setup - [Arguments] ${LUA_SCRIPT_UNESC} - ${RSPAMD_LUA_SCRIPT} = Make Temporary File - ${lua} = Get File ${LUA_SCRIPT_UNESC} - ${lua} = Replace Variables ${lua} - Create File ${RSPAMD_LUA_SCRIPT} ${lua} - Lua Setup ${RSPAMD_LUA_SCRIPT} - -Lua Replace Teardown - Remove File ${RSPAMD_LUA_SCRIPT} - Rspamd Teardown - -TLD Setup - [Arguments] ${RSPAMD_LUA_SCRIPT} - Set Test Variable ${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat - Lua Setup ${RSPAMD_LUA_SCRIPT} diff --git a/test/functional/cases/102_multimap.robot b/test/functional/cases/102_multimap.robot deleted file mode 100644 index 8085ad748..000000000 --- a/test/functional/cases/102_multimap.robot +++ /dev/null @@ -1,337 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Redis Setup -Suite Teardown Rspamd Redis Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/multimap.conf -${FREEMAIL_CC} ${RSPAMD_TESTDIR}/messages/freemailcc.eml -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${RCVD1} ${RSPAMD_TESTDIR}/messages/received1.eml -${RCVD2} ${RSPAMD_TESTDIR}/messages/received2.eml -${RCVD3} ${RSPAMD_TESTDIR}/messages/received3.eml -${RCVD4} ${RSPAMD_TESTDIR}/messages/received4.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat -${URL1} ${RSPAMD_TESTDIR}/messages/url1.eml -${URL2} ${RSPAMD_TESTDIR}/messages/url2.eml -${URL3} ${RSPAMD_TESTDIR}/messages/url3.eml -${URL4} ${RSPAMD_TESTDIR}/messages/url4.eml -${URL5} ${RSPAMD_TESTDIR}/messages/url5.eml -${URL_ICS} ${RSPAMD_TESTDIR}/messages/ics.eml -${UTF_MESSAGE} ${RSPAMD_TESTDIR}/messages/utf.eml - -*** Test Cases *** -URL_ICS - Scan File ${URL_ICS} - Expect URL test.com - -MAP - DNSBL HIT - Scan File ${MESSAGE} IP=127.0.0.2 - Expect Symbol DNSBL_MAP - -MAP - DNSBL MISS - Scan File ${MESSAGE} IP=127.0.0.1 - Do Not Expect Symbol DNSBL_MAP - -MAP - IP HIT - Scan File ${MESSAGE} IP=127.0.0.1 - Expect Symbol IP_MAP - -MAP - IP MISS - Scan File ${MESSAGE} IP=127.0.0.2 - Do Not Expect Symbol IP_MAP - -MAP - IP MASK - Scan File ${MESSAGE} IP=10.1.0.10 - Expect Symbol IP_MAP - -MAP - IP MASK MISS - Scan File ${MESSAGE} IP=11.1.0.10 - Do Not Expect Symbol IP_MAP - -MAP - IP V6 - Scan File ${MESSAGE} IP=::1 - Expect Symbol IP_MAP - -MAP - IP V6 MISS - Scan File ${MESSAGE} IP=fe80::1 - Do Not Expect Symbol IP_MAP - -MAP - FROM - Scan File ${MESSAGE} From=user@example.com - Expect Symbol FROM_MAP - -MAP - COMBINED IP MASK FROM - Scan File ${MESSAGE} IP=10.1.0.10 From=user@example.com - Expect Symbol With Score COMBINED_MAP_AND 10 - Expect Symbol COMBINED_MAP_OR - -MAP - COMBINED IP MASK ONLY - Scan File ${MESSAGE} IP=10.1.0.10 - Do Not Expect Symbol COMBINED_MAP_AND - Expect Symbol COMBINED_MAP_OR - -MAP - COMBINED FROM ONLY - Scan File ${MESSAGE} From=user@example.com - Do Not Expect Symbol COMBINED_MAP_AND - Expect Symbol COMBINED_MAP_OR - -MAP - COMBINED MISS - Scan File ${MESSAGE} IP=11.1.0.10 From=user@other.com - Do Not Expect Symbol COMBINED_MAP_AND - Do Not Expect Symbol COMBINED_MAP_OR - -MAP - FROM MISS - Scan File ${MESSAGE} From=user@other.com - Do Not Expect Symbol FROM_MAP - -MAP - FROM REGEXP - Scan File ${MESSAGE} From=user123@test.com - Expect Symbol REGEXP_MAP - Scan File ${MESSAGE} From=somebody@example.com - Expect Symbol REGEXP_MAP - -MAP - FROM REGEXP MISS - Scan File ${MESSAGE} From=user@other.org - Do Not Expect Symbol REGEXP_MAP - -MAP - RCPT DOMAIN HIT - Scan File ${MESSAGE} Rcpt=user@example.com - Expect Symbol RCPT_DOMAIN - -MAP - RCPT DOMAIN MISS - Scan File ${MESSAGE} Rcpt=example.com@user - Do Not Expect Symbol RCPT_DOMAIN - -MAP - RCPT USER HIT - Scan File ${MESSAGE} Rcpt=bob@example.com - Expect Symbol RCPT_USER - -MAP - RCPT USER MISS - Scan File ${MESSAGE} From=example.com@bob - Do Not Expect Symbol RCPT_USER - -MAP - DEPENDS HIT - Scan File ${MESSAGE} IP=88.99.142.95 From=user123@rspamd.com - Expect Symbol DEPS_MAP - -MAP - DEPENDS MISS - Scan File ${MESSAGE} IP=1.2.3.4 From=user123@rspamd.com - Do Not Expect Symbol DEPS_MAP - -MAP - MULSYM PLAIN - Scan File ${MESSAGE} Rcpt=user1@example.com - Expect Symbol RCPT_MAP - -MAP - MULSYM SCORE - Scan File ${MESSAGE} Rcpt=user2@example.com - Expect Symbol With Score RCPT_MAP 10.0 - -MAP - MULSYM SYMBOL - Scan File ${MESSAGE} Rcpt=user3@example.com - Expect Symbol With Score SYM1 1.0 - -MAP - MULSYM SYMBOL MISS - Scan File ${MESSAGE} Rcpt=user4@example.com - Expect Symbol With Score RCPT_MAP 1.0 - -MAP - MULSYM SYMBOL + SCORE - Scan File ${MESSAGE} Rcpt=user5@example.com - Expect Symbol With Score SYM1 -10.1 - -MAP - UTF - Scan File ${UTF_MESSAGE} - Expect Symbol HEADER_MAP - -MAP - UTF MISS - Scan File ${MESSAGE} - Do Not Expect Symbol HEADER_MAP - -MAP - HOSTNAME - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com - Expect Symbol HOSTNAME_MAP - -MAP - HOSTNAME MISS - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com - Do Not Expect Symbol HOSTNAME_MAP - -MAP - TOP - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.au - Expect Symbol HOSTNAME_TOP_MAP - -MAP - TOP MISS - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.bg - Do Not Expect Symbol HOSTNAME_TOP_MAP - -MAP - CDB - HOSTNAME - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com - Expect Symbol CDB_HOSTNAME - -MAP - CDB - HOSTNAME MISS - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com - Do Not Expect Symbol CDB_HOSTNAME - -MAP - REDIS - HOSTNAME - Redis HSET hostname redistest.example.net ${EMPTY} - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net - Expect Symbol REDIS_HOSTNAME - -MAP - REDIS - HOSTNAME MISS - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com - Do Not Expect Symbol REDIS_HOSTNAME - -MAP - REDIS - HOSTNAME - EXPANSION - HIT - Redis HSET 127.0.0.1.foo.com redistest.example.net ${EMPTY} - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net Rcpt=bob@foo.com - Expect Symbol REDIS_HOSTNAME_EXPANSION - -MAP - REDIS - HOSTNAME - EXPANSION - MISS - Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net Rcpt=bob@bar.com - Do Not Expect Symbol REDIS_HOSTNAME_EXPANSION - -MAP - REDIS - IP - Redis HSET ipaddr 127.0.0.1 ${EMPTY} - Scan File ${MESSAGE} IP=127.0.0.1 - Expect Symbol REDIS_IPADDR - -MAP - REDIS - IP - MISS - Scan File ${MESSAGE} IP=8.8.8.8 - Do Not Expect Symbol REDIS_IPADDR - -MAP - REDIS - FROM - Redis HSET emailaddr from@rspamd.tk ${EMPTY} - Scan File ${MESSAGE} From=from@rspamd.tk - Expect Symbol REDIS_FROMADDR - -MAP - REDIS - FROM MISS - Scan File ${MESSAGE} From=user@other.com - Do Not Expect Symbol REDIS_FROMADDR - -MAP - REDIS - URL TLD - HIT - Redis HSET hostname example.com ${EMPTY} - Scan File ${URL1} - Expect Symbol REDIS_URL_TLD - -MAP - REDIS - URL TLD - MISS - Scan File ${URL2} - Do Not Expect Symbol REDIS_URL_TLD - -MAP - REDIS - URL RE FULL - HIT - Redis HSET fullurlre html ${EMPTY} - Scan File ${URL2} - Expect Symbol REDIS_URL_RE_FULL - -MAP - REDIS - URL RE FULL - MISS - Scan File ${URL1} - Do Not Expect Symbol REDIS_URL_RE_FULL - -MAP - REDIS - URL FULL - HIT - Redis HSET fullurl https://www.example.com/foo?a=b ${EMPTY} - Scan File ${URL1} - Expect Symbol REDIS_URL_FULL - -MAP - REDIS - URL FULL - MISS - Scan File ${URL2} - Do Not Expect Symbol REDIS_URL_FULL - -MAP - REDIS - URL PHISHED - HIT - Redis HSET phishedurl www.rspamd.com ${EMPTY} - Scan File ${URL3} - Expect Symbol REDIS_URL_PHISHED - -MAP - REDIS - URL PHISHED - MISS - Scan File ${URL4} - Do Not Expect Symbol REDIS_URL_PHISHED - -MAP - REDIS - URL PLAIN REGEX - HIT - Redis HSET urlre www ${EMPTY} - Scan File ${URL3} - Expect Symbol REDIS_URL_RE_PLAIN - -MAP - REDIS - URL PLAIN REGEX - MISS - Scan File ${URL4} - Do Not Expect Symbol REDIS_URL_RE_PLAIN - -MAP - REDIS - URL TLD REGEX - HIT - Redis HSET tldre net ${EMPTY} - Scan File ${URL5} - Expect Symbol REDIS_URL_RE_TLD - -MAP - REDIS - URL TLD REGEX - MISS - Scan File ${URL4} - Do Not Expect Symbol REDIS_URL_RE_TLD - -MAP - REDIS - URL NOFILTER - HIT - Redis HSET urlnofilter www.example.net ${EMPTY} - Scan File ${URL5} - Expect Symbol REDIS_URL_NOFILTER - -MAP - REDIS - URL NOFILTER - MISS - Scan File ${URL4} - Do Not Expect Symbol REDIS_URL_NOFILTER - -MAP - REDIS - ASN - HIT - Redis HSET asn 15169 ${EMPTY} - Scan File ${MESSAGE} IP=8.8.8.8 - Expect Symbol REDIS_ASN - -MAP - REDIS - ASN - MISS - Scan File ${MESSAGE} IP=46.228.47.114 - Do Not Expect Symbol REDIS_ASN - -MAP - REDIS - CC - HIT - Redis HSET cc US ${EMPTY} - Scan File ${MESSAGE} IP=8.8.8.8 - Expect Symbol REDIS_COUNTRY - -MAP - REDIS - CC - MISS - Scan File ${MESSAGE} IP=46.228.47.114 - Do Not Expect Symbol REDIS_COUNTRY - -MAP - REDIS - ASN FILTERED - HIT - Redis HSET asn 1 ${EMPTY} - Scan File ${MESSAGE} IP=8.8.8.8 - Expect Symbol REDIS_ASN_FILTERED - -MAP - REDIS - ASN FILTERED - MISS - Scan File ${MESSAGE} IP=46.228.47.114 - Do Not Expect Symbol REDIS_ASN_FILTERED - -MAP - RECEIVED - IP MINMAX POS - ONE - Scan File ${RCVD1} - Expect Symbol RCVD_TEST_01 - Do Not Expect Symbol RCVD_TEST_02 - -# Relies on parsing of shitty received -#MAP - RECEIVED - IP MINMAX POS - TWO / RCVD_AUTHED_ONE HIT -# Scan File ${RCVD2} -# Expect Symbol RCVD_TEST_02 -# Do Not Expect Symbol RCVD_TEST_01 -# Expect Symbol RCVD_AUTHED_ONE - -MAP - RECEIVED - REDIS - Redis HSET RCVD_TEST 2a01:7c8:aab6:26d:5054:ff:fed1:1da2 ${EMPTY} - Scan File ${RCVD1} - Expect Symbol RCVD_TEST_REDIS_01 - -RCVD_AUTHED_ONE & RCVD_AUTHED_TWO - MISS - Scan File ${RCVD3} - Do Not Expect Symbol RCVD_AUTHED_ONE - Do Not Expect Symbol RCVD_AUTHED_TWO - -RCVD_AUTHED_TWO HIT / RCVD_AUTHED_ONE MISS - Scan File ${RCVD4} - Expect Symbol RCVD_AUTHED_TWO - Do Not Expect Symbol RCVD_AUTHED_ONE - -FREEMAIL_CC - Scan File ${FREEMAIL_CC} - Expect Symbol With Score And Exact Options FREEMAIL_CC 19.00 test.com test1.com test2.com test3.com test4.com test5.com test6.com test7.com test8.com test9.com test10.com test11.com test12.com test13.com test14.com - -MAP - MULTISYMBOL DISABLED - Scan File ${MESSAGE} Rcpt=user3@example.com - Expect Symbol With Exact Options RCPT_MAP_NOMULTISYM user3@example.com SYM1 diff --git a/test/functional/cases/104_get_from.robot b/test/functional/cases/104_get_from.robot deleted file mode 100644 index 84b754f37..000000000 --- a/test/functional/cases/104_get_from.robot +++ /dev/null @@ -1,52 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_script.conf -${OPTIONS1} ,user@example.org,user,example.org -${OPTIONS2} First Last,user@example.org,user,example.org -${OPTIONS3} First M. Last,user@example.org,user,example.org -${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/get_from.lua -${RSPAMD_SCOPE} Suite -${SYMBOL} GET_FROM - -*** Test Cases *** -task:get_from('mime') - address only - Scan File ${RSPAMD_TESTDIR}/messages/from/from.eml - Expect Symbol ${SYMBOL} - -task:get_from('mime') - comment - Scan File ${RSPAMD_TESTDIR}/messages/from/from_comment.eml - Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS1} - -task:get_from('mime') - display name - Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn.eml - Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2} - -task:get_from('mime') - display name Base64 - Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn_base64.eml - Expect Symbol With Exact Options ${SYMBOL} Кириллица,user@example.org,user,example.org - -task:get_from('mime') - display name and comment - Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn_comment.eml - Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2} - -task:get_from('mime') - quoted display name - Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn.eml - Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} - -task:get_from('mime') - quoted display name and comment - Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_comment.eml - Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} - -task:get_from('mime') - quoted in the middle of DN (outer spaces) - Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_middle.eml - Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} - -task:get_from('mime') - quoted in the middle of DN (inner spaces) - Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_middle_inner.eml - Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} diff --git a/test/functional/cases/105_mimetypes.robot b/test/functional/cases/105_mimetypes.robot deleted file mode 100644 index aa344aebd..000000000 --- a/test/functional/cases/105_mimetypes.robot +++ /dev/null @@ -1,66 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/mime_types.conf -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -Zip - Scan File ${RSPAMD_TESTDIR}/messages/zip.eml - Expect Symbol With Exact Options MIME_BAD_EXTENSION exe - -Zip Double Bad Extension - Scan File ${RSPAMD_TESTDIR}/messages/zip-doublebad.eml - Expect Symbol With Exact Options MIME_DOUBLE_BAD_EXTENSION .pdf.exe - -Next-to-last Double Bad Extension - Scan File ${RSPAMD_TESTDIR}/messages/next2last-doublebad.eml - Expect Symbol With Exact Options MIME_DOUBLE_BAD_EXTENSION .scr.xz - -Date is followed by Bad Extension - Scan File ${RSPAMD_TESTDIR}/messages/rar-date-bad-ext.eml - Expect Symbol With Exact Options MIME_BAD_EXTENSION scr - Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION - -Dotted file name is followed by Bad Extension - Scan File ${RSPAMD_TESTDIR}/messages/bad_ext.dotted_file_name.eml - Expect Symbol With Exact Options MIME_BAD_EXTENSION exe - Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION - -Dotted numbers in parentheses is followed by Bad Extension - Scan File ${RSPAMD_TESTDIR}/messages/next2last-digits_in_parens.eml - Expect Symbol With Exact Options MIME_BAD_EXTENSION msi - Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION - -Dotted numbers in square brackets is followed by Bad Extension - Scan File ${RSPAMD_TESTDIR}/messages/next2last-digits_in_brackets.eml - Expect Symbol With Exact Options MIME_BAD_EXTENSION msi - Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION - -Rar4 - Scan File ${RSPAMD_TESTDIR}/messages/rar4.eml - Expect Symbol With Exact Options MIME_BAD_EXTENSION exe - -Cloaked Archive Extension - Scan File ${RSPAMD_TESTDIR}/messages/f.zip.gz.eml - Expect Symbol With Exact Options MIME_ARCHIVE_IN_ARCHIVE .zip.gz zip - -Multipart Archive Extension - Scan File ${RSPAMD_TESTDIR}/messages/f.zip.001.eml - Do Not Expect Symbol MIME_ARCHIVE_IN_ARCHIVE - -Exe file, but name in filename_whitelist - Scan File ${RSPAMD_TESTDIR}/messages/exe_attm.eml - Do Not Expect Symbol MIME_BAD_EXTENSION - Do Not Expect Symbol MIME_BAD_ATTACHMENT - Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION - -Empty text part should not be treat as html - Scan File ${RSPAMD_TESTDIR}/messages/empty-plain-text.eml - Do Not Expect Symbol FORGED_OUTLOOK_HTML diff --git a/test/functional/cases/106_mid.robot b/test/functional/cases/106_mid.robot deleted file mode 100644 index a42b098aa..000000000 --- a/test/functional/cases/106_mid.robot +++ /dev/null @@ -1,36 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/mid.conf -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -MID - invalid Message-ID - Scan File ${RSPAMD_TESTDIR}/messages/fws_fp.eml - Expect Symbol With Score INVALID_MSGID 1.70 - Do Not Expect Symbol MISSING_MID - Do Not Expect Symbol INVALID_MSGID_ALLOWED - -MID - invalid Message-ID allowed - Scan File ${RSPAMD_TESTDIR}/messages/invalid_mid_allowed.eml - Expect Symbol With Score INVALID_MSGID_ALLOWED 1.00 - Do Not Expect Symbol MISSING_MID - Do Not Expect Symbol INVALID_MSGID - -MID - missing Message-ID - Scan File ${RSPAMD_TESTDIR}/messages/freemail.eml - Expect Symbol With Score MISSING_MID 2.50 - Do Not Expect Symbol MISSING_MID_ALLOWED - Do Not Expect Symbol INVALID_MSGID - -MID - missing Message-ID allowed - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml - Expect Symbol With Score MISSING_MID_ALLOWED 1.00 - Do Not Expect Symbol MISSING_MID - Do Not Expect Symbol INVALID_MSGID diff --git a/test/functional/cases/114_phishing.robot b/test/functional/cases/114_phishing.robot deleted file mode 100644 index 4bb54895b..000000000 --- a/test/functional/cases/114_phishing.robot +++ /dev/null @@ -1,27 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/phishing.conf -${MESSAGE1} ${RSPAMD_TESTDIR}/messages/phishing1.eml -${MESSAGE2} ${RSPAMD_TESTDIR}/messages/phishing2.eml -${MESSAGE3} ${RSPAMD_TESTDIR}/messages/phishing3.eml -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat - -*** Test Cases *** -TEST PHISHING - Scan File ${MESSAGE1} - Expect Symbol PHISHING - -TEST PHISHING STRICT ONE - Scan File ${MESSAGE2} - Expect Symbol STRICT_PHISHING - -TEST PHISHING STRICT TWO - Scan File ${MESSAGE3} - Expect Symbol STRICTER_PHISHING diff --git a/test/functional/cases/115_dmarc.robot b/test/functional/cases/115_dmarc.robot deleted file mode 100644 index d0ba8c72d..000000000 --- a/test/functional/cases/115_dmarc.robot +++ /dev/null @@ -1,88 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/dmarc.conf -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat - -*** Test Cases *** -DMARC NONE PASS DKIM - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pass_none.eml - Expect Symbol DMARC_POLICY_ALLOW - -DMARC NONE PASS SPF - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml - ... IP=8.8.4.4 From=foo@spf.cacophony.za.org - Expect Symbol DMARC_POLICY_ALLOW - -DMARC NONE FAIL - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml - Expect Symbol DMARC_POLICY_SOFTFAIL - -DMARC REJECT FAIL - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_reject.eml - Expect Symbol DMARC_POLICY_REJECT - -DMARC QUARANTINE FAIL - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_quarantine.eml - Expect Symbol DMARC_POLICY_QUARANTINE - -DMARC SP NONE FAIL - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_none.eml - Expect Symbol DMARC_POLICY_SOFTFAIL - -DMARC SP REJECT FAIL - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_reject.eml - Expect Symbol DMARC_POLICY_REJECT - -DMARC SP QUARANTINE FAIL - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_quarantine.eml - Expect Symbol DMARC_POLICY_QUARANTINE - -DMARC SUBDOMAIN FAIL DKIM STRICT ALIGNMENT - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml - Expect Symbol DMARC_POLICY_REJECT - -DMARC SUBDOMAIN PASS DKIM RELAXED ALIGNMENT - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml - Expect Symbol DMARC_POLICY_ALLOW - -DMARC SUBDOMAIN PASS SPF STRICT ALIGNMENT - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml - ... IP=37.48.67.26 From=foo@yo.mom.za.org - Expect Symbol DMARC_POLICY_ALLOW - -DMARC SUBDOMAIN FAIL SPF STRICT ALIGNMENT - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml - ... IP=37.48.67.26 From=foo@mom.za.org - Expect Symbol DMARC_POLICY_REJECT - -DMARC SUBDOMAIN PASS SPF RELAXED ALIGNMENT - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail.eml - ... IP=37.48.67.26 From=foo@mom.za.org - Expect Symbol DMARC_POLICY_ALLOW - -DMARC DNSFAIL - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/dmarc_tmpfail.eml - ... IP=37.48.67.26 From=foo@mom.za.org - Expect Symbol DMARC_DNSFAIL - -DMARC NA NXDOMAIN - Scan File ${RSPAMD_TESTDIR}/messages/utf.eml - ... IP=37.48.67.26 From=foo@mom.za.org - Expect Symbol DMARC_NA - -DMARC PCT ZERO REJECT - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pct_none.eml - ... IP=37.48.67.26 From=foo@mom.za.org - Expect Symbol DMARC_POLICY_QUARANTINE - -DMARC PCT ZERO SP QUARANTINE - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pct_none1.eml - ... IP=37.48.67.26 From=foo@mom.za.org - Expect Symbol DMARC_POLICY_SOFTFAIL diff --git a/test/functional/cases/117_spf.robot b/test/functional/cases/117_spf.robot deleted file mode 100644 index 1887089ef..000000000 --- a/test/functional/cases/117_spf.robot +++ /dev/null @@ -1,137 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/dmarc.conf -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat - -*** Test Cases *** -SPF FAIL UNRESOLVEABLE INCLUDE - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=37.48.67.26 From=x@fail3.org.org.za - Expect Symbol R_SPF_FAIL - -SPF DNSFAIL FAILED INCLUDE UNALIGNED - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@fail2.org.org.za - Expect Symbol R_SPF_DNSFAIL - Expect Symbol DMARC_POLICY_SOFTFAIL - -SPF ALLOW UNRESOLVEABLE INCLUDE - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@fail3.org.org.za - Expect Symbol R_SPF_ALLOW - -SPF ALLOW FAILED INCLUDE - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.4.4 From=x@fail2.org.org.za - Expect Symbol R_SPF_ALLOW - -SPF NA NA - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@za - Expect Symbol R_SPF_NA - -SPF NA NOREC - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@co.za - Expect Symbol R_SPF_NA - -SPF NA NXDOMAIN - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@zzzzaaaa - Expect Symbol R_SPF_NA - -SPF PERMFAIL UNRESOLVEABLE REDIRECT - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@fail4.org.org.za - Expect Symbol R_SPF_PERMFAIL - -SPF REDIRECT NO USEABLE ELEMENTS - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@fail10.org.org.za - Expect Symbol R_SPF_PERMFAIL - -SPF DNSFAIL FAILED REDIRECT - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@fail1.org.org.za - Expect Symbol R_SPF_DNSFAIL - -SPF PERMFAIL NO USEABLE ELEMENTS - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@fail5.org.org.za - Expect Symbol R_SPF_PERMFAIL - -SPF FAIL - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@example.net - Expect Symbol R_SPF_FAIL - -SPF FAIL UNRESOLVEABLE MX - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=1.2.3.4 From=x@fail6.org.org.za - Expect Symbol R_SPF_FAIL - -SPF FAIL UNRESOLVEABLE A - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=1.2.3.4 From=x@fail7.org.org.za - Expect Symbol R_SPF_FAIL - -SPF DNSFAIL FAILED A - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=1.2.3.4 From=x@fail8.org.org.za - Expect Symbol R_SPF_DNSFAIL - -SPF DNSFAIL FAILED MX - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=1.2.3.4 From=x@fail9.org.org.za - Expect Symbol R_SPF_DNSFAIL - -SPF DNSFAIL FAILED RECORD - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=1.2.3.4 From=x@www.dnssec-failed.org - Expect Symbol R_SPF_DNSFAIL - -SPF PASS INCLUDE - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@pass1.org.org.za - Expect Symbol R_SPF_ALLOW - -SPF PTRS - Scan File /dev/null - ... IP=88.99.142.95 From=foo@crazyspf.cacophony.za.org - Expect Symbol R_SPF_ALLOW - Scan File /dev/null - ... IP=128.66.0.1 From=foo@crazyspf.cacophony.za.org - Expect Symbol R_SPF_FAIL - Scan File /dev/null - ... IP=209.85.216.182 From=foo@crazyspf.cacophony.za.org - Expect Symbol R_SPF_FAIL - #Scan File /dev/null - #... IP=98.138.91.166 From=foo@crazyspf.cacophony.za.org - #Expect Symbol R_SPF_ALLOW - #Scan File /dev/null - #... IP=98.138.91.167 From=foo@crazyspf.cacophony.za.org - #Expect Symbol R_SPF_ALLOW - #Scan File /dev/null - #... IP=98.138.91.168 From=foo@crazyspf.cacophony.za.org - #Expect Symbol R_SPF_ALLOW - -SPF PERMFAIL REDIRECT WITHOUT SPF - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim4.eml - ... IP=192.0.2.1 From=a@fail1.org.org.za - Expect Symbol R_SPF_DNSFAIL - -SPF EXTERNAL RELAY - Scan File ${RSPAMD_TESTDIR}/messages/external_relay.eml - Expect Symbol With Score And Exact Options R_SPF_ALLOW 1.0 +ip4:37.48.67.26 - -SPF UPPERCASE - Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml - ... IP=8.8.8.8 From=x@fail11.org.org.za - Expect Symbol R_SPF_ALLOW diff --git a/test/functional/cases/160_antivirus.robot b/test/functional/cases/160_antivirus.robot deleted file mode 100644 index cac3a1893..000000000 --- a/test/functional/cases/160_antivirus.robot +++ /dev/null @@ -1,142 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Redis Setup -Suite Teardown Antivirus Teardown -Library Process -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/antivirus.conf -${MESSAGE2} ${RSPAMD_TESTDIR}/messages/freemail.eml -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -CLAMAV MISS - Run Dummy Clam ${RSPAMD_PORT_CLAM} - Scan File ${MESSAGE} - Do Not Expect Symbol CLAM_VIRUS - Shutdown clamav - -CLAMAV HIT - Run Dummy Clam ${RSPAMD_PORT_CLAM} 1 - Scan File ${MESSAGE2} - Expect Symbol CLAM_VIRUS - Do Not Expect Symbol CLAMAV_VIRUS_FAIL - Shutdown clamav - -CLAMAV CACHE HIT - Scan File ${MESSAGE2} - Expect Symbol CLAM_VIRUS - Do Not Expect Symbol CLAMAV_VIRUS_FAIL - -CLAMAV CACHE MISS - Scan File ${MESSAGE} - Do Not Expect Symbol CLAM_VIRUS - Do Not Expect Symbol CLAMAV_VIRUS_FAIL - -FPROT MISS - Run Dummy Fprot ${RSPAMD_PORT_FPROT} - Scan File ${MESSAGE2} - Do Not Expect Symbol FPROT_VIRUS - Do Not Expect Symbol FPROT_EICAR - Shutdown fport - -FPROT HIT - PATTERN - Run Dummy Fprot ${RSPAMD_PORT_FPROT} 1 - Run Dummy Fprot ${RSPAMD_PORT_FPROT2_DUPLICATE} 1 /tmp/dummy_fprot_dupe.pid - Scan File ${MESSAGE} - Expect Symbol FPROT_EICAR - Do Not Expect Symbol CLAMAV_VIRUS - # Also check ordered pattern match - Expect Symbol FPROT2_VIRUS_DUPLICATE_PATTERN - Do Not Expect Symbol FPROT2_VIRUS_DUPLICATE_DEFAULT - Do Not Expect Symbol FPROT2_VIRUS_DUPLICATE_NOPE - Shutdown fport - Shutdown fport duplicate - -FPROT CACHE HIT - Scan File ${MESSAGE} - Expect Symbol FPROT_EICAR - Do Not Expect Symbol CLAMAV_VIRUS - # Also check ordered pattern match - Expect Symbol FPROT2_VIRUS_DUPLICATE_PATTERN - Do Not Expect Symbol FPROT2_VIRUS_DUPLICATE_DEFAULT - -FPROT CACHE MISS - Scan File ${MESSAGE2} - Do Not Expect Symbol FPROT_VIRUS - -AVAST MISS - Run Dummy Avast ${RSPAMD_PORT_AVAST} - Scan File ${MESSAGE} - Do Not Expect Symbol AVAST_VIRUS - Shutdown avast - -AVAST HIT - Run Dummy Avast ${RSPAMD_PORT_AVAST} 1 - Scan File ${MESSAGE2} - Expect Symbol AVAST_VIRUS - Do Not Expect Symbol AVAST_VIRUS_FAIL - Shutdown avast - -AVAST CACHE HIT - Scan File ${MESSAGE2} - Expect Symbol AVAST_VIRUS - Do Not Expect Symbol AVAST_VIRUS_FAIL - -AVAST CACHE MISS - Scan File ${MESSAGE} - Do Not Expect Symbol AVAST_VIRUS - Do Not Expect Symbol AVAST_VIRUS_FAIL - -*** Keywords *** -Antivirus Teardown - Rspamd Redis Teardown - Shutdown clamav - Shutdown fport - Shutdown avast - Terminate All Processes kill=True - -Shutdown clamav - ${clamav_pid} = Get File if exists /tmp/dummy_clamav.pid - Run Keyword if ${clamav_pid} Shutdown Process With Children ${clamav_pid} - -Shutdown fport - ${fport_pid} = Get File if exists /tmp/dummy_fprot.pid - Run Keyword if ${fport_pid} Shutdown Process With Children ${fport_pid} - -Shutdown fport duplicate - ${fport_pid} = Get File if exists /tmp/dummy_fprot_dupe.pid - Run Keyword if ${fport_pid} Shutdown Process With Children ${fport_pid} - -Shutdown avast - ${avast_pid} = Get File if exists /tmp/dummy_avast.pid - Run Keyword if ${avast_pid} Shutdown Process With Children ${avast_pid} - -Run Dummy - [Arguments] @{varargs} - ${process} = Start Process @{varargs} - ${pid} = Get From List ${varargs} -1 - ${pass} = Run Keyword And Return Status Wait Until Created ${pid} - Run Keyword If ${pass} Return From Keyword - Wait For Process ${process} - ${res} = Get Process Result ${process} - Log To Console ${res.stdout} - Log To Console ${res.stderr} - Fail Dummy server failed to start - -Run Dummy Clam - [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_clamav.pid - Run Dummy ${RSPAMD_TESTDIR}/util/dummy_clam.py ${port} ${found} ${pid} - -Run Dummy Fprot - [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_fprot.pid - Run Dummy ${RSPAMD_TESTDIR}/util/dummy_fprot.py ${port} ${found} ${pid} - -Run Dummy Avast - [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_avast.pid - Run Dummy ${RSPAMD_TESTDIR}/util/dummy_avast.py ${port} ${found} ${pid} diff --git a/test/functional/cases/220_http.robot b/test/functional/cases/220_http.robot deleted file mode 100644 index 690222855..000000000 --- a/test/functional/cases/220_http.robot +++ /dev/null @@ -1,68 +0,0 @@ -*** Settings *** -Test Setup Http Setup -Test Teardown Http Teardown -Library Process -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/http.lua -${RSPAMD_SCOPE} Test -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -Simple HTTP request - Check url /request get HTTP_DNS_200 HTTP_200 HTTP_CORO_DNS_200 HTTP_CORO_200 method_get hello world HTTP_CORO_200 (0.00)[hello world] - Check url /request post HTTP_DNS_200 HTTP_200 HTTP_CORO_DNS_200 HTTP_CORO_200 method_post hello post HTTP_CORO_DNS_200 (0.00)[hello post] - -*** Test Cases *** -HTTP request 403 - Check url /error_403 get HTTP_DNS_403 HTTP_403 HTTP_CORO_DNS_403 HTTP_CORO_403 method_get - Check url /error_403 post HTTP_DNS_403 HTTP_403 HTTP_CORO_DNS_403 HTTP_CORO_403 method_post - - -*** Test Cases *** -HTTP timeout - Check url /timeout get HTTP_ERROR HTTP_ERROR HTTP_CORO_DNS_ERROR HTTP_CORO_ERROR method_get IO timeout - Check url /timeout post HTTP_DNS_ERROR HTTP_ERROR HTTP_CORO_DNS_ERROR HTTP_CORO_ERROR method_post IO timeout - - -*** Test Cases *** -HTTP empty response - Check url /empty get HTTP_ERROR HTTP_ERROR HTTP_CORO_DNS_ERROR HTTP_CORO_ERROR method_get IO read error: unexpected EOF - Check url /empty post HTTP_DNS_ERROR HTTP_ERROR HTTP_CORO_DNS_ERROR HTTP_CORO_ERROR method_post IO read error: unexpected EOF - -SSL Large HTTP request - Scan File ${MESSAGE} - Expect Symbol HTTP_SSL_LARGE - -*** Keywords *** -Http Setup - Run Dummy Http - Run Dummy Https - Rspamd Setup - -Http Teardown - ${http_pid} = Get File /tmp/dummy_http.pid - Shutdown Process With Children ${http_pid} - ${https_pid} = Get File /tmp/dummy_https.pid - Shutdown Process With Children ${https_pid} - Rspamd Teardown - -Run Dummy Http - ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_http.py - Wait Until Created /tmp/dummy_http.pid - -Run Dummy Https - ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_https.py ${RSPAMD_TESTDIR}/util/server.pem - Wait Until Created /tmp/dummy_https.pid - -Check url - [Arguments] ${url} ${method} @{expect_results} - ${result} = Scan Message With Rspamc --header=url:${url} --header=method:${method} ${MESSAGE} - FOR ${expect} IN @{expect_results} - Check Rspamc ${result} ${expect} - END diff --git a/test/functional/cases/230_tcp.robot b/test/functional/cases/230_tcp.robot deleted file mode 100644 index f44bdda15..000000000 --- a/test/functional/cases/230_tcp.robot +++ /dev/null @@ -1,72 +0,0 @@ -*** Settings *** -Suite Setup Servers Setup -Suite Teardown Servers Teardown -Library Process -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/tcp.lua -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -Simple TCP request - Scan File ${MESSAGE} - Expect Symbol HTTP_ASYNC_RESPONSE - Expect Symbol HTTP_ASYNC_RESPONSE_2 - -SSL TCP request - Scan File ${MESSAGE} - Expect Symbol With Exact Options TCP_SSL_RESPONSE hello - Expect Symbol With Exact Options TCP_SSL_RESPONSE_2 hello - -SSL Large TCP request - Scan File ${MESSAGE} - Expect Symbol TCP_SSL_LARGE - Expect Symbol TCP_SSL_LARGE_2 - -Sync API TCP request - Scan File ${MESSAGE} - Expect Symbol HTTP_SYNC_RESPONSE - Should Contain ${SCAN_RESULT}[symbols][HTTP_SYNC_RESPONSE][options][0] hello world - Should Contain ${SCAN_RESULT}[symbols][HTTP_SYNC_RESPONSE_2][options][0] hello post - -Sync API TCP get request - Check url /request get HTTP_SYNC_EOF_get hello world - Check url /content-length get HTTP_SYNC_CONTENT_get hello world - -Sync API TCP post request - Check url /request post HTTP_SYNC_EOF_post hello post - Check url /content-length post HTTP_SYNC_CONTENT_post hello post - -*** Keywords *** -Servers Setup - Run Dummy Http - Run Dummy Ssl - Rspamd Setup - -Servers Teardown - ${http_pid} = Get File /tmp/dummy_http.pid - Shutdown Process With Children ${http_pid} - ${ssl_pid} = Get File /tmp/dummy_ssl.pid - Shutdown Process With Children ${ssl_pid} - Rspamd Teardown - -Run Dummy Http - [Arguments] - ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_http.py - Wait Until Created /tmp/dummy_http.pid timeout=2 second - -Run Dummy Ssl - [Arguments] - ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_ssl.py ${RSPAMD_TESTDIR}/util/server.pem - Wait Until Created /tmp/dummy_ssl.pid timeout=2 second - -Check url - [Arguments] ${url} ${method} ${expect_symbol} @{expect_options} - Scan File ${MESSAGE} URL=${url} Method=${method} - Expect Symbol With Exact Options ${expect_symbol} @{expect_options} diff --git a/test/functional/cases/231_tcp_down.robot b/test/functional/cases/231_tcp_down.robot deleted file mode 100644 index 3403be6ae..000000000 --- a/test/functional/cases/231_tcp_down.robot +++ /dev/null @@ -1,31 +0,0 @@ -*** Settings *** -Test Setup Rspamd Setup -Test Teardown Rspamd Teardown -Library Process -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/tcp.lua -${RSPAMD_SCOPE} Test -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** - -Sync API TCP get request when server is down - [Documentation] We don't create HTTP server here, that's why - ... all requests fail with "connection refused" - Check url /request get HTTP_ASYNC_RESPONSE (0.00)[Socket error detected: Connection refused] - Check url /content-length HTTP_SYNC_WRITE_ERROR (0.00)[Socket error detected: Connection refused] - - -*** Keywords *** -Check url - [Arguments] ${url} ${method} @{expect_results} - ${result} = Scan Message With Rspamc --header=url:${url} --header=method:${method} ${MESSAGE} - FOR ${expect} IN @{expect_results} - Check Rspamc ${result} ${expect} - END diff --git a/test/functional/cases/240_redis.robot b/test/functional/cases/240_redis.robot deleted file mode 100644 index 18babdc79..000000000 --- a/test/functional/cases/240_redis.robot +++ /dev/null @@ -1,26 +0,0 @@ -*** Settings *** -Test Setup Rspamd Redis Setup -Test Teardown Rspamd Redis Teardown -Library Process -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py -Suite Teardown Terminate All Processes kill=True - - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/redis.conf -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${REDIS_SCOPE} Test -${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/redis.lua -${RSPAMD_SCOPE} Test -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - - -*** Test Cases *** -Redis client - Redis SET test_key test value - Scan File ${MESSAGE} - Expect Symbol With Exact Options REDIS hello from lua on redis - Expect Symbol With Exact Options REDIS_ASYNC test value - Expect Symbol With Exact Options REDIS_ASYNC201809 test value diff --git a/test/functional/cases/241_redis_is_dead.robot b/test/functional/cases/241_redis_is_dead.robot index 1ff2765a7..4c12c1433 100644 --- a/test/functional/cases/241_redis_is_dead.robot +++ b/test/functional/cases/241_redis_is_dead.robot @@ -7,7 +7,6 @@ Library Process Library ${RSPAMD_TESTDIR}/lib/rspamd.py Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot Variables ${RSPAMD_TESTDIR}/lib/vars.py -Suite Teardown Terminate All Processes kill=True *** Variables *** diff --git a/test/functional/cases/250_dns.robot b/test/functional/cases/250_dns.robot deleted file mode 100644 index 8c6a422ec..000000000 --- a/test/functional/cases/250_dns.robot +++ /dev/null @@ -1,25 +0,0 @@ -*** Settings *** -Test Setup Rspamd Setup -Test Teardown Rspamd Teardown -Library Process -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/dns.lua -${RSPAMD_SCOPE} Test -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -Simple DNS request - Scan File ${MESSAGE} To-Resolve=example.com - Expect Symbol With Exact Options DNS_SYNC 93.184.216.34 - Expect Symbol With Exact Options DNS 93.184.216.34 - -Faulty DNS request - Scan File ${MESSAGE} To-Resolve=not-resolvable.com - Expect Symbol With Exact Options DNS_SYNC_ERROR requested record is not found - Expect Symbol With Exact Options DNS_ERROR requested record is not found diff --git a/test/functional/cases/260_regex.robot b/test/functional/cases/260_regex.robot index 5cf48fe18..d5055b079 100644 --- a/test/functional/cases/260_regex.robot +++ b/test/functional/cases/260_regex.robot @@ -26,3 +26,8 @@ Newlines Expect Symbol With Option FOUND_URL https://google.com/maps/ Expect Symbol With Option FOUND_URL https://www.google.com/search?q\=hello world&oq\=hello world&aqs\=chrome..69i57j0l5.3045j0j7&sourceid\=chrome&ie\=UTF-8 Expect Symbol With Option FOUND_URL https://github.com/google/sanitizers/wiki/AddressSanitizer + +Dynamic Config + Scan File ${MESSAGE} + Expect Symbol With Score SA_BODY_WORD 10 + Expect Required Score 20 diff --git a/test/functional/cases/270_selector.robot b/test/functional/cases/270_selector.robot deleted file mode 100644 index 683d53d0b..000000000 --- a/test/functional/cases/270_selector.robot +++ /dev/null @@ -1,21 +0,0 @@ -*** Settings *** -Test Setup Rspamd Setup -Test Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/selector.conf -${MESSAGE} ${RSPAMD_TESTDIR}/messages/subject1.eml -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat -${UTF_MESSAGE} ${RSPAMD_TESTDIR}/messages/utf.eml - - -*** Test Cases *** -Newlines - Scan File ${MESSAGE} User=test@user.com Pass=all - Expect Symbol CONFIG_SELECTOR_RE_RCPT_SUBJECT - Expect Symbol LUA_SELECTOR_RE - diff --git a/test/functional/cases/280_rules.robot b/test/functional/cases/280_rules.robot deleted file mode 100644 index fe0efa357..000000000 --- a/test/functional/cases/280_rules.robot +++ /dev/null @@ -1,116 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/regexp.conf -${MESSAGE1} ${RSPAMD_TESTDIR}/messages/fws_fn.eml -${MESSAGE2} ${RSPAMD_TESTDIR}/messages/fws_fp.eml -${MESSAGE3} ${RSPAMD_TESTDIR}/messages/fws_tp.eml -${MESSAGE4} ${RSPAMD_TESTDIR}/messages/broken_richtext.eml -${MESSAGE5} ${RSPAMD_TESTDIR}/messages/badboundary.eml -${MESSAGE6} ${RSPAMD_TESTDIR}/messages/pdf_encrypted.eml -${MESSAGE7} ${RSPAMD_TESTDIR}/messages/pdf_js.eml -${MESSAGE8} ${RSPAMD_TESTDIR}/messages/yand_forward.eml -${MESSAGE} ${RSPAMD_TESTDIR}/messages/newlines.eml -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - - -*** Test Cases *** -Broken MIME - Scan File ${MESSAGE3} - Expect Symbol MISSING_SUBJECT - -Issue 2584 - Scan File ${MESSAGE1} - Do Not Expect Symbol BROKEN_CONTENT_TYPE - Do Not Expect Symbol MISSING_SUBJECT - Do Not Expect Symbol R_MISSING_CHARSET - -Issue 2349 - Scan File ${MESSAGE2} - Do Not Expect Symbol MULTIPLE_UNIQUE_HEADERS - -Broken Rich Text - Scan File ${MESSAGE4} - Expect Symbol BROKEN_CONTENT_TYPE - -Dynamic Config - Scan File ${MESSAGE} - Expect Symbol With Score SA_BODY_WORD 10 - Expect Required Score 20 - -Broken boundary - Scan File ${MESSAGE4} - Expect Symbol BROKEN_CONTENT_TYPE - -PDF encrypted - Scan File ${MESSAGE6} - Expect Symbol PDF_ENCRYPTED - -PDF javascript - Scan File ${MESSAGE7} - Expect Symbol PDF_JAVASCRIPT - -BITCOIN ADDR - Scan File ${RSPAMD_TESTDIR}/messages/btc.eml - Expect Symbol BITCOIN_ADDR - -BITCOIN ADDR 2 - Scan File ${RSPAMD_TESTDIR}/messages/btc2.eml - Expect Symbol BITCOIN_ADDR - -BITCOIN ADDR 3 - Scan File ${RSPAMD_TESTDIR}/messages/btc3.eml - Expect Symbol BITCOIN_ADDR - -RCVD_COUNT_ONE - Scan File ${RSPAMD_TESTDIR}/messages/btc.eml - Expect Symbol RCVD_COUNT_ONE - -RCVD_COUNT_FIVE - Scan File ${RSPAMD_TESTDIR}/messages/yand_forward.eml - Expect Symbol RCVD_COUNT_FIVE - -RCVD_COUNT_SEVEN - Scan File ${RSPAMD_TESTDIR}/messages/rcvd7.eml - Expect Symbol RCVD_COUNT_SEVEN - -FROM_NEQ_ENVFROM - Scan File ${MESSAGE8} From=test@test.net - Expect Symbol FROM_NEQ_ENVFROM - -PHISH_SENDER_A - Scan File ${RSPAMD_TESTDIR}/messages/phish_sender.eml - Expect Symbol With Score And Exact Options MULTIPLE_FROM 9.0 - Expect Symbol With Score And Exact Options MULTIPLE_UNIQUE_HEADERS 7.0 From - -PHISH_SENDER_B - Scan File ${RSPAMD_TESTDIR}/messages/phish_sender2.eml - Expect Symbol BROKEN_HEADERS - -PHISH_SENDER_C - Scan File ${RSPAMD_TESTDIR}/messages/phish_sender3.eml - Expect Symbol BROKEN_HEADERS - -PHISH_SENDER_D - Scan File ${RSPAMD_TESTDIR}/messages/phish_sender4.eml - Expect Symbol BROKEN_HEADERS - -PHISH_SENDER_E - Scan File ${RSPAMD_TESTDIR}/messages/phish_sender5.eml - Expect Symbol MULTIPLE_FROM - Expect Symbol With Exact Options DMARC_NA Duplicate From header - -PHISH_SENDER_ROUTING_PART - Scan File ${RSPAMD_TESTDIR}/messages/phish_sender6.eml - Expect Symbol FROM_INVALID - -REPLYTO_ADDR_EQ_FROM - Scan File ${RSPAMD_TESTDIR}/messages/replyto_addr_eq_from.eml - Expect Symbol REPLYTO_ADDR_EQ_FROM - diff --git a/test/functional/cases/281_fnames.robot b/test/functional/cases/281_fnames.robot deleted file mode 100644 index 399127de8..000000000 --- a/test/functional/cases/281_fnames.robot +++ /dev/null @@ -1,19 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_script.conf -${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/test_fname.lua -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - - -*** Test Cases *** -FILE NAMES - Scan File ${RSPAMD_TESTDIR}/messages/fname.eml - Expect Symbol With Option TEST_FNAME [삼성생명]2020.08.14 데일리 경제뉴스.pdf - Expect Symbol With Option TEST_FNAME 01029_402110_10620_RGT06902_PRT180ML_20200803_101820.pdf diff --git a/test/functional/cases/290_greylist.robot b/test/functional/cases/290_greylist.robot deleted file mode 100644 index 24385b5d5..000000000 --- a/test/functional/cases/290_greylist.robot +++ /dev/null @@ -1,27 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Redis Setup -Suite Teardown Rspamd Redis Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/greylist.conf -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -GREYLIST NEW - Scan File ${MESSAGE} - Expect Symbol With Option GREYLIST greylisted - -GREYLIST EARLY - Scan File ${MESSAGE} - Expect Symbol With Option GREYLIST greylisted - -GREYLIST PASS - Sleep 4s Wait greylisting timeout - Scan File ${MESSAGE} - Expect Symbol With Option GREYLIST pass diff --git a/test/functional/cases/300_rbl.robot b/test/functional/cases/300_rbl.robot deleted file mode 100644 index 82565bcb7..000000000 --- a/test/functional/cases/300_rbl.robot +++ /dev/null @@ -1,70 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/rbl.conf -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -RBL FROM MISS - Scan File ${MESSAGE} IP=1.2.3.4 - Do Not Expect Symbol FAKE_RBL_CODE_2 - -RBL FROM HIT - Scan File ${MESSAGE} IP=4.3.2.1 - Expect Symbol FAKE_RBL_CODE_2 - -RBL FROM MULTIPLE HIT - Scan File ${MESSAGE} IP=4.3.2.3 - Expect Symbol FAKE_RBL_CODE_2 - Expect Symbol FAKE_RBL_CODE_3 - -RBL FROM UNKNOWN HIT - Scan File ${MESSAGE} IP=4.3.2.2 - Expect Symbol FAKE_RBL_FAKE_RBL_UNKNOWN - -RBL RECEIVED HIT - Scan File ${MESSAGE} IP=8.8.8.8 - Expect Symbol FAKE_RECEIVED_RBL_CODE_3 - -RBL FROM HIT WL - Scan File ${MESSAGE} IP=4.3.2.4 - Do Not Expect Symbol FAKE_RBL_CODE_2 - Expect Symbol With Exact Options FAKE_WL_RBL_CODE_2 4.3.2.4:from - -EMAILBL Compose Map 1 - Scan File ${RSPAMD_TESTDIR}/messages/url14.eml - Expect Symbol With Exact Options RSPAMD_EMAILBL dirty.sanchez.com:email - -EMAILBL Compose Map 2 - Scan File ${RSPAMD_TESTDIR}/messages/url15.eml - Expect Symbol With Exact Options RSPAMD_EMAILBL very.dirty.sanchez.com:email - -EMAILBL Compose Map 3 - Scan File ${RSPAMD_TESTDIR}/messages/url16.eml - Expect Symbol With Exact Options RSPAMD_EMAILBL 41.black.sanchez.com:email - -CONTENT URLS - Scan File ${RSPAMD_TESTDIR}/messages/content_url.eml - Expect Symbol With Exact Options URIBL_NOCONTENT example.org:url - Expect Symbol With Option URIBL_WITHCONTENT example.com:url - Expect Symbol With Option URIBL_WITHCONTENT example.org:url - Expect Symbol With Option URIBL_WITHCONTENT 8.8.8.8:url - Expect Symbol With Exact Options URIBL_CONTENTONLY example.com:url - -SELECTORS - Scan File ${RSPAMD_TESTDIR}/messages/btc.eml From=user@example.com Helo=example.org - Expect Symbol With Exact Options RBL_SELECTOR_SINGLE example.org:selector - Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.com:sel_from - Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_helo - -SELECTORS COMBINED - Scan File ${RSPAMD_TESTDIR}/messages/btc.eml From=user@example.org Helo=example.org - Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_from - Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_helo diff --git a/test/functional/cases/310_udp.robot b/test/functional/cases/310_udp.robot deleted file mode 100644 index d5486a030..000000000 --- a/test/functional/cases/310_udp.robot +++ /dev/null @@ -1,42 +0,0 @@ -*** Settings *** -Test Setup UDP Setup -Test Teardown UDP Teardown -Library Process -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf -${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml -${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/udp.lua -${RSPAMD_SCOPE} Test -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -Simple UDP request - Scan File ${MESSAGE} - Expect Symbol With Exact Options UDP_SUCCESS helloworld - -Sendonly UDP request - Scan File ${MESSAGE} - Expect Symbol UDP_SENDTO - -Errored UDP request - Scan File ${MESSAGE} - Expect Symbol With Exact Options UDP_FAIL read timeout - -*** Keywords *** -UDP Setup - Run Dummy UDP - Rspamd Setup - -UDP Teardown - ${udp_pid} = Get File /tmp/dummy_udp.pid - Shutdown Process With Children ${udp_pid} - Rspamd Teardown - -Run Dummy UDP - [Arguments] - ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_udp.py 5005 - Wait Until Created /tmp/dummy_udp.pid diff --git a/test/functional/cases/321_arc_check.robot b/test/functional/cases/321_arc_check.robot deleted file mode 100644 index 1a22eda9e..000000000 --- a/test/functional/cases/321_arc_check.robot +++ /dev/null @@ -1,21 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/arc.conf -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat - -*** Test Cases *** -ARC ALLOW CHECK - Scan File ${RSPAMD_TESTDIR}/messages/arcallow.eml - Expect Symbol ARC_ALLOW - -ARC BAD CHECK - Scan File ${RSPAMD_TESTDIR}/messages/arcbad.eml - Expect Symbol ARC_INVALID - diff --git a/test/functional/cases/340_surbl.robot b/test/functional/cases/340_surbl.robot deleted file mode 100644 index faf4a92c2..000000000 --- a/test/functional/cases/340_surbl.robot +++ /dev/null @@ -1,162 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/surbl.conf -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -SURBL resolve ip - Scan File ${RSPAMD_TESTDIR}/messages/url7.eml - Expect Symbol With Exact Options URIBL_SBL_CSS 8.8.8.9:example.ru:url - Expect Symbol With Exact Options URIBL_XBL 8.8.8.8:example.ru:url - Expect Symbol With Exact Options URIBL_PBL 8.8.8.8:example.ru:url - -SURBL Example.com domain - Scan File ${RSPAMD_TESTDIR}/messages/url4.eml - Expect Symbol RSPAMD_URIBL - Expect Symbol DBL_SPAM - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -SURBL Example.net domain - Scan File ${RSPAMD_TESTDIR}/messages/url5.eml - Expect Symbol DBL_PHISH - Do Not Expect Symbol DBL_SPAM - Do Not Expect Symbol RSPAMD_URIBL - Do Not Expect Symbol URIBL_BLACK - -SURBL Example.org domain - Scan File ${RSPAMD_TESTDIR}/messages/url6.eml - Expect Symbol URIBL_BLACK - Do Not Expect Symbol DBL_SPAM - Do Not Expect Symbol RSPAMD_URIBL - Do Not Expect Symbol DBL_PHISH - -SURBL Example.ru domain - Scan File ${RSPAMD_TESTDIR}/messages/url7.eml - Expect Symbol URIBL_GREY - Expect Symbol URIBL_RED - Do Not Expect Symbol DBL_SPAM - Do Not Expect Symbol RSPAMD_URIBL - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -SURBL Example.ru ZEN domain - Scan File ${RSPAMD_TESTDIR}/messages/url7.eml - Expect Symbol URIBL_SBL_CSS - Expect Symbol URIBL_XBL - Expect Symbol URIBL_PBL - Do Not Expect Symbol URIBL_SBL - Do Not Expect Symbol DBL_SPAM - Do Not Expect Symbol RSPAMD_URIBL - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -SURBL Example.com domain image false - Scan File ${RSPAMD_TESTDIR}/messages/urlimage.eml - Expect Symbol RSPAMD_URIBL_IMAGES - Do Not Expect Symbol DBL_SPAM - Do Not Expect Symbol RSPAMD_URIBL - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -SURBL @example.com mail html - Scan File ${RSPAMD_TESTDIR}/messages/mailadr.eml - Expect Symbol RSPAMD_URIBL - Expect Symbol With Exact Options DBL_SPAM example.com:email - Do Not Expect Symbol RSPAMD_URIBL_IMAGES - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -SURBL @example.com mail text - Scan File ${RSPAMD_TESTDIR}/messages/mailadr2.eml - Expect Symbol RSPAMD_URIBL - Expect Symbol With Exact Options DBL_SPAM example.com:email - Do Not Expect Symbol RSPAMD_URIBL_IMAGES - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -SURBL example.com not encoded url in subject - Scan File ${RSPAMD_TESTDIR}/messages/urlinsubject.eml - Expect Symbol RSPAMD_URIBL - Expect Symbol DBL_SPAM - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -SURBL example.com encoded url in subject - Scan File ${RSPAMD_TESTDIR}/messages/urlinsubjectencoded.eml - Expect Symbol RSPAMD_URIBL - Expect Symbol DBL_SPAM - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -WHITELIST - Scan File ${RSPAMD_TESTDIR}/messages/whitelist.eml - Do Not Expect Symbol RSPAMD_URIBL - Do Not Expect Symbol DBL_SPAM - Do Not Expect Symbol RSPAMD_URIBL_IMAGES - -EMAILBL full address & domain only - Scan File ${RSPAMD_TESTDIR}/messages/emailbltext.eml - Expect Symbol RSPAMD_EMAILBL_FULL - Expect Symbol RSPAMD_EMAILBL_DOMAINONLY - -EMAILBL full subdomain address - Scan File ${RSPAMD_TESTDIR}/messages/emailbltext2.eml - Expect Symbol RSPAMD_EMAILBL_FULL - -EMAILBL full subdomain address & domain only - Scan File ${RSPAMD_TESTDIR}/messages/emailbltext3.eml - Expect Symbol With Exact Options RSPAMD_EMAILBL_DOMAINONLY baddomain.com:email - Expect Symbol With Exact Options RSPAMD_EMAILBL_FULL user.subdomain.baddomain.com:email - -EMAILBL REPLY TO full address - Scan File ${RSPAMD_TESTDIR}/messages/replyto.eml - Expect Symbol RSPAMD_EMAILBL_FULL - Do Not Expect Symbol RSPAMD_EMAILBL_DOMAINONLY - -EMAILBL REPLY TO domain only - Scan File ${RSPAMD_TESTDIR}/messages/replyto2.eml - Expect Symbol RSPAMD_EMAILBL_DOMAINONLY - Do Not Expect Symbol RSPAMD_EMAILBL_FULL - -EMAILBL REPLY TO full subdomain address - Scan File ${RSPAMD_TESTDIR}/messages/replytosubdomain.eml - Expect Symbol RSPAMD_EMAILBL_FULL - Do Not Expect Symbol RSPAMD_EMAILBL_DOMAINONLY - -SURBL IDN domain - Scan File ${RSPAMD_TESTDIR}/messages/url8.eml - Expect Symbol RSPAMD_URIBL - Expect Symbol DBL_SPAM - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -SURBL IDN Punycode domain - Scan File ${RSPAMD_TESTDIR}/messages/url9.eml - Expect Symbol RSPAMD_URIBL - Expect Symbol DBL_SPAM - Do Not Expect Symbol DBL_PHISH - Do Not Expect Symbol URIBL_BLACK - -SURBL html entity­ - Scan File ${RSPAMD_TESTDIR}/messages/url10.eml - Expect Symbol RSPAMD_URIBL - -SURBL url compose map 1 - Scan File ${RSPAMD_TESTDIR}/messages/url11.eml - Expect Symbol With Exact Options BAD_SUBDOMAIN clean.dirty.sanchez.com:url - -SURBL url compose map 2 - Scan File ${RSPAMD_TESTDIR}/messages/url12.eml - Expect Symbol With Exact Options BAD_SUBDOMAIN 4.very.dirty.sanchez.com:url - -SURBL url compose map 3 - Scan File ${RSPAMD_TESTDIR}/messages/url13.eml - Expect Symbol With Exact Options BAD_SUBDOMAIN 41.black.sanchez.com:url diff --git a/test/functional/cases/350_magic.robot b/test/functional/cases/350_magic.robot deleted file mode 100644 index 6dad5f247..000000000 --- a/test/functional/cases/350_magic.robot +++ /dev/null @@ -1,71 +0,0 @@ -*** Settings *** -Suite Setup Rspamd Setup -Suite Teardown Rspamd Teardown -Library ${RSPAMD_TESTDIR}/lib/rspamd.py -Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot -Variables ${RSPAMD_TESTDIR}/lib/vars.py - -*** Variables *** -${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_script.conf -${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/magic.lua -${RSPAMD_SCOPE} Suite -${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat - -*** Test Cases *** -Magic detections bundle 1 - Scan File ${RSPAMD_TESTDIR}/messages/gargantua.eml - Expect Symbols MAGIC_SYM_ZIP_2 - ... MAGIC_SYM_RAR_3 - ... MAGIC_SYM_EXE_4 - ... MAGIC_SYM_ELF_5 - ... MAGIC_SYM_LNK_6 - ... MAGIC_SYM_CLASS_7 - ... MAGIC_SYM_RTF_8 - ... MAGIC_SYM_PDF_9 - ... MAGIC_SYM_PS_10 - ... MAGIC_SYM_CHM_11 - ... MAGIC_SYM_DJVU_12 - ... MAGIC_SYM_ARJ_13 - ... MAGIC_SYM_CAB_14 - ... MAGIC_SYM_ACE_15 - ... MAGIC_SYM_TAR_16 - ... MAGIC_SYM_BZ2_17 - ... MAGIC_SYM_XZ_18 - ... MAGIC_SYM_LZ4_19 - ... MAGIC_SYM_ZST_20 - ... MAGIC_SYM_DMG_21 - ... MAGIC_SYM_ISO_22 - ... MAGIC_SYM_ZOO_23 - ... MAGIC_SYM_EPUB_24 - ... MAGIC_SYM_XAR_25 - ... MAGIC_SYM_PSD_26 - ... MAGIC_SYM_PCX_27 - ... MAGIC_SYM_TIFF_28 - ... MAGIC_SYM_ICO_29 - ... MAGIC_SYM_SWF_30 - ... MAGIC_SYM_DOC_31 - ... MAGIC_SYM_XLS_32 - ... MAGIC_SYM_PPT_33 - ... MAGIC_SYM_MSI_34 - ... MAGIC_SYM_MSG_35 - ... MAGIC_SYM_DOCX_36 - ... MAGIC_SYM_XLSX_37 - ... MAGIC_SYM_PPTX_38 - ... MAGIC_SYM_ODT_39 - ... MAGIC_SYM_ODS_40 - ... MAGIC_SYM_ODP_41 - ... MAGIC_SYM_7Z_42 - ... MAGIC_SYM_VSD_43 - ... MAGIC_SYM_PNG_44 - ... MAGIC_SYM_JPG_45 - ... MAGIC_SYM_GIF_46 - ... MAGIC_SYM_BMP_47 - ... MAGIC_SYM_TXT_48 - ... MAGIC_SYM_HTML_49 - ... MAGIC_SYM_CSV_50 - ... MAGIC_SYM_DWG_51 - ... MAGIC_SYM_JAR_52 - ... MAGIC_SYM_APK_53 - ... MAGIC_SYM_BAT_54 - ... MAGIC_SYM_ICS_55 - ... MAGIC_SYM_VCF_56 diff --git a/test/functional/configs/antivirus.conf b/test/functional/configs/antivirus.conf deleted file mode 100644 index 8b971a588..000000000 --- a/test/functional/configs/antivirus.conf +++ /dev/null @@ -1,43 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -redis { - servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; -} -antivirus { - clam { - attachments_only = false; - symbol = "CLAM_VIRUS"; - type = "clamav"; - servers = "127.0.0.1:{= env.PORT_CLAM =}"; - } - fprot { - attachments_only = false; - symbol = "FPROT_VIRUS"; - type = "fprot"; - servers = "127.0.0.1:{= env.PORT_FPROT =}"; - patterns { - FPROT_EICAR = "^EICAR_Test_File$"; - } - } - fprot_duplicate { - prefix = "fp_dupe"; - attachments_only = false; - symbol = "FPROT2_VIRUS_DUPLICATE_DEFAULT"; - type = "fprot"; - servers = "127.0.0.1:{= env.PORT_FPROT2_DUPLICATE =}"; - patterns = [ - {FPROT2_VIRUS_DUPLICATE_PATTERN = "^E"}, - {FPROT2_VIRUS_DUPLICATE_NOPE1 = "^EI", - FPROT2_VIRUS_DUPLICATE_NOPE2 = "^EIC", - FPROT2_VIRUS_DUPLICATE_NOPE3 = "^EICA", - FPROT2_VIRUS_DUPLICATE_NOPE4 = "^EICAR", - FPROT2_VIRUS_DUPLICATE_NOPE5 = "^EICAR_"} - ]; - } - avast { - attachments_only = false; - symbol = "AVAST_VIRUS"; - type = "avast"; - servers = "127.0.0.1:{= env.PORT_AVAST =}"; - } -} diff --git a/test/functional/configs/arc.conf b/test/functional/configs/arc.conf deleted file mode 100644 index 8a8a525c7..000000000 --- a/test/functional/configs/arc.conf +++ /dev/null @@ -1,3 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -arc { } diff --git a/test/functional/configs/dmarc.conf b/test/functional/configs/dmarc.conf deleted file mode 100644 index 130e5612c..000000000 --- a/test/functional/configs/dmarc.conf +++ /dev/null @@ -1,8 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -dmarc { } -spf { - external_relay = [ - "{= env.TESTDIR =}/configs/maps/external_relay_ip.list", - ]; -} diff --git a/test/functional/configs/greylist.conf b/test/functional/configs/greylist.conf deleted file mode 100644 index d47500ce8..000000000 --- a/test/functional/configs/greylist.conf +++ /dev/null @@ -1,13 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -redis { - servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; -} -greylist { - check_local = true; - timeout = 4; -} - -actions { - greylist = 1; -} diff --git a/test/functional/configs/merged-local.conf b/test/functional/configs/merged-local.conf new file mode 100644 index 000000000..1329a6eee --- /dev/null +++ b/test/functional/configs/merged-local.conf @@ -0,0 +1,905 @@ +emails { + "whitelist" = [ + "rspamd-test.com" + ] + rules { + "RSPAMD_EMAILBL_FULL" { + dnsbl = "test5.uribl"; + replyto = true; + } + "RSPAMD_EMAILBL_DOMAINONLY" { + dnsbl = "test6.uribl"; + domain_only = true; + replyto = true; + } + } +} + +greylist { + check_local = true; + timeout = 4; +} + +logging = { + type = "file", + level = "debug" + filename = "{= env.TMPDIR =}/rspamd.log" + log_usec = true; +} + +mid = { + source = { + url = [ + "https://maps.rspamd.com/rspamd/mid.inc.zst", + "fallback+file://{= env.TESTDIR =}/../../../conf/mid.inc", + "file://{= env.TESTDIR =}/configs/maps/mid.list" + ]; + } +} + +mime_types { + file = [ + "https://maps.rspamd.com/rspamd/mime_types.inc.zst", + "fallback+file://{= env.TESTDIR =}/../../../conf/mime_types.inc" + ]; + extension_map { + html = "text/html"; + txt [ + "message/disposition-notification", + "text/plain", + "text/rfc822-headers", + ] + pdf [ + "application/octet-stream", + "application/pdf", + ] + } + filename_whitelist = "{= env.TESTDIR =}/configs/maps/mime_types.wl"; +} + +options = { + pidfile = "{= env.TMPDIR =}/rspamd.pid" + dns { + nameserver = ["8.8.8.8", "8.8.4.4"]; + retransmits = 10; + timeout = 2s; + fake_records = [{ + # non-existent records requested by 350_surbl tests + name = "114.73.21.104.test4.uribl", type = "a", rcode = "norec"}, + {name = "153.23.128.52.test4.uribl", type = "a", rcode = "norec"}, + {name = "158.136.181.135.test4.uribl", type = "a", rcode = "norec"}, + {name = "177.115.236.44.test4.uribl", type = "a", rcode = "norec"}, + {name = "180.136.102.34.test4.uribl", type = "a", rcode = "norec"}, + {name = "180.144.67.172.test4.uribl", type = "a", rcode = "norec"}, + {name = "2.7.9.4.5.1.8.6.0.0.0.0.0.0.0.0.0.0.0.0.7.3.0.3.0.0.7.4.6.0.6.2.test4.uribl", type = "a", rcode = "norec"}, + {name = "217.228.62.64.test4.uribl", type = "a", rcode = "norec"}, + {name = "34.216.184.93.test4.uribl", type = "a", rcode = "norec"}, + {name = "4.b.0.9.3.4.c.a.0.0.0.0.0.0.0.0.0.0.0.0.1.3.0.3.0.0.7.4.6.0.6.2.test4.uribl", type = "a", rcode = "norec"}, + {name = "4eikheqjb4rb3y4oxgnfxek9wrwnyii4.test.uribl", type = "a", rcode = "norec"}, + {name = "6.4.9.1.8.c.5.2.3.9.8.1.8.4.2.0.1.0.0.0.0.2.2.0.0.0.8.2.6.0.6.2.test4.uribl", type = "a", rcode = "norec"}, + {name = "69so7b146n15x6qkr8rj9x8iqb7zfr1s.test.uribl", type = "a", rcode = "norec"}, + {name = "6cqpxfrojdnzawwjmacjwtstzwehxnzb.test.uribl", type = "a", rcode = "norec"}, + {name = "7.5.2.e.9.5.e.f.f.f.1.9.c.3.0.f.0.0.0.0.0.0.0.0.1.0.c.3.0.0.6.2.test4.uribl", type = "a", rcode = "norec"}, + {name = "baddomain.com.test2.uribl", type = "a", rcode = "norec"}, + {name = "baddomain.com.test3.uribl", type = "a", rcode = "norec"}, + {name = "bbjo9td11ewijyjkq8rsn4j3kxhthz4m.test.uribl", type = "a", rcode = "norec"}, + {name = "emailbl.com.test2.uribl", type = "a", rcode = "norec"}, + {name = "emailbl.com.test3.uribl", type = "a", rcode = "norec"}, + {name = "emailbl.com.test6.uribl", type = "a", rcode = "norec"}, + {name = "example.com.test3.uribl", type = "a", rcode = "norec"}, + {name = "example.com.test6.uribl", type = "a", rcode = "norec"}, + {name = "example.com.test7.uribl", type = "a", rcode = "norec"}, + {name = "example.net.test3.uribl", type = "a", rcode = "norec"}, + {name = "example.net.test7.uribl", type = "a", rcode = "norec"}, + {name = "example.org.test2.uribl", type = "a", rcode = "norec"}, + {name = "example.org.test3.uribl", type = "a", rcode = "norec"}, + {name = "example.org.test7.uribl", type = "a", rcode = "norec"}, + {name = "example.ru.test2.uribl", type = "a", rcode = "norec"}, + {name = "example.ru.test7.uribl", type = "a", rcode = "norec"}, + {name = "gdhhir83i5pjk6s8i3e5afwa4md7uns7.test.uribl", type = "a", rcode = "norec"}, + {name = "k8qo8m33z19cqejfncirs85rf4nr9h3u.test.uribl", type = "a", rcode = "norec"}, + {name = "kr1adm7tnzuudiftdt1g4t6yg1rbt1ez.test.uribl", type = "a", rcode = "norec"}, + {name = "rspamd.com.test2.uribl", type = "a", rcode = "norec"}, + {name = "rspamd.com.test3.uribl", type = "a", rcode = "norec"}, + {name = "rspamd.com.test7.uribl", type = "a", rcode = "norec"}, + {name = "rspamd.tk.test3.uribl", type = "a", rcode = "norec"}, + {name = "rspamd.tk.test7.uribl", type = "a", rcode = "norec"}, + {name = "sanchez.com.test2.uribl", type = "a", rcode = "norec"}, + {name = "sanchez.com.test3.uribl", type = "a", rcode = "norec"}, + {name = "sanchez.com.test7.uribl", type = "a", rcode = "norec"}, + {name = "subdomain.emailbl.com.test6.uribl", type = "a", rcode = "norec"}, + {name = "testtest.com.test2.uribl", type = "a", rcode = "norec"}, + {name = "testtest.com.test3.uribl", type = "a", rcode = "norec"}, + {name = "testtest.com.test7.uribl", type = "a", rcode = "norec"}, + {name = "user.baddomain.com.test5.uribl", type = "a", rcode = "norec"}, + {name = "user.example.com.test5.uribl", type = "a", rcode = "norec"}, + {name = "xn--80arbjktj.xn--p1ai.test3.uribl", type = "a", rcode = "norec"}, + {name = "xn--80arbjktj.xn--p1ai.test7.uribl", type = "a", rcode = "norec"}, + {name = "y84tis6xzaf41h4p5kzxiw6puixnm43k.test.uribl", type = "a", rcode = "norec"}, + # other stuff is here too! :\ + { # ed25519 + name = "test._domainkey.example.com"; + type = txt; + replies = ["k=ed25519; p=yi50DjK5O9pqbFpNHklsv9lqaS0ArSYu02qp1S0DW1Y="]; + }, + { + name = "brisbane._domainkey.football.example.com"; + type = txt; + replies = ["v=DKIM1; k=ed25519; p=11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo="]; + }, + { + name = "test._domainkey.football.example.com"; + type = txt; + replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkHlOQoBTzWRiGs5V6NpP3idY6Wk08a5qhdR6wy5bdOKb2jLQiY/J16JYi0Qvx/byYzCNb3W91y3FutACDfzwQ/BC/e/8uBsCR+yz1Lxj+PL6lHvqMKrM3rG4hstT5QjvHO9PzoxZyVYLzBfO2EeC3Ip3G+2kryOTIKT+l/K4w3QIDAQAB"], + }, + { + name = "dkim._domainkey.cacophony.za.org", + type = "txt"; + replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXtxBE5IiNRMcq2/lc2zErfdCvDFyQNBnMjbOjBQrPST2k4fdGbtpe5Iu5uS01Met+dAEf94XL8I0hwmYw+n70PP834zfJGi2egwGqrakpaWsCDPvIJZLkxJCJKQRA/zrQ622uEXdvYixVbsEGVw7U4wAGSmT5rU2eU1y63AlOlQIDAQAB"]; + }, + { + name = "eddsa._domainkey.cacophony.za.org", + type = "txt"; + replies = ["v=DKIM1; k=ed25519; p=+nU+aC33ICeS4zx8VUjFYCtxj0fRbHWQn2gP2hTkm9w="]; + }, + { + name = "dkim._domainkey.invalid.za.org", + type = "txt"; + replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDEEXmNGQq7PUrr9Mg4UakTFHgXBCy2DOztkrZm+0OrVWtiRzGluxBkbOWTBwuU3/Yw97yTphBMQxzWFN603/f/KPAQcF/Lc1l+6kmIBBxNXjjGuOK/3PYKZVntUdKmqcQBYfnHdzH2Tohbuyx1a7xqnv6VSChqQrZU4CwkeT3+eQIDAQAB"]; + }, + { + name = "eddsa._domainkey.invalid.za.org", + type = "txt"; + replies = ["v=DKIM1; k=ed25519; p=Wkkrp5DJTvknDMGWYv8vm3p3sZjiQp03LZo80RregY8="]; + }, + { + name = "dkim._domainkey.rspamd.com", + type = "txt"; + replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCd/XhZBEGGAss48lEuMmwZv9lOFf6FTllBiQ3sPhdTpDdIPaW9TInW7iYnYD/bXHeVxYAyD/sKhYk6+qGBRu10rEi+iyPvLCIED+Boq0tEQosuKuV6Fjoomb+QhZY9KdjyZTjsrFPZ+wCkUY/30uTmpX2SwSqyxxlK0pUIsRgMAQIDAQAB"]; + }, + { + name = "_dmarc.rspamd.com", + type = "txt"; + rcode = 'norec'; + }, + { + name = "dkim._domainkey.highsecure.ru", + type = "txt"; + replies = ["p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK4ZQYky30GH0Ak9OQ1fv3IdFNbpOtpa4S/PR20ZLgPXfd/FCA//ztUmu7kHlELI+/+4f8W+xX0oZlOc/cFxhopRjXZMlSsQqmWOZ40/GxWFBtcqafKu78FCqO7URqZUmMCM5Jlp4zt/yzH3dbYNG3i5PVlB5QtQnZvY+dvBL3dwIDAQAB"]; + }, + { + name = "_dmarc.cacophony.za.org", + type = "txt"; + replies = ["v=DMARC1; p=none; sp=reject"]; + }, + { + name = "_dmarc.my.mom.za.org", + type = "txt"; + replies = ["v=DMARC1; p=reject"]; + }, + { + name = "example.net", + type = "txt"; + replies = ["v=spf1 -all"]; + }, + { + name = "fail4.org.org.za", + type = "txt"; + replies = ["v=spf1 redirect=asdfsfewewrredfs"]; + }, + { + name = "_dmarc.reject.cacophony.za.org", + type = "txt"; + replies = ["v=DMARC1; p=reject"]; + }, + { + name = "spf.cacophony.za.org", + type = "txt"; + replies = ["v=spf1 ip4:8.8.4.4 -all"]; + }, + { + name = "fail7.org.org.za", + type = "a"; + rcode = 'norec'; + }, + { + name = "fail6.org.org.za", + type = "txt"; + replies = ["v=spf1 ip4:8.8.8.8 mx -all"]; + }, + { + name = "fail6.org.org.za", + type = "mx"; + rcode = 'norec'; + }, + { + name = "fail7.org.org.za", + type = "aaaa"; + rcode = 'norec'; + }, + { + name = "_dmarc.quarantine.cacophony.za.org", + type = "txt"; + replies = ["v=DMARC1; p=quarantine"]; + }, + { + name = "_dmarc.yo.mom.za.org", + type = "txt"; + replies = ["v=DMARC1; p=reject; aspf=s; adkim=s;"]; + }, + { + name = "yo.mom.za.org", + type = "txt"; + replies = ["v=spf1 ip4:37.48.67.26 -all"]; + }, + { + name = "testdkim._domainkey.mom.za.org", + type = "txt"; + replies = ["v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3v4VPE1QMHUzsMRbC8VzXNq82mDjiv9Gi1NB/YYC+vIYZT+sE/Uxnr0Clk8C2jgzEr3jcxgQEWZfMtEEg/EfEJvh4SrXWv9c0gw1EEfxKxX9i+r8yBQtc/EWospWVDkhF2lAvQAK1lV1ZiU7psJ6fh1CI39uZyWdAktZzWLf0zQIDAQAB"]; + }, + { + name = "_dmarc.rspamd.tk", + type = "txt"; + replies = ["bio=a263adeab8acdcdb8b89e127b67d696061fdfbee"]; + }, + { + name = "fail2.org.org.za", + type = "txt"; + replies = ["v=spf1 ip4:8.8.4.4 include:www.dnssec-failed.org -all"]; + }, + { + name = "fail3.org.org.za", + type = "txt"; + replies = ["v=spf1 ip4:8.8.8.8 include:total.barf -all"]; + }, + { + name = "mom.za.org", + type = "txt"; + replies = ["v=spf1 ip4:37.48.67.26 -all"]; + }, + { + name = "testdkim._domainkey.asdf.rspamd.tk", # testdkim._domainkey.asdf.rspamd.tk is an alias for rspamd.tk + type = "txt"; + replies = ["bio=a263adeab8acdcdb8b89e127b67d696061fdfbee"]; + }, + { + name = "testdkim._domainkey.rspamd.tk", # testdkim._domainkey.rspamd.tk is an alias for rspamd.tk + type = "txt"; + replies = ["bio=a263adeab8acdcdb8b89e127b67d696061fdfbee"]; + }, + { + name = "pass1.org.org.za", + type = "txt"; + replies = ["v=spf1 include:pass2.org.org.za -all"]; + }, + { + name = "95.142.99.88.in-addr.arpa", + type = "ptr"; + replies = ["mail.highsecure.ru"]; + }, + { + name = "mail.highsecure.ru", + type = "a"; + replies = ["88.99.142.95"]; + }, + { + name = "mail.highsecure.ru", + type = "aaaa"; + rcode = 'norec'; + }, + { + name = "1.0.66.128.in-addr.arpa", + type = "ptr"; + rcode = 'nxdomain'; + }, + { + name = "182.216.85.209.in-addr.arpa", + type = "ptr"; + replies = ["mail-qt0-f182.google.com"]; + }, + { + name = "crazyspf.cacophony.za.org", + type = "txt"; + replies = ["v=spf1 ptr:cacophony.za.org ptr:rspamd.com ptr:yahoo.com ptr:yahoo.net ptr:highsecure.ru -all"]; + }, + { + name = "pass2.org.org.za", + type = "txt"; + replies = ["v=spf1 ip4:8.8.8.8 -all"]; + }, + { + name = "_dmarc.yoni.za.org", + type = "txt"; + replies = ["v=DMARC1; p=reject; sp=none;"]; + }, + { + name = "fail10.org.org.za", + type = "txt"; + replies = ["v=spf1 redirect=fail5.org.org.za"]; + }, + { + name = "fail11.org.org.za", + type = "txt"; + replies = ["v=sPF1 ip4:8.8.8.8 -all"]; + }, + { + name = "fail5.org.org.za", + type = "txt"; + replies = ["v=spf1 OMGBARF"]; + }, + { + name = "fail7.org.org.za", + type = "txt"; + replies = ["v=spf1 ip4:8.8.8.8 a -all"]; + }, + { + name = "trusted.com", + type = "txt"; + replies = ["v=spf1 ip4:192.168.1.1"]; + }, + { + name = "external.com", + type = "txt"; + replies = ["v=spf1 ip4:37.48.67.26"]; + }, + { + name = "co.za", + type = "txt"; + rcode = 'norec'; + }, + { + name = "testdkim1._domainkey.yoni.za.org", + type = "txt"; + replies = ["v=DKIM1; k=rsa; p=BARF"]; + }, + { + name = "_dmarc.yoni.za.net", + type = "txt"; + replies = ["v=DMARC1; p=none; sp=quarantine"]; + }, + { + name = "za", + type = "txt"; + replies = ["Top-level domain for South Africa"]; + }, + { + name = "_dmarc.foo.yoni.za.org", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "_dmarc.foo.cacophony.za.org", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "_dmarc.foo.yoni.za.net", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "_dmarc.dnssec-failed.org", + type = "txt"; + rcode = 'timeout'; + }, + { + name = "_dmarc.example.com", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "_dmarc.zero_pct.com", + type = "txt"; + replies = ["v=DMARC1; p=reject; sp=quarantine; pct=0"]; + }, + { + name = "example.com", + type = "txt"; + replies = ["$Id: example.com 4415 2015-08-24 20:12:23Z davids $", "v=spf1 -all"]; + }, + { + name = "example.com", + type = "a"; + replies = ["93.184.216.34"]; + }, + { + name = "testdkim1._domainkey.dnssec-failed.org", + type = "txt"; + rcode = 'timeout'; + }, + { + name = "total.barf", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "_dmarc.foo.cacophony.za.org", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "zzzzaaaa", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "asdfsfewewrredfs", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "95.142.99.88.asn.rspamd.com", + type = "txt"; + replies = ["24940|88.99.0.0/16|DE|ripencc|"]; + }, + { + name = "2.a.d.1.1.d.e.f.f.f.0.0.4.5.0.5.d.6.2.0.6.b.a.a.8.c.7.0.1.0.a.2.asn6.rspamd.com", + type = "txt"; + replies = ["20857|2a01:7c8::/32|NL|ripencc|"]; + }, + { + name = "2.a.d.1.1.d.e.f.f.f.0.0.4.5.0.5.d.6.2.0.6.b.a.a.8.c.7.0.1.0.a.2.rspamd.com", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "2.a.d.1.1.d.e.f.f.f.0.0.4.5.0.5.d.6.2.0.6.b.a.a.8.c.7.0.1.0.a.2.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "rspamd.com", + type = "txt"; + replies = ["v=spf1 mx -all"]; + }, + { + name = "rspamd.com", + type = "mx"; + replies = ["10 mail.highsecure.ru"]; + }, + { + name = "95.142.99.88.rspamd.com", + type = "a"; + rcode = 'norec'; + }, + { + name = "95.142.99.88.rspamd.com", + type = "aaaa"; + rcode = 'norec'; + }, + { + name = "2.0.0.127.rspamd.com", + type = "a"; + replies = ["127.0.0.1"]; + }, + { + name = "8.8.8.8.asn.rspamd.com", + type = "txt"; + replies = ["15169|8.8.8.0/24|US|arin|"]; + }, + { + name = "8.8.8.8.asn.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "10.0.1.10.asn.rspamd.com", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "10.0.1.10.asn.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "10.0.1.11.asn.rspamd.com", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "10.0.1.11.asn.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "test.com", + type = "txt"; + replies = [""]; + }, + { + name = "other.com", + type = "txt"; + rcode = 'norec'; + }, + { + name = "bob", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "mail.highsecure.ru", + type = "aaaa"; + rcode = 'norec'; + }, + { + name = "mail.highsecure.ru", + type = "a"; + replies = ["88.99.142.95"]; + }, + { + name = "4.3.2.1.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "4.3.2.1.asn.rspamd.com", + type = "txt"; + rcode = 'nxdomain'; + }, + { + name = "1.0.0.127.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "114.47.228.46.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "114.47.228.46.asn.rspamd.com", + type = "txt"; + replies = ["34010|46.228.40.0/21|GB|ripencc|"]; + }, + { + name = "10.0.1.10.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "10.0.1.11.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "other.org", + type = "txt"; + rcode = 'norec'; + }, + { + name = "8.8.8.8.rspamd.com", + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "rspamd.tk", + type = "txt"; + replies = ["bio=a263adeab8acdcdb8b89e127b67d696061fdfbee"]; + }, + { + name = "fail1.org.org.za", + type = "txt"; + replies = ["v=spf1 redirect=www.dnssec-failed.org"]; + }, + { + name = "www.dnssec-failed.org", + type = "txt"; + rcode = 'timeout'; + }, + { + name = "www.dnssec-failed.org", + type = "mx"; + rcode = 'timeout'; + }, + { + name = "www.dnssec-failed.org", + type = "a"; + rcode = 'timeout'; + }, + { + name = "www.dnssec-failed.org", + type = "aaaa"; + rcode = 'norec'; + }, + { + name = "cacophony.za.org", + type = "txt"; + replies = ["v=spf1 redirect=asdfsfewewrredfs"]; + }, + { + name = "fail9.org.org.za", + type = "txt"; + replies = ["v=spf1 ip4:8.8.8.8 mx:www.dnssec-failed.org -all"]; + }, + { + name = "fail8.org.org.za", + type = "txt"; + replies = ["v=spf1 ip4:8.8.8.8 a:www.dnssec-failed.org -all"]; + }, + { + name = "1.2.3.4.fake.rbl"; + type = "a"; + replies = ["127.0.0.2"]; + }, + { + name = "2.2.3.4.fake.rbl"; + type = "a"; + replies = ["127.0.0.10"]; + }, + { + name = "3.2.3.4.fake.rbl"; + type = "a"; + replies = ["127.0.0.2", "127.0.0.3"]; + }, + { + name = "4.2.3.4.fake.rbl"; + type = "a"; + replies = ["127.0.0.2"]; + }, + { + name = "4.2.3.4.fake.wl"; + type = "a"; + replies = ["127.0.0.2"]; + }, + { + name = "4.3.2.1.fake.rbl"; + type = "a"; + rcode = 'nxdomain'; + }, + { + name = "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.fake.rbl"; + type = "a"; + replies = ["127.0.0.2"]; + }, + { + name = "131.193.18.151.fake.rbl"; + type = "a"; + replies = ["127.0.0.3"]; + }, + # SURBL tests + { + name = "rciuosbadgpq6b5wt436nhgnwzmfh9w9.test.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + # testtest.com + name = "rcf1ecxtxrrpfncqzsdaiezjkf7f1rzz.test.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "jhcszdsmo3wuj5mp8t38kdisdmr3ib3q.test.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "g9ifs3q39oh5jwru94cj7ffaqd6rfyq6.test.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "xn--80arbjktj.xn--p1ai.test2.uribl"; + type = a; + replies = ["127.0.1.2"]; + }, + { + name = "мойсайт.рф.test2.uribl"; + type = a; + replies = ["127.0.1.2"]; + }, + { + name = "user.emailbl.com.test5.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "user.subdomain.emailbl.com.test5.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "baddomain.com.test6.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "user.subdomain.baddomain.com.test5.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "example.com.test2.uribl"; + type = a; + replies = ["127.0.1.2"]; + }, + { + name = "user.example.com.test2.uribl"; + type = a; + replies = ["127.0.1.5"]; + }, + { + name = "example.net.test2.uribl"; + type = a; + replies = ["127.0.1.4"]; + }, + { + name = "rspamd.tk.test2.uribl"; + type = a; + replies = ["127.0.1.4"]; + }, + { + name = "example.org.test3.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "example.ru.test3.uribl"; + type = a; + replies = ["127.0.0.12"]; + }, + { + name = "example.ru"; + type = a; + replies = ["8.8.8.8", "8.8.8.9"]; + }, + { + name = "8.8.8.8.test4.uribl"; + type = a; + replies = ["127.0.0.4", "127.0.0.11"]; + }, + { + name = "uppht14nj4fsoycu3huctg9d5psx9je4.test.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "rspamd-test.com.test2.uribl"; + type = a; + replies = ["127.0.1.2"]; + }, + { + name = "9.8.8.8.test4.uribl"; + type = a; + replies = ["127.0.0.3"]; + }, + { + name = "4.very.dirty.sanchez.com.test7.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "clean.dirty.sanchez.com.test7.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "not.dirty.sanchez.com.test7.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "41.black.sanchez.com.test7.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "black.sanchez.com.test7.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "dirty.sanchez.com.test8.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "very.dirty.sanchez.com.test8.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "41.black.sanchez.com.test8.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "black.sanchez.com.test8.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "example.com.test9.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "example.org.test9.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "8.8.8.8.test9.uribl"; + type = a; + replies = ["127.0.0.2"]; + }, + { + name = "site.resolveme", + type = "a"; + replies = ["127.0.0.1"]; + }, + { + name = "not-resolvable.com", + type = "a"; + rcode = 'norec'; + }, + # TODO: add IPv6 tests + ]; + } +} + +phishing { + symbol = "PHISHING"; + strict_domains = { + STRICT_PHISHING = [ + "{= env.TESTDIR =}/configs/maps/strict.phishing", + ]; + STRICTER_PHISHING = [ + "{= env.TESTDIR =}/configs/maps/stricter.phishing" + ] + } +} + +redis { + servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; + expand_keys = true; +} + +regexp { + CONFIG_SELECTOR_RE_RCPT_SUBJECT { + re = 'test=/test@user.com some subject/$', + score = 100500, + } +} + +spf { + external_relay = [ + "{= env.TESTDIR =}/configs/maps/external_relay_ip.list", + ]; +} + +symbols { + FOUR_POINTS = { + score = 4.0, + } + SYM1 = { + score = 1.0, + } +} + +worker "controller" { + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_CONTROLLER =}"; + keypair { + pubkey = "{= env.KEY_PUB1 =}"; + privkey = "{= env.KEY_PVT1 =}"; + } +} + +worker "normal" { + bind_socket = "{= env.LOCAL_ADDR =}:{= env.PORT_NORMAL =}"; + keypair { + pubkey = "{= env.KEY_PUB1 =}"; + privkey = "{= env.KEY_PVT1 =}"; + } +} diff --git a/test/functional/configs/merged-override.conf b/test/functional/configs/merged-override.conf new file mode 100644 index 000000000..ab0779fdf --- /dev/null +++ b/test/functional/configs/merged-override.conf @@ -0,0 +1,391 @@ +antivirus { + clam { + attachments_only = false; + symbol = "CLAM_VIRUS"; + type = "clamav"; + servers = "127.0.0.1:{= env.PORT_CLAM =}"; + } + fprot { + attachments_only = false; + symbol = "FPROT_VIRUS"; + type = "fprot"; + servers = "127.0.0.1:{= env.PORT_FPROT =}"; + patterns { + FPROT_EICAR = "^EICAR_Test_File$"; + } + } + fprot_duplicate { + prefix = "fp_dupe"; + attachments_only = false; + symbol = "FPROT2_VIRUS_DUPLICATE_DEFAULT"; + type = "fprot"; + servers = "127.0.0.1:{= env.PORT_FPROT2_DUPLICATE =}"; + patterns = [ + {FPROT2_VIRUS_DUPLICATE_PATTERN = "^E"}, + {FPROT2_VIRUS_DUPLICATE_NOPE1 = "^EI", + FPROT2_VIRUS_DUPLICATE_NOPE2 = "^EIC", + FPROT2_VIRUS_DUPLICATE_NOPE3 = "^EICA", + FPROT2_VIRUS_DUPLICATE_NOPE4 = "^EICAR", + FPROT2_VIRUS_DUPLICATE_NOPE5 = "^EICAR_"} + ]; + } + avast { + attachments_only = false; + symbol = "AVAST_VIRUS"; + type = "avast"; + servers = "127.0.0.1:{= env.PORT_AVAST =}"; + } +} + +multimap { + DNSBL_MAP { + type = "dnsbl"; + map = "rspamd.com"; + } + IP_MAP { + type = "ip"; + map = "{= env.TESTDIR =}/configs/maps/ip.list"; + } + FROM_MAP { + type = "from"; + filter = "email:domain"; + map = "{= env.TESTDIR =}/configs/maps/domains.list"; + } + FREEMAIL_CC { + type = "header"; + header = "Cc"; + filter = "email:domain"; + map = "{= env.TESTDIR =}/configs/maps/domains.list.2"; + score = 1.0; + } + REGEXP_MAP { + type = "from"; + filter = "email:addr"; + regexp = true; + map = "{= env.TESTDIR =}/configs/maps/regexp.list"; + } + DEPS_MAP { + type = "from"; + filter = "email:addr"; + regexp = true; + map = "{= env.TESTDIR =}/configs/maps/regexp.list"; + require_symbols = "(R_SPF_ALLOW|R_SPF_DNSFAIL) & REGEXP_MAP & !FROM_MAP"; + } + RCPT_DOMAIN { + type = "rcpt"; + filter = "email:domain"; + map = "{= env.TESTDIR =}/configs/maps/domains.list"; + } + RCPT_USER { + type = "rcpt"; + filter = "email:user"; + map = "{= env.TESTDIR =}/configs/maps/users.list"; + } + RCPT_MAP { + type = "rcpt"; + filter = "email:addr"; + symbols = ["SYM1"]; + map = "{= env.TESTDIR =}/configs/maps/multiple.list"; + score = 1.0; + } + RCPT_MAP_NOMULTISYM { + type = "rcpt"; + filter = "email:addr"; + disable_multisymbol = true; + map = "{= env.TESTDIR =}/configs/maps/multiple.list"; + score = 1.0; + } + HEADER_MAP { + type = "header"; + header = "To"; + filter = "email:name"; + map = "{= env.TESTDIR =}/configs/maps/utf.list"; + regexp = true; + } + HOSTNAME_MAP { + type = "hostname"; + map = "{= env.TESTDIR =}/configs/maps/domains.list"; + } + HOSTNAME_TOP_MAP { + type = "hostname"; + filter = "top"; + map = "{= env.TESTDIR =}/configs/maps/top.list"; + } + CDB_HOSTNAME { + type = "hostname"; + map = "cdb://{= env.TESTDIR =}/configs/maps/domains.cdb"; + } + REDIS_HOSTNAME { + type = "hostname"; + map = "redis://hostname"; + } + REDIS_HOSTNAME_EXPANSION { + type = "hostname"; + map = "redis://${ip}.${principal_recipient_domain}"; + } + REDIS_IPADDR { + type = "ip"; + map = "redis://ipaddr"; + } + REDIS_FROMADDR { + type = "from"; + filter = "email:addr"; + map = "redis://emailaddr"; + } + REDIS_URL_TLD { + type = "url"; + map = "redis://hostname"; + filter = "tld"; + } + REDIS_URL_RE_FULL { + type = "url"; + map = "redis://fullurlre"; + filter = "full:regexp:/(html)$/"; + } + REDIS_URL_FULL { + type = "url"; + map = "redis://fullurl"; + filter = "full"; + } + REDIS_URL_PHISHED { + type = "url"; + map = "redis://phishedurl"; + filter = "is_phished"; + } + REDIS_URL_RE_TLD { + type = "url"; + map = "redis://tldre"; + filter = "tld:regexp:/(net)$/"; + } + REDIS_URL_RE_PLAIN { + type = "url"; + map = "redis://urlre"; + filter = "regexp:/^(www)/"; + } + REDIS_URL_NOFILTER { + type = "url"; + map = "redis://urlnofilter"; + } + REDIS_COUNTRY { + type = "country"; + map = "redis://cc"; + } + REDIS_ASN { + type = "asn"; + map = "redis://asn"; + } + REDIS_ASN_FILTERED { + type = "mempool"; + variable = "asn"; + map = "redis://asn"; + filter = "regexp:/^([0-9]).*/"; + } + RCVD_TEST_01 { + type = "received"; + max_pos = 1; + map = "{= env.TESTDIR =}/configs/maps/rcvd.list"; + } + RCVD_TEST_02 { + type = "received"; + min_pos = -1; + map = "{= env.TESTDIR =}/configs/maps/rcvd.list"; + } + RCVD_TEST_REDIS_01 { + type = "received"; + map = "redis://RCVD_TEST"; + } + RCVD_AUTHED_ONE { + type = "received"; + map = "{= env.TESTDIR =}/configs/maps/rcvd2.list"; + flags = ["authenticated"]; + nflags = ["ssl"]; + } + RCVD_AUTHED_TWO { + type = "received"; + map = "{= env.TESTDIR =}/configs/maps/rcvd2.list"; + flags = ["authenticated", "ssl"]; + } + COMBINED_MAP_AND { + type = "combined"; + rules { + ip = { + type = "radix"; + map = "{= env.TESTDIR =}/configs/maps/ip.list"; + selector = "ip"; + } + from { + map = "{= env.TESTDIR =}/configs/maps/domains.list"; + selector = "from:domain"; + } + } + expression = "from & ip"; + score = 10; + prefilter = true; + } + COMBINED_MAP_OR { + type = "combined"; + rules { + ip = { + type = "radix"; + map = "{= env.TESTDIR =}/configs/maps/ip.list"; + selector = "ip"; + } + from { + map = "{= env.TESTDIR =}/configs/maps/domains.list"; + selector = "from:domain"; + } + } + expression = "from || ip" + } +} + +rbl { + rbls { + fake { + from = true; + ipv4 = true; + ipv6 = true; + rbl = "fake.rbl"; + symbol = "FAKE_RBL_UNKNOWN"; + received = true; + symbols_prefixes = { + received = 'FAKE_RECEIVED_RBL', + from = 'FAKE_RBL', + } + unknown = true; + returncodes = { + "CODE_2" = "127.0.0.2"; + "CODE_3" = "127.0.0.3"; + } + } + fake_whitelist { + from = true; + ipv4 = true; + ipv6 = true; + received = true; + is_whitelist = true; + rbl = "fake.wl"; + symbol = "FAKE_WL_RBL_UNKNOWN"; + unknown = true; + returncodes = { + "FAKE_WL_RBL_CODE_2" = "127.0.0.2"; + "FAKE_WL_RBL_CODE_3" = "127.0.0.3"; + } + } + RSPAMD_EMAILBL { + rbl = "test8.uribl"; + url_compose_map = "{= env.TESTDIR =}/configs/maps/url_compose_map_for_mails.list"; + ignore_defaults = true; + emails = true; + emails_domainonly = true + returncodes = { + RSPAMD_EMAILBL = "127.0.0.2"; + } + } + URIBL_NOCONTENT { + rbl = "test9.uribl"; + ignore_defaults = true; + urls = true; + } + URIBL_WITHCONTENT { + rbl = "test9.uribl"; + ignore_defaults = true; + urls = true; + content_urls = true; + } + URIBL_CONTENTONLY { + rbl = "test9.uribl"; + ignore_defaults = true; + content_urls = true; + no_ip = true; + } + RBL_SELECTOR_SINGLE { + rbl = "test9.uribl"; + ignore_defaults = true; + selector = "helo()"; + } + RBL_SELECTOR_MULTIPLE { + rbl = "test9.uribl"; + ignore_defaults = true; + selector = { + sel_from = "from('smtp'):domain"; + sel_helo = "helo()"; + } + } + } +} + +surbl { + "whitelist" = [ + "rspamd-test.com" + ]; + rules { + "RSPAMD_URIBL" { + suffix = "test.uribl"; + check_dkim = true; + check_emails = true; + images = false; + process_script =<