diff --git a/docs/about/features.md b/docs/about/features.md index 308307ab4..926273aea 100644 --- a/docs/about/features.md +++ b/docs/about/features.md @@ -177,7 +177,8 @@ See [Statistic configuration](/configuration/statistic), [Neural module](/module Example custom rule: ```lua --- /etc/rspamd/local.d/custom_rules.lua +-- /etc/rspamd/lua.local.d/custom_rule.lua +-- `custom_rule` basename is arbitrary rspamd_config.SUSPICIOUS_ATTACHMENT = { callback = function(task) local parts = task:get_parts() diff --git a/docs/configuration/selectors.md b/docs/configuration/selectors.md index 9e40da694..e953a92dc 100644 --- a/docs/configuration/selectors.md +++ b/docs/configuration/selectors.md @@ -361,7 +361,7 @@ In general, you need not be overly concerned about type safety unless you encoun ## Own selectors -You have the option to incorporate your custom extractors and processing functions. However, it's crucial to implement this setup before utilizing these selectors in any other context. For instance, the execution of `rspamd.local.lua` precedes the initialization of plugins, making it a secure location to register your functions. Here is a small example about how to register your own extractors and processors. +You have the option to incorporate your custom extractors and processing functions. However, it's crucial to implement this setup before utilizing these selectors in any other context. For instance, the execution of scripts located inside `lua.local.d/` precedes the initialization of plugins, making it a secure location to register your functions. Here is a small example about how to register your own extractors and processors. ~~~lua local lua_selectors = require "lua_selectors" -- Import module @@ -398,7 +398,7 @@ You can use these functions in your selectors subsequently. You can also leverage selectors with Rspamd's [regexp module](/modules/regexp). This approach allows you to utilize the data extracted and processed by the selector framework to match it against various regular expressions. -To start, you'll need to register a selector in the regexp module. You can achieve this by adding the following code to your `rspamd.local.lua` file: +To start, you'll need to register a selector in the regexp module. You can achieve this by adding the following code to a Lua script inside `lua.local.d/` directory: ~~~lua rspamd_config:register_re_selector('test', 'user.lower;header(Subject).lower', ' ') diff --git a/docs/developers/examples.md b/docs/developers/examples.md index df88ea0e6..99c15f3d6 100644 --- a/docs/developers/examples.md +++ b/docs/developers/examples.md @@ -8,7 +8,7 @@ title: Lua rules examples Here is the collection of the useful Lua rules snippets that are not the official rules but could be used to filter specific spam. -To enable these snippets, you can place them to the `rspamd.local.lua` file. Typically it will be `/etc/rspamd/rspamd.local.lua` file for the Linux distros (or `/usr/local/etc/rspamd/rspamd.local.lua` for others). +To enable these snippets, you can place them to any `.lua` file located under the `lua.local.d` directory. Typically the path will be `/etc/rspamd/lua.local.d/` for the Linux distros (or `/usr/local/etc/rspamd/lua.local.d/` for others). diff --git a/docs/developers/writing_rules.md b/docs/developers/writing_rules.md index 184b7b199..72784ef99 100644 --- a/docs/developers/writing_rules.md +++ b/docs/developers/writing_rules.md @@ -47,7 +47,8 @@ rspamd_config:register_symbol({ ### Your first symbol ```lua --- /etc/rspamd/local.d/custom_rules.lua +-- /etc/rspamd/lua.local.d/custom_rule.lua +-- `custom_rule` basename is arbitrary local function always_fires(task) return true end @@ -360,5 +361,3 @@ config['regexp']['SYMBOL'] = { callback = function(task) ... end } | Post-filters | After normal filters and composites | | Composites (pass 2) | Combine results including postfilters | | Idempotent filters | Must not change result | - - diff --git a/docs/faq.md b/docs/faq.md index 45333ef37..2c077dbac 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -266,7 +266,7 @@ enabled = false; ### How do I disable a specific rule? -Add a condition in `/etc/rspamd/rspamd.local.lua`: +Create a `.lua` file in `/etc/rspamd/lua.local.d/` and add a condition: ```lua rspamd_config:add_condition('SOME_SYMBOL', function(task) return false end) diff --git a/docs/modules/external_relay.md b/docs/modules/external_relay.md index c61fb7913..1f13137f5 100644 --- a/docs/modules/external_relay.md +++ b/docs/modules/external_relay.md @@ -19,7 +19,7 @@ Different strategies for identifying mail to tamper with and the point of hand-o If the strategies are too broad to be used in your setup you might limit them using `rspamd_config:add_condition()`, for example: ~~~lua -# /etc/rspamd/rspamd.local.lua +-- /etc/rspamd/lua.local.d/external_relay.lua -- add some condition for the symbol called EXTERNAL_RELAY_COUNT rspamd_config:add_condition('EXTERNAL_RELAY_COUNT', function(task) -- only apply this rule if authenticated user is postmaster@example.net diff --git a/docs/tutorials/clickhouse_analytics.md b/docs/tutorials/clickhouse_analytics.md index 5e9df59d2..d7a895a5d 100644 --- a/docs/tutorials/clickhouse_analytics.md +++ b/docs/tutorials/clickhouse_analytics.md @@ -74,8 +74,8 @@ extra_columns = { "from_domain" = "from:domain"; "mime_type" = "header('Content-Type')"; "user_agent" = "header('User-Agent')"; - - # Custom selectors (must be registered in rspamd.local.lua first!) + + # Custom selectors (must be registered in lua.local.d/ first!) "attachment_count" = "attachment_count()"; "has_executable" = "has_dangerous_attachment()"; "attachment_extensions" = "attachment_types()"; @@ -229,10 +229,11 @@ Here's how to integrate custom selectors with ClickHouse from start to finish: #### Step 1: Register Custom Selectors -First, register your custom selectors in `/etc/rspamd/rspamd.local.lua`: +First, register your custom selectors in `/etc/rspamd/lua.local.d/`: ```lua --- /etc/rspamd/rspamd.local.lua +-- /etc/rspamd/lua.local.d/custom_selectors.lua +-- `custom_selectors` is arbitrary local lua_selectors = require "lua_selectors" @@ -560,7 +561,7 @@ ORDER BY Messages DESC; ``` **Key Points:** -- Selector names in `rspamd.local.lua` must match those used in `clickhouse.conf` +- Selector names in `lua.local.d/custom_selectors.lua` must match those used in `clickhouse.conf` - All custom selectors return string values to ClickHouse - Restart Rspamd after adding new selectors - Custom columns appear automatically in the ClickHouse table