You've already forked Mailu
mirror of
https://github.com/Mailu/Mailu.git
synced 2025-11-27 22:18:22 +02:00
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.
This commit is contained in:
@@ -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)
|
|
||||||
4
core/dovecot/conf/ham.script
Executable file
4
core/dovecot/conf/ham.script
Executable file
@@ -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
|
||||||
4
core/dovecot/conf/spam.script
Executable file
4
core/dovecot/conf/spam.script
Executable file
@@ -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
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import stat
|
||||||
import glob
|
import glob
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import logging as log
|
import logging as log
|
||||||
@@ -32,6 +33,15 @@ if os.environ["WEBMAIL"] != "none":
|
|||||||
for dovecot_file in glob.glob("/conf/*.conf"):
|
for dovecot_file in glob.glob("/conf/*.conf"):
|
||||||
conf.jinja(dovecot_file, os.environ, os.path.join("/etc/dovecot", os.path.basename(dovecot_file)))
|
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
|
# Run Podop, then postfix
|
||||||
multiprocessing.Process(target=start_podop).start()
|
multiprocessing.Process(target=start_podop).start()
|
||||||
os.system("chown mail:mail /mail")
|
os.system("chown mail:mail /mail")
|
||||||
|
|||||||
1
towncrier/newsfragments/1177.bug
Normal file
1
towncrier/newsfragments/1177.bug
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Fix piping mail into rspamd when moving from/to junk-folder
|
||||||
Reference in New Issue
Block a user