Questions about Sieve filters

Discussion in 'General' started by TonyG, Apr 26, 2022.

  1. TonyG

    TonyG Active Member

    I believe I understand how ISPConfig saves Sieve rules:
    • In ISPConfig > Email > Mailbox > User > Mail Filter we can maintain the most common rules in the UI.
    • In Custom Rules we can hand-craft other rules.
    • All of these rules are saved in /var/vmail/domain/user/.ispconfig-before.sieve.
    • The UI-maintained filters are numbered and named. They can be seen in Custom Rules, and can be changed, but for consistency with the UI and a database reference those rules should not be changed by hand without great care.
    • User-defined rules are included from file .sieve, and stored in folder ./sieve.
    • The .ispconfig.sieve file is processed after user-defined (managesieve) filters. It is only used for ISPConfig > Email > Mailbox > User > Autoresponder.
    There is no Sieve-based filtering at the domain or server level. For domain>server level filtering we use Regexp in ISPConfig > Email > Global Filters > Content Filter.
    If any of that is incorrect, please correct it. I hope that helps anyone who finds this post.

    Questions:

    1) I want to establish a procedure for standardized maintenance of specific rules for all users in a domain. So far I'm thinking of creating a disabled user called "filter", update filters in Custom Rules there, and use a script to copy/replace those rules into all /var/vmail/domain/user/.ispconfig-before.sieve files, surrounded with # comments like the "Mail Filter" rules. Is there a better way to propagate a template like this?

    2) Rather than using the UI to save Regexp rules for _checks files, would it break ISPConfig if I maintained those files outside of the UI? (I understand customizations need to be added to conf-custom (old/new format) for update-safety.)

    3) I don't want to duplicate effort: Does anyone else know or maintain a repo of _checks files? Example Of course all such "off the interwebs" lists are subject to individual preferences and errors, and need to be vetted.

    4) Does it look like I'm missing anything related to Sieve and custom rule processing? I'm working with Rspamd completely separately.

    Thanks.
     
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    I would probably avoid propagation and just put the custom filters in a local file for the domain. You can use multiple sieve_before/sieve_after files, so just create /usr/lib/dovecot/sieve or wherever you prefer to keep them and add something like /usr/lib/dovecot/sieve/shared-%d.sieve to sieve_before or sieve_after, and add filters there. You may have to compile those sieve scripts manually, I'm not sure.
    You mean postfix header_checks and body_checks (unrelated to sieve filters)? Maintaining those manually is no problem, just tweak your conf-custom to reference your file paths as you indicate.
     
  3. TonyG

    TonyG Active Member

    UGH, I've seen that syntax but missed it in the spec. Thanks!
    Yeah, should have re-worded subject. :oops:
    Perfect. Thanks bud!
     

Share This Page