Skip to content

Commit

Permalink
Merge pull request #649 from mailcow/feat/improve-rspamd-docs
Browse files Browse the repository at this point in the history
Rearranged some Docs parts (mostly Rspamd)
  • Loading branch information
DerLinkman authored Nov 10, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents f1be511 + 244003b commit 3e53eac
Showing 19 changed files with 930 additions and 859 deletions.
31 changes: 31 additions & 0 deletions docs/manual-guides/Rspamd/u-e-rspamd-add-additional-modules.de.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Laden Sie das Modul herunter und speichern Sie es in folgenden Pfad ab: `data/conf/rspamd/plugins.d/`.

Danach müssen Sie die Konfigurationsparameter des Modules in `data/conf/rspamd/rspamd.conf.local` hinzufügen.
Falls das Modul `my_plugin.lua` heißt, sollte die Datei wie folgt aussehen:

```
# rspamd.conf.local
my_plugin {
some_setting = "some value";
}
```

Falls Ihr Modul keine zusätzlichen Konfigurationen benötigt, reicht es aus einen leeren Konfigurationsblock hinzuzufügen. Wie im folgenden Beispiel zu sehen:

```
# rspamd.conf.local
my_plugin { }
```

Falls Sie keinen Konfigurationsblock hinzufügen, dann wird das Modul automatisch deaktiviert und im Logfile des rspamd-mailcow Containers sehen Sie folgende Nachricht:

```
mailcowdockerized-rspamd-mailcow-1 | 2023-05-20 14:01:32 #1(main) <sh6j9z>; cfg; rspamd_config_is_module_enabled: lua module my_plugin is enabled but has not been configured
mailcowdockerized-rspamd-mailcow-1 | 2023-05-20 14:01:32 #1(main) <sh6j9z>; cfg; rspamd_config_is_module_enabled: my_plugin disabling unconfigured lua module
```

Falls Sie das Modul erfolgreich konfiguiert haben, dann sollte das Logfile des rspamd-mailcow Containers wie folgt aussehen:

```
mailcowdockerized-rspamd-mailcow-1 | 2023-05-20 14:04:50 #1(main) <8ayxpf>; cfg; rspamd_init_lua_filters: init lua module my_plugin from /etc/rspamd/plugins.d//my_plugin.lua; digest: 5cb88961e5
```
31 changes: 31 additions & 0 deletions docs/manual-guides/Rspamd/u-e-rspamd-add-additional-modules.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Download the module and save it in the following path: `data/conf/rspamd/plugins.d/`.

Next, add any necessary configuration for your module to `data/conf/rspamd/rspamd.conf.local`. \
If you have a module named `my_plugin.lua`, configuration might look like the following:

```
# rspamd.conf.local
my_plugin {
some_setting = "some value";
}
```

If your module does not require any additional configuration, simply add an empty configuration block, for example:

```
# rspamd.conf.local
my_plugin { }
```

If you do not add a configuration block, the module will be automatically disabled, and the rspamd-mailcow container log will contain a message such as:

```
mailcowdockerized-rspamd-mailcow-1 | 2023-05-20 14:01:32 #1(main) <sh6j9z>; cfg; rspamd_config_is_module_enabled: lua module my_plugin is enabled but has not been configured
mailcowdockerized-rspamd-mailcow-1 | 2023-05-20 14:01:32 #1(main) <sh6j9z>; cfg; rspamd_config_is_module_enabled: my_plugin disabling unconfigured lua module
```

If you have successfully configured your module, the rspamd-mailcow container logs should show:

```
mailcowdockerized-rspamd-mailcow-1 | 2023-05-20 14:04:50 #1(main) <8ayxpf>; cfg; rspamd_init_lua_filters: init lua module my_plugin from /etc/rspamd/plugins.d//my_plugin.lua; digest: 5cb88961e5
```
123 changes: 123 additions & 0 deletions docs/manual-guides/Rspamd/u-e-rspamd-tweaks.de.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
## Spamfilter-Schwellenwerte (global)

