Vsevolod Stakhov
6125b6ffe9
[Fix] Remove shadowing of rspamd_logger in rules/misc.lua
- Fixes luacheck W431 warning (shadowing upvalue)
- rspamd_logger already required at module level (line 24)
- Remove redundant local require inside function
3 months ago
Vsevolod Stakhov
cf8953e28a
[Fix] Add missing rspamd_logger require in rules/misc.lua
- Fixes luacheck warning W113 (accessing undefined variable)
- rspamd_logger used in conditional registration logic
3 months ago
Vsevolod Stakhov
14827fd8e8
[Fix] Avoid duplicate R_SUSPICIOUS_URL symbol registration
When url_suspect plugin is enabled, skip the old R_SUSPICIOUS_URL
registration in rules/misc.lua to avoid symbol duplication.
The old implementation is kept for backward compatibility when the
new plugin is disabled.
3 months ago
Vsevolod Stakhov
19b93adb12
[Feature] Email aliases resolution and message classification
This commit adds comprehensive email alias handling and message direction
classification functionality.
Features added:
* [Feature] New lua_aliases library (lualib/lua_aliases.lua)
- Parse Unix /etc/aliases format (postmaster: root, etc.)
- Parse Postfix virtual aliases (user@domain -> target@domain)
- Parse local domains lists
- Recursive alias resolution with loop detection (max depth: 10)
- Multiple storage backends: File, Map, CDB
- Message classification: inbound/outbound/internal/forwarded
- Gmail-specific rules (dots removal, plus-addressing)
- Generic plus-addressing support for all domains
* [Feature] New aliases plugin (src/plugins/lua/aliases.lua)
- Prefilter for early alias resolution and classification
- Registers 13 symbols:
- Classification: LOCAL_INBOUND, LOCAL_OUTBOUND, INTERNAL_MAIL
- Aliases: ALIAS_RESOLVED, TAGGED_FROM, TAGGED_RCPT
- Forwarding: FWD_GOOGLE, FWD_YANDEX, FWD_MAILRU, FWD_SRS,
FWD_SIEVE, FWD_CPANEL, FORWARDED
- Stores classification in task cache for other plugins access
* [Rework] Email plus-aliases moved from rules/misc.lua
- Old EMAIL_PLUS_ALIASES, TAGGED_FROM, TAGGED_RCPT removed
- Functionality integrated into new aliases plugin
- Enhanced with full alias resolution support
* [Rework] Forwarding detection moved from rules/forwarding.lua
- All FWD_* symbols moved to aliases plugin
- Executes in prefilter (correct order before classification)
- Optimized: single pass instead of 7 separate callbacks
- Same symbols preserved for backward compatibility
* [Conf] New configuration file conf/modules.d/aliases.conf
- Disabled by default (enabled = false)
- Full examples for all backend types
- Configuration options documented
* [Test] Functional tests in 001_merged suite
- 15 test cases covering all functionality
- Tests for Unix aliases, virtual aliases, classification
- Gmail/plus-addressing tests, forwarding tests
- Edge cases and performance tests
Configuration example:
# local.d/aliases.conf
aliases {
enabled = true;
# System aliases
system_aliases = "/etc/aliases";
# Local domains
local_domains = ["example.com", "mail.example.com"];
# Options
max_recursion_depth = 10;
enable_gmail_rules = true;
enable_plus_aliases = true;
}
Usage in other plugins:
local lua_aliases = require "lua_aliases"
-- Get message classification
local classification = task:cache_get('aliases_classification')
if classification.direction == 'inbound' then
-- Apply inbound rules
end
BREAKING CHANGES:
- rules/misc.lua: EMAIL_PLUS_ALIASES removed (use aliases plugin)
- rules/forwarding.lua: all forwarding rules removed (use aliases plugin)
- To enable old behavior without aliases plugin, uncomment code in rules/
- Redis backend NOT supported (use CDB or Map instead)
Notes:
- Module disabled by default, enable in local.d/aliases.conf
- Uses task:cache_set() for storing classification (native Rspamd way)
- Debug logging via lua_util.debugm (use debug_modules = ["lua_aliases", "aliases"])
- Forwarding symbols now virtual (parent = ALIASES_CHECK)
5 months ago
Vsevolod Stakhov
fb774ae9c5
[Fix] Preserve the previous behaviour of RDNS_* checks
2 years ago
Vsevolod Stakhov
2df166de66
[Minor] Reduce priority as settings become broken otherwise
For future settings rework: there should be spill of settings checks
to allow dependency on symbols that are required for settings conditions.
2 years ago
Vsevolod Stakhov
e227bedc4f
[Rework] Resolve rdns in a separate function
Historically, it was done in `once_received` module, however, that check must
be done early, even before settings (as they could rely on hostname).
Hence, it was discussed to move this code to a separate rule.
2 years ago
Andrew Lewis
c17ffcd4e5
[Rules] Blank spam detection
2 years ago
Vsevolod Stakhov
662145d055
[Minor] Reformat all Lua code, no functional changes
3 years ago
Vsevolod Stakhov
5ae23df139
Apply suggestions from code review
3 years ago
twesterhever
68d9f76dc1
[Minor] Improve various rule descriptions
3 years ago
Vsevolod Stakhov
05fd471df5
[Rework] Reiterate on priorities
4 years ago
Vsevolod Stakhov
79417a5f81
[Minor] Update more copyright years/email
4 years ago
Vsevolod Stakhov
e834cdb26d
[Minor] Oops, fix foldl call
4 years ago
Vsevolod Stakhov
c6f7b897d4
[Minor] Fix some issues in URI_COUNT_ODD rule
Issue: #4037
4 years ago
Vsevolod Stakhov
0b88d35b45
[Minor] Fix bit operations logic
5 years ago
Vsevolod Stakhov
0604bcc851
[Minor] Filter urls for R_SUSPICIOUS_URL check
Suggested by: @citrin
5 years ago
Vsevolod Stakhov
deda62a64f
[Minor] Use numeric bit and for checking flags
5 years ago
Richard Schwab
7f7d408876
[Minor] fix typo: obfusicated -> obfuscated
5 years ago
Vsevolod Stakhov
ba5b6773e2
[Minor] Fix OMOGRAPH_URL for the changes in the phished flag
5 years ago
Vsevolod Stakhov
cd151c848a
[Minor] Properly use task:set_recipients
5 years ago
Anton Yuzhaninov
a9e9703a89
[Minor] Use task:has_header instead of task:get_header
Use task:has_header() to check if header is exists.
5 years ago
Vsevolod Stakhov
37c8503032
[Minor] Use rspamd_parsers directly
5 years ago
Anton Yuzhaninov
ce9394561d
[Minor] Add option for DATE_IN_PAST/DATE_IN_FUTURE symbols
Value for an option is the number of full hours the date of the message
is in the past or future.
5 years ago
Anton Yuzhaninov
ee429ed737
[Feature] Add INVALID_DATE rule
The symbol indicates that a date in Date: header has invalid format and
cannot be parsed by Rspamd.
5 years ago
Anton Yuzhaninov
967a9a4de3
[Minor] Combine Date checks
Combine Date header checks into a single callback. No functional
changes.
5 years ago
Kako, Chang
bd55a0ffde
[Fix] Fix FREEMAIL_REPLYTO_NEQ_FROM_DOM
6 years ago
Vsevolod Stakhov
25fbf9a11b
[Fix] Fix gpg parts misdetection
Issue: #3205
6 years ago
Vsevolod Stakhov
db44cc510d
[Rules] Add dedicated bitcoin addresses filter rule
7 years ago
Vsevolod Stakhov
6d6489052c
[Minor] Set alias flag
7 years ago
heraklit256
323580e25d
unify rules scores and weights
7 years ago
Vsevolod Stakhov
fb2c14b1e1
[Rules] OMOGRAPH_URL: Avoid extra calls for repeated urls
7 years ago
Vsevolod Stakhov
ec8a472f21
[Feature] Add dedicated ZW spaces detection for URLs
Issue: #2725
7 years ago
Vsevolod Stakhov
6296a24a75
[Rules] Fix the case when there are no received headers
7 years ago
Vsevolod Stakhov
d9f3f32336
[Minor] Add some mime only rules
7 years ago
Vsevolod Stakhov
d31f486d55
[Fix] Fix groups mess
8 years ago
heraklit256
a4b0bad4b4
add low positive score to RCVD_NO_TLS_LAST
8 years ago
Vsevolod Stakhov
1d2cb297a1
[Minor] Pet luacheck
8 years ago
Vsevolod Stakhov
7f5ca7ae3d
[Feature] Add rule to block mixed text and encrypted parts
8 years ago
Vsevolod Stakhov
c949b41dd7
[Feature] Improve URL_IN_SUBJECT rule
We penalise now this rule's weight when URL found has no schema.
8 years ago
Vsevolod Stakhov
51e2a8c056
[Fix] Fix usage of util.parse_mail_address
8 years ago
Vsevolod Stakhov
ee638abdb4
[Minor] Register names for callback only symbols
8 years ago
Vsevolod Stakhov
6eab75d108
[Minor] Fix warning
8 years ago
Vsevolod Stakhov
5321190dc5
[Project] Add some generic code to squeeze lua rules
8 years ago
Vsevolod Stakhov
48a8489567
[Fix] Cleanup mess with groups
8 years ago
Andrew Lewis
3720063daf
[Minor] Clarify RCVD_VIA_SMTP_AUTH description
- Issue: #1825
9 years ago
Vsevolod Stakhov
801abed417
[Minor] Remove reduntant debug
9 years ago
Vsevolod Stakhov
b93f976e37
[Rules] Penalise R_BAD_CTE_7BIT for utf8 messages
9 years ago
Vsevolod Stakhov
5f52812464
[Minor] Move emails normalization to the lua library
9 years ago
Andrew Lewis
f2c10417d9
[Minor] SPOOF_REPLY_TO: mitigate some possible FPs on mailing list posts
9 years ago