diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 01:35:06 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2023-10-04 02:11:48 +0200 |
commit | 1a64deeb894dc95e2645a75771732c6cc53a79ad (patch) | |
tree | 1b9df4838f894577a09b9b260151756272efeb53 /systems/eldiron/mail/scan_reported_mails | |
parent | fa25ffd4583cc362075cd5e1b4130f33306103f0 (diff) | |
download | Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.gz Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.tar.zst Nix-1a64deeb894dc95e2645a75771732c6cc53a79ad.zip |
Squash changes containing private information
There were a lot of changes since the previous commit, but a lot of them
contained personnal information about users. All thos changes got
stashed into a single commit (history is kept in a different place) and
private information was moved in a separate private repository
Diffstat (limited to 'systems/eldiron/mail/scan_reported_mails')
-rwxr-xr-x | systems/eldiron/mail/scan_reported_mails | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/systems/eldiron/mail/scan_reported_mails b/systems/eldiron/mail/scan_reported_mails new file mode 100755 index 0000000..fe9f4d6 --- /dev/null +++ b/systems/eldiron/mail/scan_reported_mails | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | ( flock -n 9 || exit 1 | ||
4 | shopt -s nullglob | ||
5 | for spool in /var/lib/vhost/.rspamd/*/pending; do | ||
6 | rspamd_folder=$(dirname $spool) | ||
7 | mail_user=$(basename $rspamd_folder) | ||
8 | mv $rspamd_folder/pending $rspamd_folder/processing | ||
9 | |||
10 | for mtype in ham spam; do | ||
11 | if [ -d $rspamd_folder/processing/$mtype ]; then | ||
12 | output="$(rspamc -h /run/rspamd/worker-controller.sock -c bayes -d $mail_user learn_$mtype $rspamd_folder/processing/$mtype/*)" | ||
13 | echo "[$mtype: $mail_user]" ${output} >> /var/lib/vhost/.rspamd/rspamd.log | ||
14 | mkdir -p $rspamd_folder/processed/$mtype | ||
15 | cp $rspamd_folder/processing/$mtype/* $rspamd_folder/processed/$mtype/ | ||
16 | fi | ||
17 | done | ||
18 | |||
19 | rm -rf $rspamd_folder/processing | ||
20 | done | ||
21 | ) 9>/var/lib/vhost/scan_reported_mails.lock | ||