add sieve-spam-filter fix nb hardware
This commit is contained in:
28
hosts/mail.cloonar.com/pkgs/sieve-spam-filter/default.nix
Normal file
28
hosts/mail.cloonar.com/pkgs/sieve-spam-filter/default.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{ stdenv
|
||||||
|
, makeWrapper
|
||||||
|
, rspamd
|
||||||
|
,
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "sieve-rspamd-filter";
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
src = ./src;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
for sieve in $src/*.sieve; do
|
||||||
|
install -D "$sieve" "$out/share/sieve-rspamd-filter/$(basename $sieve)"
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir $out/bin
|
||||||
|
cat > $out/bin/learn-spam.sh <<'EOF'
|
||||||
|
#!/bin/sh
|
||||||
|
exec ${rspamd}/bin/rspamc -h /run/rspamd.sock learn_spam
|
||||||
|
EOF
|
||||||
|
cat > $out/bin/learn-ham.sh <<'EOF'
|
||||||
|
#!/bin/sh
|
||||||
|
exec ${rspamd}/bin/rspamc -h /run/rspamd.sock learn_ham
|
||||||
|
EOF
|
||||||
|
chmod +x $out/bin/*.sh
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
require ["fileinto"];
|
||||||
|
|
||||||
|
if header :is "X-Spam" "Yes" {
|
||||||
|
fileinto "Spam";
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
|
||||||
|
|
||||||
|
if environment :matches "imap.mailbox" "*" {
|
||||||
|
set "mailbox" "${1}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if string "${mailbox}" "Trash" {
|
||||||
|
stop;
|
||||||
|
}
|
||||||
|
|
||||||
|
if environment :matches "imap.user" "*" {
|
||||||
|
set "username" "${1}";
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe :copy "learn-ham.sh" [ "${username}" ];
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];
|
||||||
|
|
||||||
|
if environment :matches "imap.user" "*" {
|
||||||
|
set "username" "${1}";
|
||||||
|
}
|
||||||
|
|
||||||
|
pipe :copy "learn-spam.sh" [ "${username}" ];
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
crypttabExtraOpts = [ "fido2-device=auto" ];
|
crypttabExtraOpts = [ "fido2-device=auto" ];
|
||||||
device = "/dev/disk/by-uuid/7435d48f-f942-485b-9817-328ad3fc0b93";
|
device = "/dev/disk/by-uuid/7435d48f-f942-485b-9817-328ad3fc0b93";
|
||||||
};
|
};
|
||||||
};
|
|
||||||
systemd.enable = true;
|
systemd.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user