Skip to content

Commit 110a04a

Browse files
Document Rspamd Bayesian filter bulk training (#152)
1 parent ffbb1cb commit 110a04a

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Diff for: README.md

+41
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,47 @@ To access the admin web UI of Rspamd point the browser to
191191

192192
https://<mail host>/rspamd/
193193

194+
## Rspamd bulk Bayesian filter training
195+
196+
To efficiently train the Rspamd Bayesian filter plugin in an NS8
197+
environment, use the `rspamc` wrapper command, which incorporates Rspamd's
198+
authentication header logic.
199+
200+
To display the help output for the `rspamc-wrapper` command, run:
201+
202+
# Display the help output for rspamc-wrapper
203+
runagent -m mail1 podman exec -i dovecot rspamc-wrapper --help
204+
205+
To train the filter with ham messages, specify the mailbox path relative
206+
to Dovecot's working directory. For example, to train with messages from
207+
`first.user`'s mailbox:
208+
209+
# Read ham messages from an existing Maildir in the container
210+
runagent -m mail1 podman exec -i dovecot rspamc-wrapper learn_ham first.user/Maildir/cur
211+
212+
For a single spam file (e.g., in mbox format), use shell redirection to
213+
pass the file through stdin. For example:
214+
215+
# Train filter with spam messages in a single mbox file
216+
runagent -m mail1 podman exec -i dovecot rspamc-wrapper learn_spam < spamarchive.mbox
217+
218+
If you have multiple spam files in a directory on the host, copy them into
219+
the container's filesystem using:
220+
221+
# Copy directory and its contents into Dovecot's container, under /srv
222+
tar -c ./some-spamdir | runagent -m mail1 podman cp - dovecot:/srv
223+
224+
Note that `/srv/some-spamdir` is not mounted to a persistent volume, so
225+
its contents are volatile and will be lost on the next container restart.
226+
To train with messages from the container directory, run:
227+
228+
# Train filter with spam messages in the volatile destination directory
229+
runagent -m mail1 podman exec -i dovecot rspamc-wrapper learn_spam /srv/some-spamdir
230+
231+
For best results, verify successful training by reviewing the Rspamd logs
232+
or using diagnostic commands. Consult the Rspamd documentation for further
233+
details.
234+
194235
## Service discovery
195236

196237
Another module can discover IMAP and SUBMISSION endpoints by looking up

Diff for: dovecot/usr/local/bin/rspamc-wrapper

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../usr/local/lib/dovecot/sieve-pipe/rspamc-wrapper

0 commit comments

Comments
 (0)