Fix rspamd-learn when moving mail from/to junk folder

Before, the ham/spam scripts got the rspamd-ip/port from the environment.
However, when checking the environment of these processes now, it seems
cleared. Maybe the new dovecot version now clears environment? — I couldn’t
find a hint.

In any case, using the common mechanism of injecting the ip/port from where
it’s definately known by the already-used jinja2-mechanism seems reasonably
safe.
master
Dario Ernst 5 years ago
parent e46153c0b1
commit 88bfb0d17f

@ -1,4 +0,0 @@
#!/bin/bash
tee >(rspamc -h ${ANTISPAM_ADDRESS} -P mailu learn_ham /dev/stdin) \
| rspamc -h ${ANTISPAM_ADDRESS} -P mailu -f 13 fuzzy_add /dev/stdin

@ -1,4 +0,0 @@
#!/bin/bash
tee >(rspamc -h ${ANTISPAM_ADDRESS} -P mailu learn_spam /dev/stdin) \
>(rspamc -h ${ANTISPAM_ADDRESS} -P mailu -f 11 fuzzy_add /dev/stdin)

@ -0,0 +1,4 @@
#!/bin/bash
tee >(rspamc -h {{ ANTISPAM_ADDRESS }} -P mailu learn_ham /dev/stdin) \
| rspamc -h {{ ANTISPAM_ADDRESS }} -P mailu -f 13 fuzzy_add /dev/stdin

@ -0,0 +1,4 @@
#!/bin/bash
tee >(rspamc -h {{ ANTISPAM_ADDRESS }} -P mailu learn_spam /dev/stdin) \
>(rspamc -h {{ ANTISPAM_ADDRESS }} -P mailu -f 11 fuzzy_add /dev/stdin)

@ -1,6 +1,7 @@
#!/usr/bin/python3
import os
import stat
import glob
import multiprocessing
import logging as log
@ -32,6 +33,15 @@ if os.environ["WEBMAIL"] != "none":
for dovecot_file in glob.glob("/conf/*.conf"):
conf.jinja(dovecot_file, os.environ, os.path.join("/etc/dovecot", os.path.basename(dovecot_file)))
try:
os.mkdir("/conf/bin")
except FileExistsError:
pass
for script_file in glob.glob("/conf/*.script"):
out_file = os.path.join("/conf/bin/", os.path.basename(script_file).replace('.script',''))
conf.jinja(script_file, os.environ, out_file)
os.chmod(out_file, stat.S_IRUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
# Run Podop, then postfix
multiprocessing.Process(target=start_podop).start()
os.system("chown mail:mail /mail")

@ -0,0 +1 @@
Fix piping mail into rspamd when moving from/to junk-folder
Loading…
Cancel
Save