+++ /dev/null
-*** Settings ***
-Suite Setup Generic Setup
-Suite Teardown Generic Teardown
-Library ${TESTDIR}/lib/rspamd.py
-Resource ${TESTDIR}/lib/rspamd.robot
-Variables ${TESTDIR}/lib/vars.py
-
-*** Variables ***
-${CONFIG} ${TESTDIR}/configs/maps.conf
-${MESSAGE} ${TESTDIR}/messages/spam_message.eml
-${UTF_MESSAGE} ${TESTDIR}/messages/utf.eml
-${RSPAMD_SCOPE} Suite
-
-*** Test Cases ***
-MAP - DNSBL HIT
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.2
- Check Rspamc ${result} DNSBL_MAP
-
-MAP - DNSBL MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.1
- Check Rspamc ${result} DNSBL_MAP inverse=1 rc_noinverse=1
-
-MAP - IP HIT
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.1
- Check Rspamc ${result} IP_MAP
-
-MAP - IP MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.2
- Check Rspamc ${result} IP_MAP inverse=1 rc_noinverse=1
-
-MAP - IP MASK
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 10.1.0.10
- Check Rspamc ${result} IP_MAP
-
-MAP - IP MASK MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 11.1.0.10
- Check Rspamc ${result} IP_MAP inverse=1 rc_noinverse=1
-
-MAP - IP V6
- ${result} = Scan Message With Rspamc ${MESSAGE} -i ::1
- Check Rspamc ${result} IP_MAP
-
-MAP - IP V6 MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i fe80::1
- Check Rspamc ${result} IP_MAP inverse=1 rc_noinverse=1
-
-MAP - FROM
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user@example.com
- Check Rspamc ${result} FROM_MAP
-
-MAP - FROM MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user@other.com
- Check Rspamc ${result} FROM_MAP inverse=1 rc_noinverse=1
-
-MAP - FROM REGEXP
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user123@test.com
- Check Rspamc ${result} REGEXP_MAP
- ${result} = Scan Message With Rspamc ${MESSAGE} --from somebody@exAmplE.com
- Check Rspamc ${result} REGEXP_MAP
-
-MAP - FROM REGEXP MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user@other.org
- Check Rspamc ${result} REGEXP_MAP inverse=1 rc_noinverse=1
-
-MAP - DEPENDS HIT
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 147.243.1.47 --from user123@microsoft.com
- Check Rspamc ${result} DEPS_MAP
-
-MAP - DEPENDS MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.1 --from user123@microsoft.com
- Check Rspamc ${result} DEPS_MAP inverse=1 rc_noinverse=1
-
-MAP - MULSYM PLAIN
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user1@example.com
- Check Rspamc ${result} RCPT_MAP
-
-MAP - MULSYM SCORE
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user2@example.com
- Check Rspamc ${result} RCPT_MAP (10.0
-
-MAP - MULSYM SYMBOL
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user3@example.com
- Check Rspamc ${result} SYM1 (1.0
-
-MAP - MULSYM SYMBOL MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user4@example.com
- Check Rspamc ${result} RCPT_MAP (1.0
-
-MAP - MULSYM SYMBOL + SCORE
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user5@example.com
- Check Rspamc ${result} SYM1 (-10.0
-
-MAP - UTF
- ${result} = Scan Message With Rspamc ${UTF_MESSAGE}
- Check Rspamc ${result} HEADER_MAP
-
-MAP - UTF MISS
- ${result} = Scan Message With Rspamc ${MESSAGE}
- Check Rspamc ${result} HEADER_MAP inverse=1 rc_noinverse=1
-
-MAP - HOSTNAME
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname example.com
- Check Rspamc ${result} HOSTNAME_MAP
-
-MAP - HOSTNAME MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname rspamd.com
- Check Rspamc ${result} HOSTNAME_MAP inverse=1 rc_noinverse=1
-
-MAP - CDB - HOSTNAME
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname example.com
- Check Rspamc ${result} HOSTNAME_MAP
-
-MAP - CDB - HOSTNAME MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname rspamd.com
- Check Rspamc ${result} HOSTNAME_MAP inverse=1 rc_noinverse=1
--- /dev/null
+*** Settings ***
+Suite Setup Multimap Setup
+Suite Teardown Generic Teardown
+Library ${TESTDIR}/lib/rspamd.py
+Resource ${TESTDIR}/lib/rspamd.robot
+Variables ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${CONFIG} ${TESTDIR}/configs/plugins.conf
+${MESSAGE} ${TESTDIR}/messages/spam_message.eml
+${UTF_MESSAGE} ${TESTDIR}/messages/utf.eml
+${RSPAMD_SCOPE} Suite
+
+*** Test Cases ***
+MAP - DNSBL HIT
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.2
+ Check Rspamc ${result} DNSBL_MAP
+
+MAP - DNSBL MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.1
+ Check Rspamc ${result} DNSBL_MAP inverse=1 rc_noinverse=1
+
+MAP - IP HIT
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.1
+ Check Rspamc ${result} IP_MAP
+
+MAP - IP MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.2
+ Check Rspamc ${result} IP_MAP inverse=1 rc_noinverse=1
+
+MAP - IP MASK
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i 10.1.0.10
+ Check Rspamc ${result} IP_MAP
+
+MAP - IP MASK MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i 11.1.0.10
+ Check Rspamc ${result} IP_MAP inverse=1 rc_noinverse=1
+
+MAP - IP V6
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i ::1
+ Check Rspamc ${result} IP_MAP
+
+MAP - IP V6 MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i fe80::1
+ Check Rspamc ${result} IP_MAP inverse=1 rc_noinverse=1
+
+MAP - FROM
+ ${result} = Scan Message With Rspamc ${MESSAGE} --from user@example.com
+ Check Rspamc ${result} FROM_MAP
+
+MAP - FROM MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} --from user@other.com
+ Check Rspamc ${result} FROM_MAP inverse=1 rc_noinverse=1
+
+MAP - FROM REGEXP
+ ${result} = Scan Message With Rspamc ${MESSAGE} --from user123@test.com
+ Check Rspamc ${result} REGEXP_MAP
+ ${result} = Scan Message With Rspamc ${MESSAGE} --from somebody@exAmplE.com
+ Check Rspamc ${result} REGEXP_MAP
+
+MAP - FROM REGEXP MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} --from user@other.org
+ Check Rspamc ${result} REGEXP_MAP inverse=1 rc_noinverse=1
+
+MAP - DEPENDS HIT
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i 147.243.1.47 --from user123@microsoft.com
+ Check Rspamc ${result} DEPS_MAP
+
+MAP - DEPENDS MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.1 --from user123@microsoft.com
+ Check Rspamc ${result} DEPS_MAP inverse=1 rc_noinverse=1
+
+MAP - MULSYM PLAIN
+ ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user1@example.com
+ Check Rspamc ${result} RCPT_MAP
+
+MAP - MULSYM SCORE
+ ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user2@example.com
+ Check Rspamc ${result} RCPT_MAP (10.0
+
+MAP - MULSYM SYMBOL
+ ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user3@example.com
+ Check Rspamc ${result} SYM1 (1.0
+
+MAP - MULSYM SYMBOL MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user4@example.com
+ Check Rspamc ${result} RCPT_MAP (1.0
+
+MAP - MULSYM SYMBOL + SCORE
+ ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user5@example.com
+ Check Rspamc ${result} SYM1 (-10.0
+
+MAP - UTF
+ ${result} = Scan Message With Rspamc ${UTF_MESSAGE}
+ Check Rspamc ${result} HEADER_MAP
+
+MAP - UTF MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} HEADER_MAP inverse=1 rc_noinverse=1
+
+MAP - HOSTNAME
+ ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname example.com
+ Check Rspamc ${result} HOSTNAME_MAP
+
+MAP - HOSTNAME MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname rspamd.com
+ Check Rspamc ${result} HOSTNAME_MAP inverse=1 rc_noinverse=1
+
+MAP - CDB - HOSTNAME
+ ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname example.com
+ Check Rspamc ${result} HOSTNAME_MAP
+
+MAP - CDB - HOSTNAME MISS
+ ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname rspamd.com
+ Check Rspamc ${result} HOSTNAME_MAP inverse=1 rc_noinverse=1
+
+*** Keywords ***
+Multimap Setup
+ ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/multimap.conf
+ Set Suite Variable ${PLUGIN_CONFIG}
+ Generic Setup PLUGIN_CONFIG
+++ /dev/null
-*** Settings ***
-Suite Setup Generic Setup
-Suite Teardown Generic Teardown
-Library ${TESTDIR}/lib/rspamd.py
-Resource ${TESTDIR}/lib/rspamd.robot
-Variables ${TESTDIR}/lib/vars.py
-
-*** Variables ***
-${CONFIG} ${TESTDIR}/configs/plugins.conf
-${RSPAMD_SCOPE} Suite
-
-*** Test Cases ***
-Zip
- ${result} = Scan Message With Rspamc ${TESTDIR}/messages/zip.eml
- Check Rspamc ${result} MIME_BAD_EXTENSION \\(\\d+\\.\\d+\\)\\[exe\\]\\n re=1
-
-Zip Double Bad Extension
- ${result} = Scan Message With Rspamc ${TESTDIR}/messages/zip-doublebad.eml
- Check Rspamc ${result} MIME_DOUBLE_BAD_EXTENSION \\(\\d+\\.\\d+\\)\\[\\.pdf\\.exe\\]\\n re=1
-
-Rar4
- ${result} = Scan Message With Rspamc ${TESTDIR}/messages/rar4.eml
- Check Rspamc ${result} MIME_BAD_EXTENSION \\(\\d+\\.\\d+\\)\\[exe\\]\\n re=1
--- /dev/null
+*** Settings ***
+Suite Setup MIMETypes Setup
+Suite Teardown Generic Teardown
+Library ${TESTDIR}/lib/rspamd.py
+Resource ${TESTDIR}/lib/rspamd.robot
+Variables ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${CONFIG} ${TESTDIR}/configs/plugins.conf
+${RSPAMD_SCOPE} Suite
+
+*** Test Cases ***
+Zip
+ ${result} = Scan Message With Rspamc ${TESTDIR}/messages/zip.eml
+ Check Rspamc ${result} MIME_BAD_EXTENSION \\(\\d+\\.\\d+\\)\\[exe\\]\\n re=1
+
+Zip Double Bad Extension
+ ${result} = Scan Message With Rspamc ${TESTDIR}/messages/zip-doublebad.eml
+ Check Rspamc ${result} MIME_DOUBLE_BAD_EXTENSION \\(\\d+\\.\\d+\\)\\[\\.pdf\\.exe\\]\\n re=1
+
+Rar4
+ ${result} = Scan Message With Rspamc ${TESTDIR}/messages/rar4.eml
+ Check Rspamc ${result} MIME_BAD_EXTENSION \\(\\d+\\.\\d+\\)\\[exe\\]\\n re=1
+
+*** Keywords ***
+MIMETypes Setup
+ ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/mime_types.conf
+ Set Suite Variable ${PLUGIN_CONFIG}
+ Generic Setup PLUGIN_CONFIG
+++ /dev/null
-options = {
- filters = ["spf", "dkim", "regexp"]
- url_tld = "${TESTDIR}/../lua/unit/test_tld.dat"
- pidfile = "${TMPDIR}/rspamd.pid"
- lua_path = "${TESTDIR}/../../contrib/lua-fun/?.lua"
-}
-logging = {
- type = "file",
- level = "debug"
- filename = "${TMPDIR}/rspamd.log"
-}
-metric = {
- name = "default",
- actions = {
- reject = 100500,
- }
- unknown_weight = 1
-}
-
-worker {
- type = normal
- bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL}
- count = 1
- keypair {
- pubkey = "${KEY_PUB1}";
- privkey = "${KEY_PVT1}";
- }
-}
-modules {
- path = "${TESTDIR}/../../src/plugins/lua/"
-}
-multimap {
- DNSBL_MAP {
- type = "dnsbl";
- map = "rspamd.com";
- }
- IP_MAP {
- type = "ip";
- map = "${TESTDIR}/configs/maps/ip.list";
- }
- FROM_MAP {
- type = "from";
- filter = "email:domain";
- map = "${TESTDIR}/configs/maps/domains.list";
- }
- REGEXP_MAP {
- type = "from";
- filter = "email:addr";
- regexp = true;
- map = "${TESTDIR}/configs/maps/regexp.list";
- }
- DEPS_MAP {
- type = "from";
- filter = "email:addr";
- regexp = true;
- map = "${TESTDIR}/configs/maps/regexp.list";
- require_symbols = "R_SPF_ALLOW & REGEXP_MAP & !FROM_MAP";
- }
- RCPT_MAP {
- type = "rcpt";
- filter = "email:addr";
- symbols = ["SYM1"];
- map = "${TESTDIR}/configs/maps/multiple.list";
- }
- HEADER_MAP {
- type = "header";
- header = "To";
- filter = "email:name";
- map = "${TESTDIR}/configs/maps/utf.list";
- regexp = true;
- }
- HOSTNAME_MAP {
- type = "hostname";
- map = "${TESTDIR}/configs/maps/domains.list";
- }
- HOSTNAME_MAP_CDB {
- type = "hostname";
- map = "cdb://${TESTDIR}/configs/maps/domains.cdb";
- }
-}
--- /dev/null
+mime_types {
+ file = "${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",
+ ]
+ }
+}
--- /dev/null
+multimap {
+ DNSBL_MAP {
+ type = "dnsbl";
+ map = "rspamd.com";
+ }
+ IP_MAP {
+ type = "ip";
+ map = "${TESTDIR}/configs/maps/ip.list";
+ }
+ FROM_MAP {
+ type = "from";
+ filter = "email:domain";
+ map = "${TESTDIR}/configs/maps/domains.list";
+ }
+ REGEXP_MAP {
+ type = "from";
+ filter = "email:addr";
+ regexp = true;
+ map = "${TESTDIR}/configs/maps/regexp.list";
+ }
+ DEPS_MAP {
+ type = "from";
+ filter = "email:addr";
+ regexp = true;
+ map = "${TESTDIR}/configs/maps/regexp.list";
+ require_symbols = "R_SPF_ALLOW & REGEXP_MAP & !FROM_MAP";
+ }
+ RCPT_MAP {
+ type = "rcpt";
+ filter = "email:addr";
+ symbols = ["SYM1"];
+ map = "${TESTDIR}/configs/maps/multiple.list";
+ }
+ HEADER_MAP {
+ type = "header";
+ header = "To";
+ filter = "email:name";
+ map = "${TESTDIR}/configs/maps/utf.list";
+ regexp = true;
+ }
+ HOSTNAME_MAP {
+ type = "hostname";
+ map = "${TESTDIR}/configs/maps/domains.list";
+ }
+ HOSTNAME_MAP_CDB {
+ type = "hostname";
+ map = "cdb://${TESTDIR}/configs/maps/domains.cdb";
+ }
+}
options = {
+ filters = ["spf", "dkim", "regexp"]
+ url_tld = "${TESTDIR}/../lua/unit/test_tld.dat"
pidfile = "${TMPDIR}/rspamd.pid"
+ lua_path = "${TESTDIR}/../../contrib/lua-fun/?.lua"
}
logging = {
type = "file",
bind_socket = ${LOCAL_ADDR}:${PORT_NORMAL}
count = 1
}
-mime_types {
- file = "${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",
- ]
- }
-}
modules {
path = "${TESTDIR}/../../src/plugins/lua/"
}
+${PLUGIN_CONFIG}