mirror of
https://github.com/Mailu/Mailu.git
synced 2024-12-12 10:45:38 +02:00
Merge #1183
1183: Fix rspamd-learn when moving mail from/to junk folder r=mergify[bot] a=Nebukadneza 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. ## What type of PR? bug-fix ## What does this PR do? Instead of relying on dovecot passing our environment cleanly to sieve-called scripts, this explicitly injects the antispam ip/port into the spam/ham scripts used when moving files from/to the spam-folder. This required some management of the files, such as setting proper permissions after the jinja-run. ### Related issue(s) fixes #1177 ## Prerequistes - [x] In case of feature or enhancement: documentation updated accordingly - [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file. Co-authored-by: Dario Ernst <dario@kanojo.de> Co-authored-by: Dario Ernst <dario.ernst@rommelag.com>
This commit is contained in:
commit
9c956a04ca
@ -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)
|
@ -32,6 +32,12 @@ 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)))
|
||||
|
||||
os.makedirs("/conf/bin", exist_ok=True)
|
||||
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, 0o555)
|
||||
|
||||
# Run Podop, then postfix
|
||||
multiprocessing.Process(target=start_podop).start()
|
||||
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
|
Loading…
Reference in New Issue
Block a user