Jeder Benutzer kann [seine Spam-Bewertung](../mailcow-UI/u_e-mailcow_ui-spamfilter.de.md) individuell ändern.

Um eine neue **serverweite** Grenze zu definieren, editieren Sie `data/conf/rspamd/local.d/actions.conf`:

```cpp
reject = 15;
add_header = 8;
greylist = 7;
```

Speichern Sie die Datei und starten Sie "rspamd-mailcow" neu:
=== "docker compose (Plugin)"

``` bash
docker compose restart rspamd-mailcow
```

=== "docker-compose (Standalone)"

``` bash
docker-compose restart rspamd-mailcow
```

!!! warning "Achtung"
Bestehende Einstellungen der Benutzer werden nicht überschrieben!

Um benutzerdefinierte Schwellenwerte zurückzusetzen, führen Sie aus:
=== "docker compose (Plugin)"

``` bash
source mailcow.conf
docker compose exec mysql-mailcow mysql -umailcow -p$DBPASS mailcow -e "delete from filterconf where option = 'highspamlevel' or option = 'lowspamlevel';"
# oder:
docker compose exec mysql-mailcow mysql -umailcow -p$DBPASS mailcow -e "delete from filterconf where option = 'highspamlevel' or option = 'lowspamlevel' and object = '[email protected]';"
```

=== "docker-compose (Standalone)"

``` bash
source mailcow.conf
docker-compose exec mysql-mailcow mysql -umailcow -p$DBPASS mailcow -e "delete from filterconf where option = 'highspamlevel' or option = 'lowspamlevel';"
# oder:
docker-compose exec mysql-mailcow mysql -umailcow -p$DBPASS mailcow -e "delete from filterconf where option = 'highspamlevel' or option = 'lowspamlevel' and object = '[email protected]';"
```

---

## Benutzerdefinierte Ablehnungsnachrichten

Die Standard-Spam-Reject-Meldung kann durch Hinzufügen einer neuen Datei `data/conf/rspamd/override.d/worker-proxy.custom.inc` mit dem folgenden Inhalt geändert werden:

```
reject_message = "Meine eigene Ablehnungsnachricht";
```

Speichern Sie die Datei und starten Sie Rspamd neu:
=== "docker compose (Plugin)"

``` bash
docker compose restart rspamd-mailcow
```

=== "docker-compose (Standalone)"

``` bash
docker-compose restart rspamd-mailcow
```

Während das oben genannte für abgelehnte Mails mit einem hohen Spam-Score funktioniert, ignorieren Prefilter-Aktionen diese Einstellung. Für diese muss das Multimap-Modul in Rspamd angepasst werden:

1. Finden Sie das Prefilet-Reject-Symbol, für das Sie die Nachricht ändern wollen, führen Sie dazu aus: `grep -R "SYMBOL_WELCHES_ANGEPASST_WERDEN_SOLL" /opt/mailcow-dockerized/data/conf/rspamd/`

2. Fügen Sie Ihre eigene Nachricht als neue Zeile hinzu:

```
GLOBAL_RCPT_BL {
Typ = "rcpt";
map = "${LOCAL_CONFDIR}/custom/global_rcpt_blacklist.map";
regexp = true;
prefilter = true;
action = "reject";
message = "Der Versand von E-Mails an diesen Empfänger ist durch [email protected] verboten";
}
```
3. Speichern Sie die Datei und starten Sie Rspamd neu:
=== "docker compose (Plugin)"
``` bash
docker compose restart rspamd-mailcow
```
=== "docker-compose (Standalone)"
``` bash
docker-compose restart rspamd-mailcow
```
---
## E-Mails verwerfen (discard) anstatt zurückzuweisen (reject)
Wenn Sie eine Nachricht stillschweigend verwerfen wollen, erstellen oder bearbeiten Sie die Datei `data/conf/rspamd/override.d/worker-proxy.custom.inc` und fügen Sie den folgenden Inhalt hinzu:
```
discard_on_reject = true;
```
Starten Sie Rspamd neu:
=== "docker compose (Plugin)"
``` bash
docker compose restart rspamd-mailcow
```
=== "docker-compose (Standalone)"
``` bash
docker-compose restart rspamd-mailcow
```
122 changes: 122 additions & 0 deletions docs/manual-guides/Rspamd/u-e-rspamd-tweaks.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@

