diff options
author | Andrew Lewis <nerf@judo.za.org> | 2021-05-11 13:50:29 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2021-05-18 11:41:13 +0200 |
commit | 5f7dd6e1f27ebec013ed74865f9c1873414380cb (patch) | |
tree | e542005b610c32590a4586f313da844564295467 /test | |
parent | 7974dd00478625cbe8e754e67e39bf52d361bda9 (diff) | |
download | rspamd-5f7dd6e1f27ebec013ed74865f9c1873414380cb.tar.gz rspamd-5f7dd6e1f27ebec013ed74865f9c1873414380cb.zip |
[Test] Merge test suites; use settings
Diffstat (limited to 'test')
47 files changed, 1577 insertions, 624 deletions
diff --git a/test/functional/cases/100_general.robot b/test/functional/cases/001_merged/100_general.robot index e76b07c54..b06dd1492 100644 --- a/test/functional/cases/100_general.robot +++ b/test/functional/cases/001_merged/100_general.robot @@ -1,33 +1,32 @@ *** 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 +${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} + ... ${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 @@ -39,12 +38,14 @@ GTUBE - RSPAMC Should Contain ${result} GTUBE EMAILS DETECTION 1 - Scan File ${RSPAMD_TESTDIR}/messages/emails1.eml URL-Format=Extended + 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/102_multimap.robot b/test/functional/cases/001_merged/102_multimap.robot index 8085ad748..fcd75a8bc 100644 --- a/test/functional/cases/102_multimap.robot +++ b/test/functional/cases/001_merged/102_multimap.robot @@ -1,21 +1,15 @@ *** 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 @@ -27,282 +21,348 @@ ${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 @@ -316,22 +376,27 @@ MAP - RECEIVED - IP MINMAX POS - 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/104_get_from.robot b/test/functional/cases/001_merged/104_get_from.robot index 84b754f37..f01119f86 100644 --- a/test/functional/cases/104_get_from.robot +++ b/test/functional/cases/001_merged/104_get_from.robot @@ -1,52 +1,57 @@ *** 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 +${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/105_mimetypes.robot b/test/functional/cases/001_merged/105_mimetypes.robot index aa344aebd..e16150aa8 100644 --- a/test/functional/cases/105_mimetypes.robot +++ b/test/functional/cases/001_merged/105_mimetypes.robot @@ -1,66 +1,74 @@ *** 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 +${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/106_mid.robot b/test/functional/cases/001_merged/106_mid.robot index a42b098aa..c5510bbb3 100644 --- a/test/functional/cases/106_mid.robot +++ b/test/functional/cases/001_merged/106_mid.robot @@ -1,36 +1,36 @@ *** 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 +${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 - Expect Symbol With Score INVALID_MSGID_ALLOWED 1.00 + ... 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 - Expect Symbol With Score MISSING_MID_ALLOWED 1.00 + ... 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/114_phishing.robot b/test/functional/cases/001_merged/114_phishing.robot index 4bb54895b..bc7f3981e 100644 --- a/test/functional/cases/114_phishing.robot +++ b/test/functional/cases/001_merged/114_phishing.robot @@ -1,27 +1,26 @@ *** 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 +${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/115_dmarc.robot b/test/functional/cases/001_merged/115_dmarc.robot index d0ba8c72d..e5ed67007 100644 --- a/test/functional/cases/115_dmarc.robot +++ b/test/functional/cases/001_merged/115_dmarc.robot @@ -1,88 +1,101 @@ *** 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 +${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/117_spf.robot b/test/functional/cases/001_merged/117_spf.robot index 1887089ef..dda35f671 100644 --- a/test/functional/cases/117_spf.robot +++ b/test/functional/cases/001_merged/117_spf.robot @@ -1,116 +1,133 @@ *** 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 +${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 @@ -125,13 +142,16 @@ SPF PTRS 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 - Expect Symbol With Score And Exact Options R_SPF_ALLOW 1.0 +ip4:37.48.67.26 + ... 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/160_antivirus.robot b/test/functional/cases/001_merged/160_antivirus.robot index cac3a1893..166bdb6a8 100644 --- a/test/functional/cases/160_antivirus.robot +++ b/test/functional/cases/001_merged/160_antivirus.robot @@ -1,5 +1,4 @@ *** Settings *** -Suite Setup Rspamd Redis Setup Suite Teardown Antivirus Teardown Library Process Library ${RSPAMD_TESTDIR}/lib/rspamd.py @@ -7,40 +6,44 @@ 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 +${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 @@ -49,8 +52,8 @@ 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 - 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 @@ -60,6 +63,7 @@ FPROT HIT - PATTERN FPROT CACHE HIT Scan File ${MESSAGE} + ... Settings=${SETTINGS_FPROT} Expect Symbol FPROT_EICAR Do Not Expect Symbol CLAMAV_VIRUS # Also check ordered pattern match @@ -68,38 +72,41 @@ FPROT CACHE HIT 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 - 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 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/230_tcp.robot b/test/functional/cases/001_merged/230_tcp.robot index f44bdda15..89ec7ea5a 100644 --- a/test/functional/cases/230_tcp.robot +++ b/test/functional/cases/001_merged/230_tcp.robot @@ -1,36 +1,37 @@ *** 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 +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 +${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 @@ -47,14 +48,12 @@ Sync API TCP post request 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] @@ -69,4 +68,5 @@ Run Dummy Ssl 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/240_redis.robot b/test/functional/cases/001_merged/240_redis.robot index 18babdc79..3196dd0c6 100644 --- a/test/functional/cases/240_redis.robot +++ b/test/functional/cases/001_merged/240_redis.robot @@ -1,21 +1,11 @@ *** 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 - +${SETTINGS_REDIS} {symbols_enabled = [REDIS_TEST, SIMPLE_REDIS_ASYNC_TEST, SIMPLE_REDIS_ASYNC201809_TEST]} *** Test Cases *** Redis client diff --git a/test/functional/cases/250_dns.robot b/test/functional/cases/001_merged/250_dns.robot index 8c6a422ec..d3e64cd34 100644 --- a/test/functional/cases/250_dns.robot +++ b/test/functional/cases/001_merged/250_dns.robot @@ -1,25 +1,21 @@ *** 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 +${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/270_selector.robot b/test/functional/cases/001_merged/270_selector.robot index 683d53d0b..8250db89e 100644 --- a/test/functional/cases/270_selector.robot +++ b/test/functional/cases/001_merged/270_selector.robot @@ -1,21 +1,15 @@ *** 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 + ... 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/280_rules.robot b/test/functional/cases/001_merged/280_rules.robot index fe0efa357..52ea1c86d 100644 --- a/test/functional/cases/280_rules.robot +++ b/test/functional/cases/001_merged/280_rules.robot @@ -1,12 +1,9 @@ *** 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 @@ -16,101 +13,113 @@ ${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} + 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 -Dynamic Config - Scan File ${MESSAGE} - Expect Symbol With Score SA_BODY_WORD 10 - Expect Required Score 20 - 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 <any@attack.com> <admin@legitimate.com> 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/281_fnames.robot b/test/functional/cases/001_merged/281_fnames.robot index 399127de8..bb600b1a6 100644 --- a/test/functional/cases/281_fnames.robot +++ b/test/functional/cases/001_merged/281_fnames.robot @@ -1,19 +1,13 @@ *** 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 - +${SETTINGS_FNAME} {symbols_enabled = [TEST_FNAME]} *** Test Cases *** FILE NAMES - Scan File ${RSPAMD_TESTDIR}/messages/fname.eml + 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/290_greylist.robot b/test/functional/cases/001_merged/290_greylist.robot index 24385b5d5..05ce3d3f0 100644 --- a/test/functional/cases/290_greylist.robot +++ b/test/functional/cases/001_merged/290_greylist.robot @@ -1,27 +1,25 @@ *** 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 +${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/300_rbl.robot b/test/functional/cases/001_merged/300_rbl.robot index 82565bcb7..094eec409 100644 --- a/test/functional/cases/300_rbl.robot +++ b/test/functional/cases/001_merged/300_rbl.robot @@ -1,57 +1,62 @@ *** 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 + ... 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 @@ -60,11 +65,13 @@ CONTENT URLS 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/310_udp.robot b/test/functional/cases/001_merged/310_udp.robot index d5486a030..e94ed60e1 100644 --- a/test/functional/cases/310_udp.robot +++ b/test/functional/cases/001_merged/310_udp.robot @@ -7,34 +7,32 @@ 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 +${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 - Rspamd Setup UDP Teardown ${udp_pid} = Get File /tmp/dummy_udp.pid Shutdown Process With Children ${udp_pid} - Rspamd Teardown Run Dummy UDP [Arguments] diff --git a/test/functional/cases/321_arc_check.robot b/test/functional/cases/001_merged/321_arc_check.robot index 1a22eda9e..3f6488bc4 100644 --- a/test/functional/cases/321_arc_check.robot +++ b/test/functional/cases/001_merged/321_arc_check.robot @@ -1,21 +1,19 @@ *** 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 +${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/340_surbl.robot b/test/functional/cases/001_merged/340_surbl.robot index faf4a92c2..a1d073642 100644 --- a/test/functional/cases/340_surbl.robot +++ b/test/functional/cases/001_merged/340_surbl.robot @@ -1,31 +1,30 @@ *** 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 +${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 - Expect Symbol RSPAMD_URIBL - Expect Symbol DBL_SPAM - Do Not Expect Symbol DBL_PHISH + ... 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 @@ -33,6 +32,7 @@ SURBL Example.net domain 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 @@ -40,6 +40,7 @@ SURBL Example.org domain 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 @@ -49,6 +50,7 @@ SURBL Example.ru domain 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 @@ -60,6 +62,7 @@ SURBL Example.ru ZEN domain 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 @@ -68,6 +71,7 @@ SURBL Example.com domain image false 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 @@ -76,6 +80,7 @@ SURBL @example.com mail html 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 @@ -84,6 +89,7 @@ SURBL @example.com mail text 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 @@ -91,6 +97,7 @@ SURBL example.com not encoded url in subject 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 @@ -98,41 +105,49 @@ SURBL example.com encoded url in subject 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 @@ -140,6 +155,7 @@ SURBL IDN domain 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 @@ -147,16 +163,20 @@ SURBL IDN Punycode domain 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/350_magic.robot b/test/functional/cases/001_merged/350_magic.robot index 6dad5f247..b8f6936cb 100644 --- a/test/functional/cases/350_magic.robot +++ b/test/functional/cases/001_merged/350_magic.robot @@ -1,19 +1,14 @@ *** 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 +${SETTINGS_MAGIC} {symbols_enabled = [MAGIC_SYM]} *** Test Cases *** Magic detections bundle 1 - Scan File ${RSPAMD_TESTDIR}/messages/gargantua.eml + Scan File ${RSPAMD_TESTDIR}/messages/gargantua.eml Settings=${SETTINGS_MAGIC} Expect Symbols MAGIC_SYM_ZIP_2 ... MAGIC_SYM_RAR_3 ... MAGIC_SYM_EXE_4 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/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/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/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/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/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/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/multimap.conf b/test/functional/configs/merged-override.conf index c59c1ac57..ab0779fdf 100644 --- a/test/functional/configs/multimap.conf +++ b/test/functional/configs/merged-override.conf @@ -1,12 +1,42 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -asn { -} -spf {} -redis { - servers = "{= env.REDIS_ADDR =}:{= env.REDIS_PORT =}"; - expand_keys = true; +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"; @@ -209,8 +239,153 @@ multimap { } } -symbols { - SYM1 = { - score = 1.0, +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 =<<EOD +function(url, suffix) + local cr = require "rspamd_cryptobox_hash" + local h = cr.create(url):base32():sub(1, 32) + return string.format("%s.%s", h, suffix) +end +EOD; + } + "DBL" { + suffix = "test2.uribl"; + no_ip = true; + check_emails = true; + check_dkim = true; + ips = { + # spam domain + DBL_SPAM = "127.0.1.2"; + # phish domain + DBL_PHISH = "127.0.1.4"; + } + } + "URIBL_MULTI" { + suffix = "test3.uribl"; + check_dkim = true; + check_emails = true; + bits { + URIBL_BLOCKED = 1; + URIBL_BLACK = 2; + URIBL_GREY = 4; + URIBL_RED = 8; + } + } + "SPAMHAUS_ZEN_URIBL" { + suffix = "test4.uribl"; + resolve_ip = true; + check_emails = true; + ips { + URIBL_SBL = "127.0.0.2"; + URIBL_SBL_CSS = "127.0.0.3"; + URIBL_XBL = ["127.0.0.4", "127.0.0.5", "127.0.0.6", "127.0.0.7"]; + URIBL_PBL = ["127.0.0.10", "127.0.0.11"]; + URIBL_DROP = "127.0.0.9"; + } + } + "RSPAMD_URIBL_IMAGES" { + suffix = "test.uribl"; + check_dkim = true; + check_emails = false; + images = true; + process_script =<<EOD + function(url, suffix) + local cr = require "rspamd_cryptobox_hash" + local h = cr.create(url):base32():sub(1, 32) + return string.format("%s.%s", h, suffix) +end +EOD; + } + "BAD_SUBDOMAIN" { + suffix = "test7.uribl"; + url_compose_map = "{= env.TESTDIR =}/configs/maps/url_compose_map.list"; + check_dkim = true; + check_emails = false; + } } } diff --git a/test/functional/configs/merged.conf b/test/functional/configs/merged.conf new file mode 100644 index 000000000..132461d90 --- /dev/null +++ b/test/functional/configs/merged.conf @@ -0,0 +1,41 @@ +.include "{= env.INSTALLROOT =}/etc/rspamd/rspamd.conf" + +lua = "{= env.TESTDIR =}/lua/test_coverage.lua" + +# 101_lua +lua = "{= env.TESTDIR =}/lua/conditions.lua" +lua = "{= env.TESTDIR =}/lua/hashes.lua" +lua = "{= env.TESTDIR =}/lua/maps_kv.lua" +lua = "{= env.TESTDIR =}/lua/option_order.lua" +lua = "{= env.TESTDIR =}/lua/recipients.lua" +lua = "{= env.TESTDIR =}/lua/tlds.lua" + +# 104_get_from +lua = "{= env.TESTDIR =}/lua/get_from.lua" + +# 220_http +lua = "{= env.TESTDIR =}/lua/http.lua" + +# 230_tcp / 231_tcp_down +lua = "{= env.TESTDIR =}/lua/tcp.lua" + +# 240_redis +lua = "{= env.TESTDIR =}/lua/redis.lua" + +# 250_dns +lua = "{= env.TESTDIR =}/lua/dns.lua" + +# 270_selector +lua = "{= env.TESTDIR =}/lua/selector_test.lua" + +# 281_fnames +lua = "{= env.TESTDIR =}/lua/test_fname.lua" + +# 310_udp +lua = "{= env.TESTDIR =}/lua/udp.lua" + +# 350_magic +lua = "{= env.TESTDIR =}/lua/magic.lua" + +.include(priority=1,duplicate=merge) "{= env.TESTDIR =}/configs/merged-local.conf" +.include(priority=2,duplicate=replace) "{= env.TESTDIR =}/configs/merged-override.conf" diff --git a/test/functional/configs/mid.conf b/test/functional/configs/mid.conf deleted file mode 100644 index ce024299a..000000000 --- a/test/functional/configs/mid.conf +++ /dev/null @@ -1,11 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -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" - ]; - } -} diff --git a/test/functional/configs/mime_types.conf b/test/functional/configs/mime_types.conf deleted file mode 100644 index 82bd4187c..000000000 --- a/test/functional/configs/mime_types.conf +++ /dev/null @@ -1,21 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -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"; -} diff --git a/test/functional/configs/phishing.conf b/test/functional/configs/phishing.conf deleted file mode 100644 index aa6eb8fe9..000000000 --- a/test/functional/configs/phishing.conf +++ /dev/null @@ -1,13 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -phishing { - symbol = "PHISHING"; - strict_domains = { - STRICT_PHISHING = [ - "{= env.TESTDIR =}/configs/maps/strict.phishing", - ]; - STRICTER_PHISHING = [ - "{= env.TESTDIR =}/configs/maps/stricter.phishing" - ] - } -} diff --git a/test/functional/configs/rbl.conf b/test/functional/configs/rbl.conf deleted file mode 100644 index c5caa2e50..000000000 --- a/test/functional/configs/rbl.conf +++ /dev/null @@ -1,77 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -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()"; - } - } - } -} diff --git a/test/functional/configs/selector.conf b/test/functional/configs/selector.conf deleted file mode 100644 index b99ae5639..000000000 --- a/test/functional/configs/selector.conf +++ /dev/null @@ -1,10 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -regexp { - CONFIG_SELECTOR_RE_RCPT_SUBJECT { - re = 'test=/test@user.com some subject/$', - score = 100500, - } -} - -lua = "{= env.TESTDIR =}/lua/selector_test.lua" diff --git a/test/functional/configs/surbl.conf b/test/functional/configs/surbl.conf deleted file mode 100644 index fe6368277..000000000 --- a/test/functional/configs/surbl.conf +++ /dev/null @@ -1,93 +0,0 @@ -.include(duplicate=append,priority=0) "{= env.TESTDIR =}/configs/plugins.conf" - -surbl { - "whitelist" = [ - "rspamd-test.com" - ]; - rules { - "RSPAMD_URIBL" { - suffix = "test.uribl"; - check_dkim = true; - check_emails = true; - images = false; - process_script =<<EOD -function(url, suffix) - local cr = require "rspamd_cryptobox_hash" - local h = cr.create(url):base32():sub(1, 32) - return string.format("%s.%s", h, suffix) -end -EOD; - } - "DBL" { - suffix = "test2.uribl"; - no_ip = true; - check_emails = true; - check_dkim = true; - ips = { - # spam domain - DBL_SPAM = "127.0.1.2"; - # phish domain - DBL_PHISH = "127.0.1.4"; - } - } - "URIBL_MULTI" { - suffix = "test3.uribl"; - check_dkim = true; - check_emails = true; - bits { - URIBL_BLOCKED = 1; - URIBL_BLACK = 2; - URIBL_GREY = 4; - URIBL_RED = 8; - } - } - "SPAMHAUS_ZEN_URIBL" { - suffix = "test4.uribl"; - resolve_ip = true; - check_emails = true; - ips { - URIBL_SBL = "127.0.0.2"; - URIBL_SBL_CSS = "127.0.0.3"; - URIBL_XBL = ["127.0.0.4", "127.0.0.5", "127.0.0.6", "127.0.0.7"]; - URIBL_PBL = ["127.0.0.10", "127.0.0.11"]; - URIBL_DROP = "127.0.0.9"; - } - } - "RSPAMD_URIBL_IMAGES" { - suffix = "test.uribl"; - check_dkim = true; - check_emails = false; - images = true; - process_script =<<EOD - function(url, suffix) - local cr = require "rspamd_cryptobox_hash" - local h = cr.create(url):base32():sub(1, 32) - return string.format("%s.%s", h, suffix) -end -EOD; - } - "BAD_SUBDOMAIN" { - suffix = "test7.uribl"; - url_compose_map = "{= env.TESTDIR =}/configs/maps/url_compose_map.list"; - check_dkim = true; - check_emails = false; - } - } -} - -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; - } - } -} diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot index 865245e62..e5132e3a7 100644 --- a/test/functional/lib/rspamd.robot +++ b/test/functional/lib/rspamd.robot @@ -242,6 +242,11 @@ Run Rspamd # We need to send output to files (or discard output) to avoid hanging Robot ... stdout=${RSPAMD_TMPDIR}/rspamd.stdout stderr=${RSPAMD_TMPDIR}/rspamd.stderr + # Log stdout/stderr + ${rspamd_output} = Run Keyword If ${result.rc} == 0 Get File ${RSPAMD_TMPDIR}/rspamd.stdout + ... ELSE Get File ${RSPAMD_TMPDIR}/rspamd.stderr + Log ${rspamd_output} + # Abort if it failed Should Be Equal As Integers ${result.rc} 0 diff --git a/test/functional/lua/get_from.lua b/test/functional/lua/get_from.lua index 4e3267b41..9282866da 100644 --- a/test/functional/lua/get_from.lua +++ b/test/functional/lua/get_from.lua @@ -1,8 +1,10 @@ rspamd_config:register_symbol({ - name = 'SIMPLE_TEST', + name = 'GET_FROM', score = 1.0, callback = function(task) - local a = task:get_from('mime')[1] - task:insert_result('GET_FROM', 0.0, a.name .. ',' .. a.addr .. ',' .. a.user .. ',' .. a.domain) + local a = task:get_from('mime') + if not a then return end + a = a[1] + return true, (a.name or '') .. ',' .. (a.addr or '') .. ',' .. (a.user or '') .. ',' .. (a.domain or '') end }) diff --git a/test/functional/lua/http.lua b/test/functional/lua/http.lua index d0ed4e7b7..c5b91ff3d 100644 --- a/test/functional/lua/http.lua +++ b/test/functional/lua/http.lua @@ -106,7 +106,7 @@ local function periodic(cfg, ev_base) end rspamd_config:register_symbol({ - name = 'SIMPLE_TEST', + name = 'SIMPLE_HTTP_TEST', score = 1.0, callback = http_symbol, no_squeeze = true, @@ -145,7 +145,7 @@ local function http_large_symbol(task) end end rspamd_config:register_symbol({ - name = 'LARGE_TEST', + name = 'LARGE_HTTP_TEST', score = 1.0, callback = http_large_symbol, no_squeeze = true, @@ -166,4 +166,4 @@ rspamd_config:add_on_load(function(cfg, ev_base, worker) end rspamd_config:add_periodic(ev_base, 0, periodic, false) -end)
\ No newline at end of file +end) diff --git a/test/functional/lua/maps_kv.lua b/test/functional/lua/maps_kv.lua index b63b32c34..a62d25ddd 100644 --- a/test/functional/lua/maps_kv.lua +++ b/test/functional/lua/maps_kv.lua @@ -2,17 +2,17 @@ local rspamd_ip = require 'rspamd_ip' local rspamd_logger = require 'rspamd_logger' local radix_map = rspamd_config:add_map ({ - url = '${RADIX_MAP}', + url = rspamd_env.RADIX_MAP, type = 'radix', }) local map_map = rspamd_config:add_map ({ - url = '${MAP_MAP}', + url = rspamd_env.MAP_MAP, type = 'map', }) local regexp_map = rspamd_config:add_map ({ - url = '${REGEXP_MAP}', + url = rspamd_env.REGEXP_MAP, type = 'regexp', }) |