Rspamd testing

16
RSPAMD TESTING

Transcript of Rspamd testing

Page 1: Rspamd testing

RSPAMD TESTING

Page 2: Rspamd testing

PROBLEM STATEMENT

WHY TESTING IS HARD

▸ Need to test on live traffic

▸ Testing environment might be less powerful (e.g. a VM)

▸ Experimental machines can fail or die

▸ Need to compare all results

Page 3: Rspamd testing

PROBLEM STATEMENT

GOALS: TEST NEW VERSIONS

STABLE VERSION TESTING VERSION

COMPARE RESULTS

Page 4: Rspamd testing

PROBLEM STATEMENT

GOALS: TEST NEW RULES

OLD RULES NEW RULES

COLLECT STATISTICS

NEW PLUGINS

Page 5: Rspamd testing

PROBLEM STATEMENT

GOALS: COMPARE SPAM ENGINES

RSPAMD OTHER SCANNER

COMPARE QUALITY

Page 6: Rspamd testing

PROBLEM STATEMENT

GOALS: COLLECT GLOBAL STATISTICS

RSPAMD

GATHER STATS

RSPAMD RSPAMDRSPAMD

1% 2% 10% 0.5%

STATISTICS

Page 7: Rspamd testing

ARCHITECTURE

SCAN SCHEME

RSPAMD PROXY

STABLE CLUSTER TESTING CLUSTER TESTING CLUSTER

Proxy stable result

COMPARE RESULTS

Page 8: Rspamd testing

ARCHITECTURE

MAIN FEATURES

▸ Reply immediately when get results from the main cluster

▸ Fast and low latency architecture

▸ Can use multiple compare result scripts

▸ Compare scripts could use all API functions from rspamd

Page 9: Rspamd testing

ARCHITECTURE

ENCRYPTION PROXY

RSPAMD PROXY

STABLE CLUSTER

Encrypt using HTTPCrypt

Scan local file

Page 10: Rspamd testing

ARCHITECTURE

ENCRYPTION PROXY

▸ Encrypt with HTTPCrypt:

▸ low latency (0 RTT before data sending)

▸ zero copy

▸ provable secure

▸ simple keys management

▸ Can open local files and send encrypted data stream

▸ Each cluster can have its own unique encryption key

▸ Local keys are rotated frequently

Page 11: Rspamd testing

ARCHITECTURE

LOAD BALANCING

RSPAMD PROXY

STABLE CLUSTER TESTING CLUSTER TESTING CLUSTER

COMPARE RESULTS

50% 10%

Balance within clusters

Page 12: Rspamd testing

ARCHITECTURE

LOAD BALANCING

▸ Send certain amount of traffic to each testing cluster

▸ Balance within each cluster:

▸ balancing schemes: round-robin, master-slave, random

▸ each server can have its own priority

▸ can detect if an upstream is down

▸ lazily resolve upstream names (DNS balancing)

Page 13: Rspamd testing

ARCHITECTURE

FOREIGN EXTERNAL SCANNERS

RSPAMD PROXY

STABLE CLUSTEREncrypt using HTTPCrypt

Scan local file

FOREIGN CLUSTER TESTING CLUSTER

Use LUA script to parse results

Page 14: Rspamd testing

ARCHITECTURE

FOREIGN EXTERNAL SCANNERS

▸ Can scan external scanners, e.g. SA or Cloudmark

▸ Can evaluate their efficiency comparing to rspamd

▸ Use Lua filter to parse external scanners results

Page 15: Rspamd testing

COMPARE EXAMPLES

AN EXAMPLE OF COMPARISON SCRIPT

return function(results) local log = require "rspamd_logger"

for k,v in pairs(results) do if type(v) == 'table' then log.infox("%s: %s", k, v['default']['score']) else log.infox("err: %s: %s", k, v) end end end

Page 16: Rspamd testing

FUTURE PLANS

POTENTIAL FEATURES

▸ Balance not merely HTTP but also SMTP

▸ Perform retries when master connection fails somehow

▸ Use mirrors results if the whole stable cluster is dead

▸ Location based balancing (select the nearest or the fastest server among possible choices)