## Spam filter thresholds (global)

Each user is able to change [their spam rating individually](../mailcow-UI/u_e-mailcow_ui-spamfilter.en.md). To define a new **server-wide** limit, edit `data/conf/rspamd/local.d/actions.conf`:

```cpp
reject = 15;
add_header = 8;
greylist = 7;
```

Save the file and restart "rspamd-mailcow":
=== "docker compose (Plugin)"

``` bash
docker compose restart rspamd-mailcow
```

=== "docker-compose (Standalone)"

``` bash
docker-compose restart rspamd-mailcow
```

!!! warning
Existing settings of users will not be overwritten!

To reset custom defined thresholds, run:
=== "docker compose (Plugin)"

``` bash
source mailcow.conf
docker compose exec mysql-mailcow mysql -umailcow -p$DBPASS mailcow -e "delete from filterconf where option = 'highspamlevel' or option = 'lowspamlevel';"
# or:
docker compose exec mysql-mailcow mysql -umailcow -p$DBPASS mailcow -e "delete from filterconf where option = 'highspamlevel' or option = 'lowspamlevel' and object = '[email protected]';"
```

=== "docker-compose (Standalone)"

``` bash
source mailcow.conf
docker-compose exec mysql-mailcow mysql -umailcow -p$DBPASS mailcow -e "delete from filterconf where option = 'highspamlevel' or option = 'lowspamlevel';"
# or:
docker-compose exec mysql-mailcow mysql -umailcow -p$DBPASS mailcow -e "delete from filterconf where option = 'highspamlevel' or option = 'lowspamlevel' and object = '[email protected]';"
```

---

## Custom reject messages

The default spam reject message can be changed by adding a new file `data/conf/rspamd/override.d/worker-proxy.custom.inc` with the following content:

```
reject_message = "My custom reject message";
```

Save the file and restart Rspamd:
=== "docker compose (Plugin)"

``` bash
docker compose restart rspamd-mailcow
```

=== "docker-compose (Standalone)"

``` bash
docker-compose restart rspamd-mailcow
```

While the above works for rejected mails with a high spam score, prefilter reject actions will ignore this setting. For these maps, the multimap module in Rspamd needs to be adjusted:

1. Find prefilet reject symbol for which you want change message, to do it run: `grep -R "SYMBOL_YOU_WANT_TO_ADJUST" /opt/mailcow-dockerized/data/conf/rspamd/`

2. Add your custom message as new line:

```
GLOBAL_RCPT_BL {
type = "rcpt";
map = "${LOCAL_CONFDIR}/custom/global_rcpt_blacklist.map";
regexp = true;
prefilter = true;
action = "reject";
message = "Sending mail to this recipient is prohibited by [email protected]";
}
```
3. Save the file and restart Rspamd:
=== "docker compose (Plugin)"
``` bash
docker compose restart rspamd-mailcow
```
=== "docker-compose (Standalone)"
``` bash
docker-compose restart rspamd-mailcow
```
---
## Discard instead of reject
If you want to silently drop a message, create or edit the file `data/conf/rspamd/override.d/worker-proxy.custom.inc` and add the following content:
```
discard_on_reject = true;
```
Restart Rspamd:
=== "docker compose (Plugin)"
``` bash
docker compose restart rspamd-mailcow
```
=== "docker-compose (Standalone)"
``` bash
docker-compose restart rspamd-mailcow
```
Loading

0 comments on commit 3e53eac

Please sign in to comment.