diff options
Diffstat (limited to 'test/functional/cases/001_merged')
22 files changed, 1816 insertions, 0 deletions
diff --git a/test/functional/cases/001_merged/100_general.robot b/test/functional/cases/001_merged/100_general.robot new file mode 100644 index 0000000..16b9b5f --- /dev/null +++ b/test/functional/cases/001_merged/100_general.robot @@ -0,0 +1,61 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${GTUBE} ${RSPAMD_TESTDIR}/messages/gtube.eml +${SETTINGS_NOSYMBOLS} {symbols_enabled = []} + +*** Test Cases *** +GTUBE + Scan File ${GTUBE} + ... Settings=${SETTINGS_NOSYMBOLS} + Expect Symbol GTUBE + +GTUBE - Encrypted + ${result} = Run Rspamc -p -h ${RSPAMD_LOCAL_ADDR}:${RSPAMD_PORT_NORMAL} --key ${RSPAMD_KEY_PUB1} + ... ${GTUBE} --header=Settings=${SETTINGS_NOSYMBOLS} + Check Rspamc ${result} GTUBE ( + +GTUBE - Scan File feature + Scan File By Reference ${GTUBE} + ... Settings=${SETTINGS_NOSYMBOLS} + Expect Symbol GTUBE + +GTUBE - Scan File feature (encoded) + ${encoded} = Encode Filename ${GTUBE} + Scan File By Reference ${encoded} + ... Settings=${SETTINGS_NOSYMBOLS} + Expect Symbol GTUBE + +GTUBE - SPAMC + ${result} = Spamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} ${GTUBE} + Should Contain ${result} GTUBE + +GTUBE - RSPAMC + ${result} = Rspamc ${RSPAMD_LOCAL_ADDR} ${RSPAMD_PORT_NORMAL} ${GTUBE} + Should Contain ${result} GTUBE + +EMAILS DETECTION 1 + Scan File ${RSPAMD_TESTDIR}/messages/emails1.eml + ... URL-Format=Extended Settings=${SETTINGS_NOSYMBOLS} + Expect Email jim@example.net + Expect Email bob@example.net + Expect Email rupert@example.net + +EMAILS DETECTION ZEROFONT + Scan File ${RSPAMD_TESTDIR}/messages/zerofont.eml + ... Settings={symbols_enabled = [MANY_INVISIBLE_PARTS, ZERO_FONT]} + Expect Symbol MANY_INVISIBLE_PARTS + Expect Symbol ZERO_FONT + +HTML ONLY - TRUE POSITIVE + Scan File ${RSPAMD_TESTDIR}/messages/zerofont.eml + ... Settings={symbols_enabled = [MIME_HTML_ONLY]} + Expect Symbol MIME_HTML_ONLY + +HTML ONLY - TRUE NEGATIVE + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml + ... Settings={symbols_enabled = [MIME_HTML_ONLY]} + Do Not Expect Symbol MIME_HTML_ONLY 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 0000000..d1a771c --- /dev/null +++ b/test/functional/cases/001_merged/101_lua.robot @@ -0,0 +1,50 @@ +*** 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 + +Remove Result + Scan File ${MESSAGE} Settings={symbols_enabled = [REMOVE_RESULT_EXPECTED, REMOVE_RESULT_UNEXPECTED]} + Expect Symbol REMOVE_RESULT_EXPECTED + Do Not Expect Symbol REMOVE_RESULT_UNEXPECTED + +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 + +External Maps Simple + Scan File ${MESSAGE} Settings={symbols_enabled = [EXTERNAL_MAP]} + Expect Symbol With Exact Options EXTERNAL_MAP +hello map
\ No newline at end of file diff --git a/test/functional/cases/001_merged/102_multimap.robot b/test/functional/cases/001_merged/102_multimap.robot new file mode 100644 index 0000000..135f5ce --- /dev/null +++ b/test/functional/cases/001_merged/102_multimap.robot @@ -0,0 +1,436 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${FREEMAIL_CC} ${RSPAMD_TESTDIR}/messages/freemailcc.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${RCVD1} ${RSPAMD_TESTDIR}/messages/received1.eml +${RCVD2} ${RSPAMD_TESTDIR}/messages/received2.eml +${RCVD3} ${RSPAMD_TESTDIR}/messages/received3.eml +${RCVD4} ${RSPAMD_TESTDIR}/messages/received4.eml +${URL1} ${RSPAMD_TESTDIR}/messages/url1.eml +${URL2} ${RSPAMD_TESTDIR}/messages/url2.eml +${URL3} ${RSPAMD_TESTDIR}/messages/url3.eml +${URL4} ${RSPAMD_TESTDIR}/messages/url4.eml +${URL5} ${RSPAMD_TESTDIR}/messages/url5.eml +${URL_ICS} ${RSPAMD_TESTDIR}/messages/ics.eml +${UTF_MESSAGE} ${RSPAMD_TESTDIR}/messages/utf.eml + +*** Test Cases *** +URL_ICS + Scan File ${URL_ICS} + ... Settings={symbols_enabled = []} + Expect URL test.com + +MAP - DNSBL HIT + Scan File ${MESSAGE} IP=127.0.0.2 + ... Settings={symbols_enabled = [DNSBL_MAP]} + Expect Symbol DNSBL_MAP + +MAP - DNSBL MISS + Scan File ${MESSAGE} IP=127.0.0.1 + ... Settings={symbols_enabled = [DNSBL_MAP]} + Do Not Expect Symbol DNSBL_MAP + +MAP - IP HIT + Scan File ${MESSAGE} IP=127.0.0.1 + ... Settings={symbols_enabled = [IP_MAP]} + Expect Symbol IP_MAP + +MAP - IP MISS + Scan File ${MESSAGE} IP=127.0.0.2 + ... Settings={symbols_enabled = [IP_MAP]} + Do Not Expect Symbol IP_MAP + +MAP - IP MASK + Scan File ${MESSAGE} IP=10.1.0.10 + ... Settings={symbols_enabled = [IP_MAP]} + Expect Symbol IP_MAP + +MAP - IP MASK MISS + Scan File ${MESSAGE} IP=11.1.0.10 + ... Settings={symbols_enabled = [IP_MAP]} + Do Not Expect Symbol IP_MAP + +MAP - IP V6 + Scan File ${MESSAGE} IP=::1 + ... Settings={symbols_enabled = [IP_MAP]} + Expect Symbol IP_MAP + +MAP - IP V6 MISS + Scan File ${MESSAGE} IP=fe80::1 + ... Settings={symbols_enabled = [IP_MAP]} + Do Not Expect Symbol IP_MAP + +MAP - FROM + Scan File ${MESSAGE} From=user@example.com + ... Settings={symbols_enabled = [FROM_MAP]} + Expect Symbol FROM_MAP + +MAP - COMBINED IP MASK FROM + Scan File ${MESSAGE} IP=10.1.0.10 From=user@example.com + ... Settings={symbols_enabled = [COMBINED_MAP_AND, COMBINED_MAP_OR]} + Expect Symbol With Score COMBINED_MAP_AND 10 + Do Not Expect Symbol COMBINED_MAP_OR + Expect Action no action + +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 - MULSYM SYMBOL + SCORE + OPTS + Scan File ${MESSAGE} Rcpt=user6@example.com + ... Settings={symbols_enabled = [RCPT_MAP, SYM1]} + Expect Symbol With Score And Exact Options SYM1 -10.1 opt1 opt2 + +MAP - UTF + Scan File ${UTF_MESSAGE} + ... Settings={symbols_enabled = [HEADER_MAP]} + Expect Symbol HEADER_MAP + +MAP - UTF MISS + Scan File ${MESSAGE} + ... Settings={symbols_enabled = [HEADER_MAP]} + Do Not Expect Symbol HEADER_MAP + +MAP - HOSTNAME + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com + ... Settings={symbols_enabled = [HOSTNAME_MAP]} + Expect Symbol HOSTNAME_MAP + +MAP - HOSTNAME MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com + ... Settings={symbols_enabled = [HOSTNAME_MAP]} + Do Not Expect Symbol HOSTNAME_MAP + +MAP - TOP + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.au + ... Settings={symbols_enabled = [HOSTNAME_TOP_MAP]} + Expect Symbol HOSTNAME_TOP_MAP + +MAP - TOP MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.bg + ... Settings={symbols_enabled = [HOSTNAME_TOP_MAP]} + Do Not Expect Symbol HOSTNAME_TOP_MAP + +MAP - CDB - HOSTNAME + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com + ... Settings={symbols_enabled = [CDB_HOSTNAME]} + Expect Symbol CDB_HOSTNAME + +MAP - CDB - HOSTNAME MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com + ... Settings={symbols_enabled = [CDB_HOSTNAME]} + Do Not Expect Symbol CDB_HOSTNAME + +MAP - REDIS - HOSTNAME + Redis HSET hostname redistest.example.net ${EMPTY} + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net + ... Settings={symbols_enabled = [REDIS_HOSTNAME]} + Expect Symbol REDIS_HOSTNAME + +MAP - REDIS - HOSTNAME MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com + ... Settings={symbols_enabled = [REDIS_HOSTNAME]} + Do Not Expect Symbol REDIS_HOSTNAME + +MAP - REDIS - HOSTNAME - EXPANSION - HIT + Redis HSET 127.0.0.1.foo.com redistest.example.net ${EMPTY} + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net Rcpt=bob@foo.com + ... Settings={symbols_enabled = [REDIS_HOSTNAME_EXPANSION]} + Expect Symbol REDIS_HOSTNAME_EXPANSION + +MAP - REDIS - HOSTNAME - EXPANSION - MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net Rcpt=bob@bar.com + ... Settings={symbols_enabled = [REDIS_HOSTNAME_EXPANSION]} + Do Not Expect Symbol REDIS_HOSTNAME_EXPANSION + +MAP - REDIS - IP + Redis HSET ipaddr 127.0.0.1 ${EMPTY} + Scan File ${MESSAGE} IP=127.0.0.1 + ... Settings={symbols_enabled = [REDIS_IPADDR]} + Expect Symbol REDIS_IPADDR + +MAP - REDIS - IP - MISS + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [REDIS_IPADDR]} + Do Not Expect Symbol REDIS_IPADDR + +MAP - REDIS - FROM + Redis HSET emailaddr from@rspamd.tk ${EMPTY} + Scan File ${MESSAGE} From=from@rspamd.tk + ... Settings={symbols_enabled = [REDIS_FROMADDR]} + Expect Symbol REDIS_FROMADDR + +MAP - REDIS - FROM MISS + Scan File ${MESSAGE} From=user@other.com + ... Settings={symbols_enabled = [REDIS_FROMADDR]} + Do Not Expect Symbol REDIS_FROMADDR + +MAP - REDIS - URL TLD - HIT + Redis HSET hostname example.com ${EMPTY} + Scan File ${URL1} + ... Settings={symbols_enabled = [REDIS_URL_TLD]} + Expect Symbol REDIS_URL_TLD + +MAP - REDIS - URL TLD - MISS + Scan File ${URL2} + ... Settings={symbols_enabled = [REDIS_URL_TLD]} + Do Not Expect Symbol REDIS_URL_TLD + +MAP - REDIS - URL RE FULL - HIT + Redis HSET fullurlre html ${EMPTY} + Scan File ${URL2} + ... Settings={symbols_enabled = [REDIS_URL_RE_FULL]} + Expect Symbol REDIS_URL_RE_FULL + +MAP - REDIS - URL RE FULL - MISS + Scan File ${URL1} + ... Settings={symbols_enabled = [REDIS_URL_RE_FULL]} + Do Not Expect Symbol REDIS_URL_RE_FULL + +MAP - REDIS - URL FULL - HIT + Redis HSET fullurl https://www.example.com/foo?a=b ${EMPTY} + Scan File ${URL1} + ... Settings={symbols_enabled = [REDIS_URL_FULL]} + Expect Symbol REDIS_URL_FULL + +MAP - REDIS - URL FULL - MISS + Scan File ${URL2} + ... Settings={symbols_enabled = [REDIS_URL_FULL]} + Do Not Expect Symbol REDIS_URL_FULL + +MAP - REDIS - URL PHISHED - HIT + Redis HSET phishedurl www.rspamd.com ${EMPTY} + Scan File ${URL3} + ... Settings={symbols_enabled = [REDIS_URL_PHISHED]} + Expect Symbol REDIS_URL_PHISHED + +MAP - REDIS - URL PHISHED - MISS + Scan File ${URL4} + ... Settings={symbols_enabled = [REDIS_URL_PHISHED]} + Do Not Expect Symbol REDIS_URL_PHISHED + +MAP - REDIS - URL PLAIN REGEX - HIT + Redis HSET urlre www ${EMPTY} + Scan File ${URL3} + ... Settings={symbols_enabled = [REDIS_URL_RE_PLAIN]} + Expect Symbol REDIS_URL_RE_PLAIN + +MAP - REDIS - URL PLAIN REGEX - MISS + Scan File ${URL4} + ... Settings={symbols_enabled = [REDIS_URL_RE_PLAIN]} + Do Not Expect Symbol REDIS_URL_RE_PLAIN + +MAP - REDIS - URL TLD REGEX - HIT + Redis HSET tldre net ${EMPTY} + Scan File ${URL5} + ... Settings={symbols_enabled = [REDIS_URL_RE_TLD]} + Expect Symbol REDIS_URL_RE_TLD + +MAP - REDIS - URL TLD REGEX - MISS + Scan File ${URL4} + ... Settings={symbols_enabled = [REDIS_URL_RE_TLD]} + Do Not Expect Symbol REDIS_URL_RE_TLD + +MAP - REDIS - URL NOFILTER - HIT + Redis HSET urlnofilter www.example.net ${EMPTY} + Scan File ${URL5} + ... Settings={symbols_enabled = [REDIS_URL_NOFILTER]} + Expect Symbol REDIS_URL_NOFILTER + +MAP - REDIS - URL NOFILTER - MISS + Scan File ${URL4} + ... Settings={symbols_enabled = [REDIS_URL_NOFILTER]} + Do Not Expect Symbol REDIS_URL_NOFILTER + +MAP - REDIS - ASN - HIT + Redis HSET asn 15169 ${EMPTY} + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [REDIS_ASN, ASN_CHECK]} + Expect Symbol REDIS_ASN + +MAP - REDIS - ASN - MISS + Scan File ${MESSAGE} IP=46.228.47.114 + ... Settings={symbols_enabled = [REDIS_ASN, ASN_CHECK]} + Do Not Expect Symbol REDIS_ASN + +MAP - REDIS - CC - HIT + Redis HSET cc US ${EMPTY} + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [REDIS_COUNTRY, ASN_CHECK]} + Expect Symbol REDIS_COUNTRY + +MAP - REDIS - CC - MISS + Scan File ${MESSAGE} IP=46.228.47.114 + ... Settings={symbols_enabled = [REDIS_COUNTRY, ASN_CHECK]} + Do Not Expect Symbol REDIS_COUNTRY + +MAP - REDIS - ASN FILTERED - HIT + Redis HSET asn 1 ${EMPTY} + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [REDIS_ASN_FILTERED, ASN_CHECK]} + Expect Symbol REDIS_ASN_FILTERED + +MAP - REDIS - ASN FILTERED - MISS + Scan File ${MESSAGE} IP=46.228.47.114 + ... Settings={symbols_enabled = [REDIS_ASN_FILTERED, ASN_CHECK]} + Do Not Expect Symbol REDIS_ASN_FILTERED + +MAP - RECEIVED - IP MINMAX POS - ONE + Scan File ${RCVD1} + ... Settings={symbols_enabled = [RCVD_TEST_01, RCVD_TEST02]} + Expect Symbol RCVD_TEST_01 + Do Not Expect Symbol RCVD_TEST_02 + +# Relies on parsing of shitty received +#MAP - RECEIVED - IP MINMAX POS - TWO / RCVD_AUTHED_ONE HIT +# Scan File ${RCVD2} +# Expect Symbol RCVD_TEST_02 +# Do Not Expect Symbol RCVD_TEST_01 +# Expect Symbol RCVD_AUTHED_ONE + +MAP - RECEIVED - REDIS + Redis HSET RCVD_TEST 2a01:7c8:aab6:26d:5054:ff:fed1:1da2 ${EMPTY} + Scan File ${RCVD1} + ... Settings={symbols_enabled = [RCVD_TEST_REDIS_01]} + Expect Symbol RCVD_TEST_REDIS_01 + +RCVD_AUTHED_ONE & RCVD_AUTHED_TWO - MISS + Scan File ${RCVD3} + ... Settings={symbols_enabled = [RCVD_AUTHED_ONE, RCVD_AUTHED_TWO]} + Do Not Expect Symbol RCVD_AUTHED_ONE + Do Not Expect Symbol RCVD_AUTHED_TWO + +RCVD_AUTHED_TWO HIT / RCVD_AUTHED_ONE MISS + Scan File ${RCVD4} + ... Settings={symbols_enabled = [RCVD_AUTHED_ONE, RCVD_AUTHED_TWO]} + Expect Symbol RCVD_AUTHED_TWO + Do Not Expect Symbol RCVD_AUTHED_ONE + +FREEMAIL_CC + Scan File ${FREEMAIL_CC} + ... Settings={symbols_enabled = [FREEMAIL_CC]} + Expect Symbol With Score And Exact Options FREEMAIL_CC 19.00 test.com test1.com test2.com test3.com test4.com test5.com test6.com test7.com test8.com test9.com test10.com test11.com test12.com test13.com test14.com + +MAP - MULTISYMBOL DISABLED + Scan File ${MESSAGE} Rcpt=user3@example.com + ... Settings={symbols_enabled = [RCPT_MAP_NOMULTISYM, SYM1]} + Expect Symbol With Exact Options RCPT_MAP_NOMULTISYM user3@example.com SYM1 + +MAP - EXTERNAL + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.au + ... Settings={symbols_enabled = [EXTERNAL_MULTIMAP]} + Expect Symbol EXTERNAL_MULTIMAP + +MAP - EXTERNAL MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.bg + ... Settings={symbols_enabled = [EXTERNAL_MULTIMAP]} + Do Not Expect Symbol EXTERNAL_MULTIMAP + +MAP - DYNAMIC SYMBOLS - SYM1 + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=foo + ... Settings={symbols_enabled = [DYN_TEST1,DYN_TEST2,DYN_MULTIMAP]} + Expect Symbol DYN_TEST1 + Do Not Expect Symbol DYN_TEST2 + +MAP - DYNAMIC SYMBOLS - SYM2 + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=bar + ... Settings={symbols_enabled = [DYN_TEST1,DYN_TEST2,DYN_MULTIMAP]} + Expect Symbol DYN_TEST2 + Do Not Expect Symbol DYN_TEST1 + +MAP - DYNAMIC SYMBOLS - MISS + Scan File ${MESSAGE} IP=127.0.0.1 Hostname=baz + ... Settings={symbols_enabled = [DYN_TEST1,DYN_TEST2,DYN_MULTIMAP]} + Do Not Expect Symbol DYN_TEST2 + Do Not Expect Symbol DYN_TEST1 diff --git a/test/functional/cases/001_merged/104_get_from.robot b/test/functional/cases/001_merged/104_get_from.robot new file mode 100644 index 0000000..f01119f --- /dev/null +++ b/test/functional/cases/001_merged/104_get_from.robot @@ -0,0 +1,57 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${OPTIONS1} ,user@example.org,user,example.org +${OPTIONS2} First Last,user@example.org,user,example.org +${OPTIONS3} First M. Last,user@example.org,user,example.org +${SETTINGS_GETFROM} {symbols_enabled = [${SYMBOL}]} +${SYMBOL} GET_FROM + +*** Test Cases *** +task:get_from('mime') - address only + Scan File ${RSPAMD_TESTDIR}/messages/from/from.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol ${SYMBOL} + +task:get_from('mime') - comment + Scan File ${RSPAMD_TESTDIR}/messages/from/from_comment.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS1} + +task:get_from('mime') - display name + Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2} + +task:get_from('mime') - display name Base64 + Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn_base64.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} Кириллица,user@example.org,user,example.org + +task:get_from('mime') - display name and comment + Scan File ${RSPAMD_TESTDIR}/messages/from/from_dn_comment.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2} + +task:get_from('mime') - quoted display name + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} + +task:get_from('mime') - quoted display name and comment + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_comment.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} + +task:get_from('mime') - quoted in the middle of DN (outer spaces) + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_middle.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} + +task:get_from('mime') - quoted in the middle of DN (inner spaces) + Scan File ${RSPAMD_TESTDIR}/messages/from/from_quoted_dn_middle_inner.eml + ... Settings=${SETTINGS_GETFROM} + Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3} diff --git a/test/functional/cases/001_merged/105_mimetypes.robot b/test/functional/cases/001_merged/105_mimetypes.robot new file mode 100644 index 0000000..e16150a --- /dev/null +++ b/test/functional/cases/001_merged/105_mimetypes.robot @@ -0,0 +1,74 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_MIMETYPES} {symbols_enabled = [MIME_TYPES_CALLBACK]} + +*** Test Cases *** +Zip + Scan File ${RSPAMD_TESTDIR}/messages/zip.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION exe + +Zip Double Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/zip-doublebad.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_DOUBLE_BAD_EXTENSION .pdf.exe + +Next-to-last Double Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/next2last-doublebad.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_DOUBLE_BAD_EXTENSION .scr.xz + +Date is followed by Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/rar-date-bad-ext.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION scr + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Dotted file name is followed by Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/bad_ext.dotted_file_name.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION exe + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Dotted numbers in parentheses is followed by Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/next2last-digits_in_parens.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION msi + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Dotted numbers in square brackets is followed by Bad Extension + Scan File ${RSPAMD_TESTDIR}/messages/next2last-digits_in_brackets.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION msi + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Rar4 + Scan File ${RSPAMD_TESTDIR}/messages/rar4.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_BAD_EXTENSION exe + +Cloaked Archive Extension + Scan File ${RSPAMD_TESTDIR}/messages/f.zip.gz.eml + ... Settings=${SETTINGS_MIMETYPES} + Expect Symbol With Exact Options MIME_ARCHIVE_IN_ARCHIVE .zip.gz zip + +Multipart Archive Extension + Scan File ${RSPAMD_TESTDIR}/messages/f.zip.001.eml + ... Settings=${SETTINGS_MIMETYPES} + Do Not Expect Symbol MIME_ARCHIVE_IN_ARCHIVE + +Exe file, but name in filename_whitelist + Scan File ${RSPAMD_TESTDIR}/messages/exe_attm.eml + ... Settings=${SETTINGS_MIMETYPES} + Do Not Expect Symbol MIME_BAD_EXTENSION + Do Not Expect Symbol MIME_BAD_ATTACHMENT + Do Not Expect Symbol MIME_DOUBLE_BAD_EXTENSION + +Empty text part should not be treat as html + Scan File ${RSPAMD_TESTDIR}/messages/empty-plain-text.eml + ... Settings=${SETTINGS_MIMETYPES} + Do Not Expect Symbol FORGED_OUTLOOK_HTML diff --git a/test/functional/cases/001_merged/106_mid.robot b/test/functional/cases/001_merged/106_mid.robot new file mode 100644 index 0000000..c5510bb --- /dev/null +++ b/test/functional/cases/001_merged/106_mid.robot @@ -0,0 +1,36 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_MID} {symbols_enabled = [DKIM_CHECK,INVALID_MSGID,INVALID_MSGID_ALLOWED,KNOWN_NO_MID,KNOWN_MID,MISSING_MID,MISSING_MID_ALLOWED]} + +*** Test Cases *** +MID - invalid Message-ID + Scan File ${RSPAMD_TESTDIR}/messages/fws_fp.eml + ... Settings=${SETTINGS_MID} + Expect Symbol With Score INVALID_MSGID 1.70 + Do Not Expect Symbol MISSING_MID + Do Not Expect Symbol INVALID_MSGID_ALLOWED + +MID - invalid Message-ID allowed + Scan File ${RSPAMD_TESTDIR}/messages/invalid_mid_allowed.eml + ... Settings=${SETTINGS_MID} + Expect Symbol With Score INVALID_MSGID_ALLOWED 0.00 + Do Not Expect Symbol MISSING_MID + Do Not Expect Symbol INVALID_MSGID + +MID - missing Message-ID + Scan File ${RSPAMD_TESTDIR}/messages/freemail.eml + ... Settings=${SETTINGS_MID} + Expect Symbol With Score MISSING_MID 2.50 + Do Not Expect Symbol MISSING_MID_ALLOWED + Do Not Expect Symbol INVALID_MSGID + +MID - missing Message-ID allowed + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml + ... Settings=${SETTINGS_MID} + Expect Symbol With Score MISSING_MID_ALLOWED 0.00 + Do Not Expect Symbol MISSING_MID + Do Not Expect Symbol INVALID_MSGID diff --git a/test/functional/cases/001_merged/114_phishing.robot b/test/functional/cases/001_merged/114_phishing.robot new file mode 100644 index 0000000..bc7f398 --- /dev/null +++ b/test/functional/cases/001_merged/114_phishing.robot @@ -0,0 +1,26 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE1} ${RSPAMD_TESTDIR}/messages/phishing1.eml +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/phishing2.eml +${MESSAGE3} ${RSPAMD_TESTDIR}/messages/phishing3.eml +${SETTINGS_PHISHING} {symbols_enabled = [PHISHING,STRICT_PHISHING,STRICTER_PHISHING]} + +*** Test Cases *** +TEST PHISHING + Scan File ${MESSAGE1} + ... Settings=${SETTINGS_PHISHING} + Expect Symbol PHISHING + +TEST PHISHING STRICT ONE + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_PHISHING} + Expect Symbol STRICT_PHISHING + +TEST PHISHING STRICT TWO + Scan File ${MESSAGE3} + ... Settings=${SETTINGS_PHISHING} + Expect Symbol STRICTER_PHISHING diff --git a/test/functional/cases/001_merged/115_dmarc.robot b/test/functional/cases/001_merged/115_dmarc.robot new file mode 100644 index 0000000..e5ed670 --- /dev/null +++ b/test/functional/cases/001_merged/115_dmarc.robot @@ -0,0 +1,101 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${DMARC_SETTINGS} {symbols_enabled = [DMARC_CHECK, DKIM_CHECK, SPF_CHECK]} + +*** Test Cases *** +DMARC NONE PASS DKIM + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pass_none.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC NONE PASS SPF + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml + ... IP=8.8.4.4 From=foo@spf.cacophony.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC NONE FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_none.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_SOFTFAIL + +DMARC REJECT FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_reject.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_REJECT + +DMARC QUARANTINE FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/fail_quarantine.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_QUARANTINE + +DMARC SP NONE FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_none.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_SOFTFAIL + +DMARC SP REJECT FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_reject.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_REJECT + +DMARC SP QUARANTINE FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/subdomain_fail_quarantine.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_QUARANTINE + +DMARC SUBDOMAIN FAIL DKIM STRICT ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_REJECT + +DMARC SUBDOMAIN PASS DKIM RELAXED ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC SUBDOMAIN PASS SPF STRICT ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml + ... IP=37.48.67.26 From=foo@yo.mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC SUBDOMAIN FAIL SPF STRICT ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail_alignment.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_REJECT + +DMARC SUBDOMAIN PASS SPF RELAXED ALIGNMENT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/onsubdomain_fail.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_ALLOW + +DMARC DNSFAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/dmarc_tmpfail.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_DNSFAIL + +DMARC NA NXDOMAIN + Scan File ${RSPAMD_TESTDIR}/messages/utf.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_NA + +DMARC PCT ZERO REJECT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pct_none.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_QUARANTINE + +DMARC PCT ZERO SP QUARANTINE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/pct_none1.eml + ... IP=37.48.67.26 From=foo@mom.za.org + ... Settings=${DMARC_SETTINGS} + Expect Symbol DMARC_POLICY_SOFTFAIL diff --git a/test/functional/cases/001_merged/117_spf.robot b/test/functional/cases/001_merged/117_spf.robot new file mode 100644 index 0000000..dda35f6 --- /dev/null +++ b/test/functional/cases/001_merged/117_spf.robot @@ -0,0 +1,157 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_SPF} {symbols_enabled = [SPF_CHECK]} + +*** Test Cases *** +SPF FAIL UNRESOLVEABLE INCLUDE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=37.48.67.26 From=x@fail3.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + +SPF DNSFAIL FAILED INCLUDE UNALIGNED + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail2.org.org.za + ... Settings={symbols_enabled = [SPF_CHECK,DKIM_CHECK,DMARC_CHECK]} + Expect Symbol R_SPF_DNSFAIL + Expect Symbol DMARC_POLICY_SOFTFAIL + +SPF ALLOW UNRESOLVEABLE INCLUDE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail3.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW + +SPF ALLOW FAILED INCLUDE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.4.4 From=x@fail2.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW + +SPF NA NA + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_NA + +SPF NA NOREC + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@co.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_NA + +SPF NA NXDOMAIN + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@zzzzaaaa + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_NA + +SPF PERMFAIL UNRESOLVEABLE REDIRECT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail4.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_PERMFAIL + +SPF REDIRECT NO USEABLE ELEMENTS + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail10.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_PERMFAIL + +SPF DNSFAIL FAILED REDIRECT + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail1.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF PERMFAIL NO USEABLE ELEMENTS + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail5.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_PERMFAIL + +SPF FAIL + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@example.net + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + +SPF FAIL UNRESOLVEABLE MX + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@fail6.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + +SPF FAIL UNRESOLVEABLE A + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@fail7.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + +SPF DNSFAIL FAILED A + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@fail8.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF DNSFAIL FAILED MX + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@fail9.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF DNSFAIL FAILED RECORD + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=1.2.3.4 From=x@www.dnssec-failed.org + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF PASS INCLUDE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@pass1.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW + +SPF PTRS + Scan File /dev/null + ... IP=88.99.142.95 From=foo@crazyspf.cacophony.za.org + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW + Scan File /dev/null + ... IP=128.66.0.1 From=foo@crazyspf.cacophony.za.org + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + Scan File /dev/null + ... IP=209.85.216.182 From=foo@crazyspf.cacophony.za.org + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_FAIL + #Scan File /dev/null + #... IP=98.138.91.166 From=foo@crazyspf.cacophony.za.org + #Expect Symbol R_SPF_ALLOW + #Scan File /dev/null + #... IP=98.138.91.167 From=foo@crazyspf.cacophony.za.org + #Expect Symbol R_SPF_ALLOW + #Scan File /dev/null + #... IP=98.138.91.168 From=foo@crazyspf.cacophony.za.org + #Expect Symbol R_SPF_ALLOW + +SPF PERMFAIL REDIRECT WITHOUT SPF + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim4.eml + ... IP=192.0.2.1 From=a@fail1.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_DNSFAIL + +SPF EXTERNAL RELAY + Scan File ${RSPAMD_TESTDIR}/messages/external_relay.eml + ... Settings=${SETTINGS_SPF} + Expect Symbol With Score And Exact Options R_SPF_ALLOW -0.2 +ip4:37.48.67.26 + +SPF UPPERCASE + Scan File ${RSPAMD_TESTDIR}/messages/dmarc/bad_dkim1.eml + ... IP=8.8.8.8 From=x@fail11.org.org.za + ... Settings=${SETTINGS_SPF} + Expect Symbol R_SPF_ALLOW diff --git a/test/functional/cases/001_merged/160_antivirus.robot b/test/functional/cases/001_merged/160_antivirus.robot new file mode 100644 index 0000000..0870ba6 --- /dev/null +++ b/test/functional/cases/001_merged/160_antivirus.robot @@ -0,0 +1,151 @@ +*** Settings *** +Suite Teardown Antivirus Teardown +Library Process +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/freemail.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_AVAST} {symbols_enabled = [AVAST_VIRUS]} +${SETTINGS_CLAM} {symbols_enabled = [CLAM_VIRUS]} +${SETTINGS_FPROT} {symbols_enabled = [FPROT_VIRUS, FPROT2_VIRUS_DUPLICATE_DEFAULT]} + +*** Test Cases *** +CLAMAV MISS + Run Dummy Clam ${RSPAMD_PORT_CLAM} + Scan File ${MESSAGE} + ... Settings=${SETTINGS_CLAM} + Do Not Expect Symbol CLAM_VIRUS + Shutdown clamav + +CLAMAV HIT + Run Dummy Clam ${RSPAMD_PORT_CLAM} 1 + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_CLAM} + Expect Symbol CLAM_VIRUS + Do Not Expect Symbol CLAMAV_VIRUS_FAIL + Shutdown clamav + +CLAMAV CACHE HIT + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_CLAM} + Expect Symbol CLAM_VIRUS + Do Not Expect Symbol CLAMAV_VIRUS_FAIL + +CLAMAV CACHE MISS + Scan File ${MESSAGE} + ... Settings=${SETTINGS_CLAM} + Do Not Expect Symbol CLAM_VIRUS + Do Not Expect Symbol CLAMAV_VIRUS_FAIL + +FPROT MISS + Run Dummy Fprot ${RSPAMD_PORT_FPROT} + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_FPROT} + Do Not Expect Symbol FPROT_VIRUS + Do Not Expect Symbol FPROT_EICAR + Shutdown fport + +FPROT HIT - PATTERN + Run Dummy Fprot ${RSPAMD_PORT_FPROT} 1 + Run Dummy Fprot ${RSPAMD_PORT_FPROT2_DUPLICATE} 1 /tmp/dummy_fprot_dupe.pid + Scan File ${MESSAGE} + ... Settings=${SETTINGS_FPROT} + Expect Symbol FPROT_EICAR + # Also check ordered pattern match + Expect Symbol FPROT2_VIRUS_DUPLICATE_PATTERN + Do Not Expect Symbol FPROT2_VIRUS_DUPLICATE_DEFAULT + Do Not Expect Symbol FPROT2_VIRUS_DUPLICATE_NOPE + Shutdown fport + Shutdown fport duplicate + +FPROT CACHE HIT + Scan File ${MESSAGE} + ... Settings=${SETTINGS_FPROT} + Expect Symbol FPROT_EICAR + Do Not Expect Symbol CLAMAV_VIRUS + # Also check ordered pattern match + Expect Symbol FPROT2_VIRUS_DUPLICATE_PATTERN + Do Not Expect Symbol FPROT2_VIRUS_DUPLICATE_DEFAULT + +FPROT CACHE MISS + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_FPROT} + Do Not Expect Symbol FPROT_VIRUS + +AVAST MISS + Run Dummy Avast ${RSPAMD_PORT_AVAST} + Scan File ${MESSAGE} + ... Settings=${SETTINGS_AVAST} + Do Not Expect Symbol AVAST_VIRUS + Shutdown avast + +AVAST HIT + Run Dummy Avast ${RSPAMD_PORT_AVAST} 1 + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_AVAST} + Expect Symbol AVAST_VIRUS + Do Not Expect Symbol AVAST_VIRUS_FAIL + Shutdown avast + +AVAST CACHE HIT + Scan File ${MESSAGE2} + ... Settings=${SETTINGS_AVAST} + Expect Symbol AVAST_VIRUS + Do Not Expect Symbol AVAST_VIRUS_FAIL + +AVAST CACHE MISS + Scan File ${MESSAGE} + ... Settings=${SETTINGS_AVAST} + Do Not Expect Symbol AVAST_VIRUS + Do Not Expect Symbol AVAST_VIRUS_FAIL + +*** Keywords *** +Antivirus Teardown + Shutdown clamav + Shutdown fport + Shutdown avast + +Shutdown clamav + ${clamav_pid} = Get File if exists /tmp/dummy_clamav.pid + Run Keyword if ${clamav_pid} Shutdown Process With Children ${clamav_pid} + +Shutdown fport + ${fport_pid} = Get File if exists /tmp/dummy_fprot.pid + Run Keyword if ${fport_pid} Shutdown Process With Children ${fport_pid} + +Shutdown fport duplicate + ${fport_pid} = Get File if exists /tmp/dummy_fprot_dupe.pid + Run Keyword if ${fport_pid} Shutdown Process With Children ${fport_pid} + +Shutdown avast + ${avast_pid} = Get File if exists /tmp/dummy_avast.pid + Run Keyword if ${avast_pid} Shutdown Process With Children ${avast_pid} + +Run Dummy + [Arguments] @{varargs} + ${process} = Start Process @{varargs} + ${pid} = Get From List ${varargs} -1 + ${pass} = Run Keyword And Return Status Wait Until Created ${pid} + IF ${pass} + Return From Keyword + END + Wait For Process ${process} + ${res} = Get Process Result ${process} + Log To Console ${res.stdout} + Log To Console ${res.stderr} + Fail Dummy server failed to start + +Run Dummy Clam + [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_clamav.pid + Run Dummy ${RSPAMD_TESTDIR}/util/dummy_clam.py ${port} ${found} ${pid} + +Run Dummy Fprot + [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_fprot.pid + Run Dummy ${RSPAMD_TESTDIR}/util/dummy_fprot.py ${port} ${found} ${pid} + +Run Dummy Avast + [Arguments] ${port} ${found}= ${pid}=/tmp/dummy_avast.pid + Run Dummy ${RSPAMD_TESTDIR}/util/dummy_avast.py ${port} ${found} ${pid} diff --git a/test/functional/cases/001_merged/240_redis.robot b/test/functional/cases/001_merged/240_redis.robot new file mode 100644 index 0000000..3196dd0 --- /dev/null +++ b/test/functional/cases/001_merged/240_redis.robot @@ -0,0 +1,16 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_REDIS} {symbols_enabled = [REDIS_TEST, SIMPLE_REDIS_ASYNC_TEST, SIMPLE_REDIS_ASYNC201809_TEST]} + +*** Test Cases *** +Redis client + Redis SET test_key test value + Scan File ${MESSAGE} + Expect Symbol With Exact Options REDIS hello from lua on redis + Expect Symbol With Exact Options REDIS_ASYNC test value + Expect Symbol With Exact Options REDIS_ASYNC201809 test value diff --git a/test/functional/cases/001_merged/250_dns.robot b/test/functional/cases/001_merged/250_dns.robot new file mode 100644 index 0000000..d3e64cd --- /dev/null +++ b/test/functional/cases/001_merged/250_dns.robot @@ -0,0 +1,21 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_DNS} {symbols_enabled = [SIMPLE_DNS, SIMPLE_DNS_SYNC]} + +*** Test Cases *** +Simple DNS request + Scan File ${MESSAGE} To-Resolve=example.com + ... Settings=${SETTINGS_DNS} + Expect Symbol With Exact Options DNS_SYNC 93.184.216.34 + Expect Symbol With Exact Options DNS 93.184.216.34 + +Faulty DNS request + Scan File ${MESSAGE} To-Resolve=not-resolvable.com + ... Settings=${SETTINGS_DNS} + Expect Symbol With Exact Options DNS_SYNC_ERROR requested record is not found + Expect Symbol With Exact Options DNS_ERROR requested record is not found diff --git a/test/functional/cases/001_merged/270_selector.robot b/test/functional/cases/001_merged/270_selector.robot new file mode 100644 index 0000000..fa3ab87 --- /dev/null +++ b/test/functional/cases/001_merged/270_selector.robot @@ -0,0 +1,19 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/subject1.eml + +*** Test Cases *** +Newlines + Scan File ${MESSAGE} User=test@user.com Pass=all + ... Settings={symbols_enabled = [CONFIG_SELECTOR_RE_RCPT_SUBJECT, LUA_SELECTOR_RE]} + Expect Symbol CONFIG_SELECTOR_RE_RCPT_SUBJECT + Expect Symbol LUA_SELECTOR_RE + +Rspamd_text selector + Scan File ${MESSAGE} + ... Settings={symbols_enabled = [RSPAMD_TEXT_SELECTOR]} + Expect Symbol RSPAMD_TEXT_SELECTOR diff --git a/test/functional/cases/001_merged/280_rules.robot b/test/functional/cases/001_merged/280_rules.robot new file mode 100644 index 0000000..b7cbe81 --- /dev/null +++ b/test/functional/cases/001_merged/280_rules.robot @@ -0,0 +1,139 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE1} ${RSPAMD_TESTDIR}/messages/fws_fn.eml +${MESSAGE2} ${RSPAMD_TESTDIR}/messages/fws_fp.eml +${MESSAGE3} ${RSPAMD_TESTDIR}/messages/fws_tp.eml +${MESSAGE4} ${RSPAMD_TESTDIR}/messages/broken_richtext.eml +${MESSAGE5} ${RSPAMD_TESTDIR}/messages/badboundary.eml +${MESSAGE6} ${RSPAMD_TESTDIR}/messages/pdf_encrypted.eml +${MESSAGE7} ${RSPAMD_TESTDIR}/messages/pdf_js.eml +${MESSAGE8} ${RSPAMD_TESTDIR}/messages/yand_forward.eml +${MESSAGE} ${RSPAMD_TESTDIR}/messages/newlines.eml + +*** Test Cases *** +Broken MIME + Scan File ${MESSAGE3} Settings={symbols_enabled = [MISSING_SUBJECT]} + Expect Symbol MISSING_SUBJECT + +Issue 2584 + Scan File ${MESSAGE1} + ... Settings={symbols_enabled = [BROKEN_CONTENT_TYPE, MISSING_SUBJECT, R_MISSING_CHARSET]} + Do Not Expect Symbol BROKEN_CONTENT_TYPE + Do Not Expect Symbol MISSING_SUBJECT + Do Not Expect Symbol R_MISSING_CHARSET + +Issue 2349 + Scan File ${MESSAGE2} + ... Settings={symbols_enabled = [MULTIPLE_UNIQUE_HEADERS]} + Do Not Expect Symbol MULTIPLE_UNIQUE_HEADERS + +Broken Rich Text + Scan File ${MESSAGE4} + ... Settings={symbols_enabled = [BROKEN_CONTENT_TYPE]} + Expect Symbol BROKEN_CONTENT_TYPE + +Broken boundary + Scan File ${MESSAGE4} + ... Settings={symbols_enabled = [BROKEN_CONTENT_TYPE]} + Expect Symbol BROKEN_CONTENT_TYPE + +PDF encrypted + Scan File ${MESSAGE6} + ... Settings={symbols_enabled = [PDF_ENCRYPTED]} + Expect Symbol PDF_ENCRYPTED + +PDF javascript + Scan File ${MESSAGE7} + ... Settings={symbols_enabled = [PDF_JAVASCRIPT]} + Expect Symbol PDF_JAVASCRIPT + +BITCOIN ADDR + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml + ... Settings={symbols_enabled = [BITCOIN_ADDR]} + Expect Symbol BITCOIN_ADDR + +BITCOIN ADDR 2 + Scan File ${RSPAMD_TESTDIR}/messages/btc2.eml + ... Settings={symbols_enabled = [BITCOIN_ADDR]} + Expect Symbol BITCOIN_ADDR + +BITCOIN ADDR 3 + Scan File ${RSPAMD_TESTDIR}/messages/btc3.eml + ... Settings={symbols_enabled = [BITCOIN_ADDR]} + Expect Symbol BITCOIN_ADDR + +BITCOIN ADDR 4 + Scan File ${RSPAMD_TESTDIR}/messages/btc4.eml + ... Settings={symbols_enabled = [BITCOIN_ADDR]} + Expect Symbol With Exact Options BITCOIN_ADDR 1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2 + ... bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq bitcoincash:qztslqhavnjcgth9zwu6dw0jjcfy4zahfy7vf0smwp + +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_1 + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender.eml + ... Settings={symbols_enabled = [MULTIPLE_FROM]} + Expect Symbol With Score And Exact Options MULTIPLE_FROM 8.0 <any@attack.com> <admin@legitimate.com> + +PHISH_SENDER_A_2 + Scan File ${RSPAMD_TESTDIR}/messages/phish_sender.eml + ... Settings={symbols_enabled = [MULTIPLE_UNIQUE_HEADERS]} + 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 + +SUBJECT_HAS_CURRENCY + Scan File ${RSPAMD_TESTDIR}/messages/currency.eml + ... Settings={symbols_enabled = [SUBJECT_HAS_CURRENCY]} + Expect Symbol SUBJECT_HAS_CURRENCY diff --git a/test/functional/cases/001_merged/281_fnames.robot b/test/functional/cases/001_merged/281_fnames.robot new file mode 100644 index 0000000..bb600b1 --- /dev/null +++ b/test/functional/cases/001_merged/281_fnames.robot @@ -0,0 +1,13 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_FNAME} {symbols_enabled = [TEST_FNAME]} + +*** Test Cases *** +FILE NAMES + Scan File ${RSPAMD_TESTDIR}/messages/fname.eml Settings=${SETTINGS_FNAME} + Expect Symbol With Option TEST_FNAME [삼성생명]2020.08.14 데일리 경제뉴스.pdf + Expect Symbol With Option TEST_FNAME 01029_402110_10620_RGT06902_PRT180ML_20200803_101820.pdf diff --git a/test/functional/cases/001_merged/290_greylist.robot b/test/functional/cases/001_merged/290_greylist.robot new file mode 100644 index 0000000..05ce3d3 --- /dev/null +++ b/test/functional/cases/001_merged/290_greylist.robot @@ -0,0 +1,25 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_GREYLIST} {symbols_enabled = [GREYLIST_CHECK, GREYLIST_SAVE], symbols = [FOUR_POINTS]} + +*** Test Cases *** +GREYLIST NEW + Scan File ${MESSAGE} + ... Settings=${SETTINGS_GREYLIST} + Expect Symbol With Option GREYLIST greylisted + +GREYLIST EARLY + Scan File ${MESSAGE} + ... Settings=${SETTINGS_GREYLIST} + Expect Symbol With Option GREYLIST greylisted + +GREYLIST PASS + Sleep 4s Wait greylisting timeout + Scan File ${MESSAGE} + ... Settings=${SETTINGS_GREYLIST} + Expect Symbol With Option GREYLIST pass diff --git a/test/functional/cases/001_merged/300_rbl.robot b/test/functional/cases/001_merged/300_rbl.robot new file mode 100644 index 0000000..8b19fae --- /dev/null +++ b/test/functional/cases/001_merged/300_rbl.robot @@ -0,0 +1,98 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml + +*** Test Cases *** +RBL FROM MISS + Scan File ${MESSAGE} IP=1.2.3.4 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN_CHECK]} + Do Not Expect Symbol FAKE_RBL_CODE_2 + +RBL FROM HIT + Scan File ${MESSAGE} IP=4.3.2.1 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN_CHECK]} + Expect Symbol FAKE_RBL_CODE_2 + +RBL FROM MULTIPLE HIT + Scan File ${MESSAGE} IP=4.3.2.3 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN_CHECK]} + Expect Symbol FAKE_RBL_CODE_2 + Expect Symbol FAKE_RBL_CODE_3 + +RBL FROM UNKNOWN HIT + Scan File ${MESSAGE} IP=4.3.2.2 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN_CHECK]} + Expect Symbol FAKE_RBL_FAKE_RBL_UNKNOWN + +RBL RECEIVED HIT + Scan File ${MESSAGE} IP=8.8.8.8 + ... Settings={symbols_enabled = [FAKE_RECEIVED_RBL_FAKE_RBL_UNKNOWN]} + Expect Symbol FAKE_RECEIVED_RBL_CODE_3 + +RBL FROM HIT WL + Scan File ${MESSAGE} IP=4.3.2.4 + ... Settings={symbols_enabled = [FAKE_RBL_UNKNOWN, FAKE_WL_RBL_UNKNOWN]} + Do Not Expect Symbol FAKE_RBL_CODE_2 + Expect Symbol With Exact Options FAKE_WL_RBL_CODE_2 4.3.2.4:from + +EMAILBL Compose Map 1 + Scan File ${RSPAMD_TESTDIR}/messages/url14.eml + ... Settings={symbols_enabled = [RSPAMD_EMAILBL]} + Expect Symbol With Exact Options RSPAMD_EMAILBL dirty.sanchez.com:email + +EMAILBL Compose Map 2 + Scan File ${RSPAMD_TESTDIR}/messages/url15.eml + ... Settings={symbols_enabled = [RSPAMD_EMAILBL]} + Expect Symbol With Exact Options RSPAMD_EMAILBL very.dirty.sanchez.com:email + +EMAILBL Compose Map 3 + Scan File ${RSPAMD_TESTDIR}/messages/url16.eml + ... Settings={symbols_enabled = [RSPAMD_EMAILBL]} + Expect Symbol With Exact Options RSPAMD_EMAILBL 41.black.sanchez.com:email + +CONTENT URLS + Scan File ${RSPAMD_TESTDIR}/messages/content_url.eml + ... Settings={symbols_enabled = [URIBL_CONTENTONLY, URIBL_NOCONTENT, URIBL_WITHCONTENT]} + Expect Symbol With Exact Options URIBL_NOCONTENT example.org:url + Expect Symbol With Option URIBL_WITHCONTENT example.com:url + Expect Symbol With Option URIBL_WITHCONTENT example.org:url + Expect Symbol With Option URIBL_WITHCONTENT 8.8.8.8:url + Expect Symbol With Exact Options URIBL_CONTENTONLY example.com:url + +SELECTORS + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml From=user@example.com Helo=example.org + ... Settings={symbols_enabled = [RBL_SELECTOR_SINGLE, RBL_SELECTOR_MULTIPLE]} + Expect Symbol With Exact Options RBL_SELECTOR_SINGLE example.org:selector + Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.com:sel_from + Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_helo + +SELECTORS COMBINED + Scan File ${RSPAMD_TESTDIR}/messages/btc.eml From=user@example.org Helo=example.org + ... Settings={symbols_enabled = [RBL_SELECTOR_MULTIPLE]} + Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_from + Expect Symbol With Option RBL_SELECTOR_MULTIPLE example.org:sel_helo + +NUMERIC URLS + Scan File ${RSPAMD_TESTDIR}/messages/numeric_urls.eml + ... Settings={symbols_enabled = [URIBL_NUMERIC]} + Expect Symbol With Exact Options URIBL_NUMERIC 4.3.2.1:url + +NUMERIC URLS WITH IMAGES + Scan File ${RSPAMD_TESTDIR}/messages/numeric_urls.eml + ... Settings={symbols_enabled = [URIBL_NUMERIC_IMAGES]} + Expect Symbol With Exact Options URIBL_NUMERIC_IMAGES 4.3.2.1:url 12.11.10.9:url + +NUMERIC URLS WITH CONTENT + Scan File ${RSPAMD_TESTDIR}/messages/numeric_urls.eml + ... Settings={symbols_enabled = [URIBL_NUMERIC_CONTENT]} + Expect Symbol With Exact Options URIBL_NUMERIC_CONTENT 4.3.2.1:url 8.7.6.5:url + +NUMERIC URLS WITH EVERYTHING + Scan File ${RSPAMD_TESTDIR}/messages/numeric_urls.eml + ... IP=127.0.0.1 + ... Settings={symbols_enabled = [URIBL_NUMERIC_EVERYTHING]} + Expect Symbol With Exact Options URIBL_NUMERIC_EVERYTHING 12.11.10.9:url 4.3.2.1:url 8.7.6.5:url diff --git a/test/functional/cases/001_merged/310_udp.robot b/test/functional/cases/001_merged/310_udp.robot new file mode 100644 index 0000000..e94ed60 --- /dev/null +++ b/test/functional/cases/001_merged/310_udp.robot @@ -0,0 +1,40 @@ +*** Settings *** +Test Setup UDP Setup +Test Teardown UDP Teardown +Library Process +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml +${SETTINGS_UDP} {symbols_enabled = [UDP_FAIL,UDP_SENDTO,UDP_SUCCESS]} + +*** Test Cases *** +Simple UDP request + Scan File ${MESSAGE} + ... Settings=${SETTINGS_UDP} + Expect Symbol With Exact Options UDP_SUCCESS helloworld + +Sendonly UDP request + Scan File ${MESSAGE} + ... Settings=${SETTINGS_UDP} + Expect Symbol UDP_SENDTO + +Errored UDP request + Scan File ${MESSAGE} + ... Settings=${SETTINGS_UDP} + Expect Symbol With Exact Options UDP_FAIL read timeout + +*** Keywords *** +UDP Setup + Run Dummy UDP + +UDP Teardown + ${udp_pid} = Get File /tmp/dummy_udp.pid + Shutdown Process With Children ${udp_pid} + +Run Dummy UDP + [Arguments] + ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_udp.py 5005 + Wait Until Created /tmp/dummy_udp.pid diff --git a/test/functional/cases/001_merged/321_arc_check.robot b/test/functional/cases/001_merged/321_arc_check.robot new file mode 100644 index 0000000..3f6488b --- /dev/null +++ b/test/functional/cases/001_merged/321_arc_check.robot @@ -0,0 +1,19 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_ARC} {symbols_enabled = [ARC_CALLBACK]} + +*** Test Cases *** +ARC ALLOW CHECK + Scan File ${RSPAMD_TESTDIR}/messages/arcallow.eml + ... Settings=${SETTINGS_ARC} + Expect Symbol ARC_ALLOW + +ARC BAD CHECK + Scan File ${RSPAMD_TESTDIR}/messages/arcbad.eml + ... Settings=${SETTINGS_ARC} + Expect Symbol ARC_INVALID + diff --git a/test/functional/cases/001_merged/340_surbl.robot b/test/functional/cases/001_merged/340_surbl.robot new file mode 100644 index 0000000..a1d0736 --- /dev/null +++ b/test/functional/cases/001_merged/340_surbl.robot @@ -0,0 +1,182 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_SURBL} {groups_enabled = [rbl]} + +*** Test Cases *** +SURBL resolve ip + Scan File ${RSPAMD_TESTDIR}/messages/url7.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options URIBL_SBL_CSS 8.8.8.9:example.ru:url + Expect Symbol With Exact Options URIBL_XBL 8.8.8.8:example.ru:url + Expect Symbol With Exact Options URIBL_PBL 8.8.8.8:example.ru:url + +SURBL Example.com domain + Scan File ${RSPAMD_TESTDIR}/messages/url4.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options RSPAMD_URIBL example.com:url + Expect Symbol With Exact Options DBL_SPAM example.com:url + Expect Symbol With Exact Options DBL_PHISH rspamd.tk:url + Do Not Expect Symbol URIBL_BLACK + +SURBL Example.net domain + Scan File ${RSPAMD_TESTDIR}/messages/url5.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol DBL_PHISH + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol URIBL_BLACK + +SURBL Example.org domain + Scan File ${RSPAMD_TESTDIR}/messages/url6.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol URIBL_BLACK + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_PHISH + +SURBL Example.ru domain + Scan File ${RSPAMD_TESTDIR}/messages/url7.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol URIBL_GREY + Expect Symbol URIBL_RED + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL Example.ru ZEN domain + Scan File ${RSPAMD_TESTDIR}/messages/url7.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol URIBL_SBL_CSS + Expect Symbol URIBL_XBL + Expect Symbol URIBL_PBL + Do Not Expect Symbol URIBL_SBL + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL Example.com domain image false + Scan File ${RSPAMD_TESTDIR}/messages/urlimage.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL_IMAGES + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL @example.com mail html + Scan File ${RSPAMD_TESTDIR}/messages/mailadr.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol With Exact Options DBL_SPAM example.com:email + Do Not Expect Symbol RSPAMD_URIBL_IMAGES + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL @example.com mail text + Scan File ${RSPAMD_TESTDIR}/messages/mailadr2.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol With Exact Options DBL_SPAM example.com:email + Do Not Expect Symbol RSPAMD_URIBL_IMAGES + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL example.com not encoded url in subject + Scan File ${RSPAMD_TESTDIR}/messages/urlinsubject.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol DBL_SPAM + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL example.com encoded url in subject + Scan File ${RSPAMD_TESTDIR}/messages/urlinsubjectencoded.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol DBL_SPAM + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +WHITELIST + Scan File ${RSPAMD_TESTDIR}/messages/whitelist.eml + ... Settings=${SETTINGS_SURBL} + Do Not Expect Symbol RSPAMD_URIBL + Do Not Expect Symbol DBL_SPAM + Do Not Expect Symbol RSPAMD_URIBL_IMAGES + +EMAILBL full address & domain only + Scan File ${RSPAMD_TESTDIR}/messages/emailbltext.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_FULL + Expect Symbol RSPAMD_EMAILBL_DOMAINONLY + +EMAILBL full subdomain address + Scan File ${RSPAMD_TESTDIR}/messages/emailbltext2.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_FULL + +EMAILBL full subdomain address & domain only + Scan File ${RSPAMD_TESTDIR}/messages/emailbltext3.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options RSPAMD_EMAILBL_DOMAINONLY baddomain.com:email + Expect Symbol With Exact Options RSPAMD_EMAILBL_FULL user.subdomain.baddomain.com:email + +EMAILBL REPLY TO full address + Scan File ${RSPAMD_TESTDIR}/messages/replyto.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_FULL + Do Not Expect Symbol RSPAMD_EMAILBL_DOMAINONLY + +EMAILBL REPLY TO domain only + Scan File ${RSPAMD_TESTDIR}/messages/replyto2.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_DOMAINONLY + Do Not Expect Symbol RSPAMD_EMAILBL_FULL + +EMAILBL REPLY TO full subdomain address + Scan File ${RSPAMD_TESTDIR}/messages/replytosubdomain.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_EMAILBL_FULL + Do Not Expect Symbol RSPAMD_EMAILBL_DOMAINONLY + +SURBL IDN domain + Scan File ${RSPAMD_TESTDIR}/messages/url8.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol DBL_SPAM + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL IDN Punycode domain + Scan File ${RSPAMD_TESTDIR}/messages/url9.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + Expect Symbol DBL_SPAM + Do Not Expect Symbol DBL_PHISH + Do Not Expect Symbol URIBL_BLACK + +SURBL html entity­ + Scan File ${RSPAMD_TESTDIR}/messages/url10.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol RSPAMD_URIBL + +SURBL url compose map 1 + Scan File ${RSPAMD_TESTDIR}/messages/url11.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options BAD_SUBDOMAIN clean.dirty.sanchez.com:url + +SURBL url compose map 2 + Scan File ${RSPAMD_TESTDIR}/messages/url12.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options BAD_SUBDOMAIN 4.very.dirty.sanchez.com:url + +SURBL url compose map 3 + Scan File ${RSPAMD_TESTDIR}/messages/url13.eml + ... Settings=${SETTINGS_SURBL} + Expect Symbol With Exact Options BAD_SUBDOMAIN 41.black.sanchez.com:url diff --git a/test/functional/cases/001_merged/350_magic.robot b/test/functional/cases/001_merged/350_magic.robot new file mode 100644 index 0000000..66a18f2 --- /dev/null +++ b/test/functional/cases/001_merged/350_magic.robot @@ -0,0 +1,67 @@ +*** Settings *** +Library ${RSPAMD_TESTDIR}/lib/rspamd.py +Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot +Variables ${RSPAMD_TESTDIR}/lib/vars.py + +*** Variables *** +${SETTINGS_MAGIC} {symbols_enabled = [MAGIC_SYM]} + +*** Test Cases *** +Magic detections bundle 1 + Scan File ${RSPAMD_TESTDIR}/messages/gargantua.eml Settings=${SETTINGS_MAGIC} + Expect Symbols MAGIC_SYM_ZIP_2 + ... MAGIC_SYM_RAR_3 + ... MAGIC_SYM_EXE_4 + ... MAGIC_SYM_ELF_5 + ... MAGIC_SYM_LNK_6 + ... MAGIC_SYM_CLASS_7 + ... MAGIC_SYM_RTF_8 + ... MAGIC_SYM_PDF_9 + ... MAGIC_SYM_PS_10 + ... MAGIC_SYM_CHM_11 + ... MAGIC_SYM_DJVU_12 + ... MAGIC_SYM_ARJ_13 + ... MAGIC_SYM_CAB_14 + ... MAGIC_SYM_ACE_15 + ... MAGIC_SYM_TAR_16 + ... MAGIC_SYM_BZ2_17 + ... MAGIC_SYM_XZ_18 + ... MAGIC_SYM_LZ4_19 + ... MAGIC_SYM_ZST_20 + ... MAGIC_SYM_DMG_21 + ... MAGIC_SYM_ISO_22 + ... MAGIC_SYM_ZOO_23 + ... MAGIC_SYM_EPUB_24 + ... MAGIC_SYM_XAR_25 + ... MAGIC_SYM_PSD_26 + ... MAGIC_SYM_PCX_27 + ... MAGIC_SYM_TIFF_28 + ... MAGIC_SYM_ICO_29 + ... MAGIC_SYM_SWF_30 + ... MAGIC_SYM_DOC_31 + ... MAGIC_SYM_XLS_32 + ... MAGIC_SYM_PPT_33 + ... MAGIC_SYM_MSI_34 + ... MAGIC_SYM_MSG_35 + ... MAGIC_SYM_DOCX_36 + ... MAGIC_SYM_XLSX_37 + ... MAGIC_SYM_PPTX_38 + ... MAGIC_SYM_ODT_39 + ... MAGIC_SYM_ODS_40 + ... MAGIC_SYM_ODP_41 + ... MAGIC_SYM_7Z_42 + ... MAGIC_SYM_VSD_43 + ... MAGIC_SYM_PNG_44 + ... MAGIC_SYM_JPG_45 + ... MAGIC_SYM_GIF_46 + ... MAGIC_SYM_BMP_47 + ... MAGIC_SYM_TXT_48 + ... MAGIC_SYM_HTML_49 + ... MAGIC_SYM_CSV_50 + ... MAGIC_SYM_DWG_51 + ... MAGIC_SYM_JAR_52 + ... MAGIC_SYM_APK_53 + ... MAGIC_SYM_BAT_54 + ... MAGIC_SYM_ICS_55 + ... MAGIC_SYM_VCF_56 + ... MAGIC_SYM_CSV_57 diff --git a/test/functional/cases/001_merged/__init__.robot b/test/functional/cases/001_merged/__init__.robot new file mode 100644 index 0000000..7ac640d --- /dev/null +++ b/test/functional/cases/001_merged/__init__.robot @@ -0,0 +1,28 @@ +*** Settings *** +Suite Setup Multi 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_EXTERNAL_RELAY_ENABLED} false +${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 + +*** Keywords *** +Multi Setup + Run Redis + Run Dummy Http + Run Dummy Https + Rspamd Setup + +Multi Teardown + Rspamd Teardown + Dummy Http Teardown + Dummy Https Teardown + Redis Teardown
\ No newline at end of file |