I am building a new mailserver on Centos7. My sieve is created with: mkdir /home/sieve cat <<EOF>/home/sieve/globalfilter.sieve || exit 1 require "fileinto"; if exists "X-Spam-Flag" { if header :contains "X-Spam-Flag" "NO" { } else { fileinto "Spam"; stop; } } if header :contains "subject" ["***SPAM***"] { fileinto "Spam"; stop; } EOF chown -R vmail:mail /home/sieve But in 90-sieve.conf there is the comment: # A path to a global sieve script file, which gets executed ONLY # if user's private Sieve script doesn't exist. Be sure to # pre-compile this script manually using the sievec command line # tool. #sieve_global_path = /var/lib/dovecot/sieve/default.sieve Do I run sievec on this script? And I found the following comment on a blog, about 3 years old: 2: Having a user-defined sieve script will cancel out the global script for redirecting spam. In the dovecot.conf, get rid of the sieve_global_path and sieve_global_dir, and instead use: sieve_before = /path/to/global.sieve -- what this will do is make sure that the global script runs before any user scripts, which allows the spam redirecting to actually work. What is current situation on this? thank you
Op 3/16/2017 om 10:20 PM schreef Robert Moskowitz:
I am building a new mailserver on Centos7.
My sieve is created with:
mkdir /home/sieve cat <<EOF>/home/sieve/globalfilter.sieve || exit 1 require "fileinto"; if exists "X-Spam-Flag" { if header :contains "X-Spam-Flag" "NO" { } else { fileinto "Spam"; stop; } } if header :contains "subject" ["***SPAM***"] { fileinto "Spam"; stop; } EOF
chown -R vmail:mail /home/sieve
But in 90-sieve.conf there is the comment:
# A path to a global sieve script file, which gets executed ONLY # if user's private Sieve script doesn't exist. Be sure to # pre-compile this script manually using the sievec command line # tool. #sieve_global_path = /var/lib/dovecot/sieve/default.sieve
Do I run sievec on this script?
Yes.
And I found the following comment on a blog, about 3 years old:
2: Having a user-defined sieve script will cancel out the global script for redirecting spam. In the dovecot.conf, get rid of the sieve_global_path and sieve_global_dir, and instead use: sieve_before = /path/to/global.sieve -- what this will do is make sure that the global script runs before any user scripts, which allows the spam redirecting to actually work.
What is current situation on this?
That is usually good advice. The sieve_global_path setting is now called sieve_default, since it configures the default script for users that don't have a personal one. So, unless you want users to have the ability and necessity (!) to create their own spam handling rules once they create a personal script, use the sieve_before setting. The sieve_before script also needs to be pre-compiled with sievec. Regards, Stephan.
On 03/16/2017 03:58 PM, Stephan Bosch wrote:
Op 3/16/2017 om 10:20 PM schreef Robert Moskowitz:
I am building a new mailserver on Centos7.
My sieve is created with:
mkdir /home/sieve cat <<EOF>/home/sieve/globalfilter.sieve || exit 1 require "fileinto"; if exists "X-Spam-Flag" { if header :contains "X-Spam-Flag" "NO" { } else { fileinto "Spam"; stop; } } if header :contains "subject" ["***SPAM***"] { fileinto "Spam"; stop; } EOF
chown -R vmail:mail /home/sieve
But in 90-sieve.conf there is the comment:
# A path to a global sieve script file, which gets executed ONLY # if user's private Sieve script doesn't exist. Be sure to # pre-compile this script manually using the sievec command line # tool. #sieve_global_path = /var/lib/dovecot/sieve/default.sieve
Do I run sievec on this script? Yes.
And I found the following comment on a blog, about 3 years old:
2: Having a user-defined sieve script will cancel out the global script for redirecting spam. In the dovecot.conf, get rid of the sieve_global_path and sieve_global_dir, and instead use: sieve_before = /path/to/global.sieve -- what this will do is make sure that the global script runs before any user scripts, which allows the spam redirecting to actually work.
What is current situation on this? That is usually good advice. The sieve_global_path setting is now called sieve_default, since it configures the default script for users that don't have a personal one.
And it is changes like this is why I am really trying for my notes to modify the provided files than replace them.
So, unless you want users to have the ability and necessity (!) to create their own spam handling rules once they create a personal script, use the sieve_before setting.
The sieve_before script also needs to be pre-compiled with sievec.
It seems to my reading that this is the same global.sieve script as what I am using now. That you earlier told me I need to pre-compile. Or am I missing something?
Your pattern seems a little too complicated. See below.
On 03/16/2017 02:20 PM, Robert Moskowitz wrote:
if exists "X-Spam-Flag" {
This isn't needed. If the flag doesn't exist, the 'if header ...' line won't match. You're doing two tests for every message where one is all that's needed.
if header :contains "X-Spam-Flag" "NO" {
You can just do "YES" here, and go straight to the command (fileinto). Yes/No is a boolean flag, it will either be one or the other.
fileinto "Spam"; stop;
It's not clear that you need the 'stop' here.
hope this helps,
Doug
Doug, On 03/16/2017 11:23 PM, Doug Barton wrote:
Your pattern seems a little too complicated. See below.
I acquired this script from: http://www.campworld.net/thewiki/pmwiki.php/LinuxServersCentOS/Cent6VirtMail... No telling where he got it from. So I greatly appreciate any and all advice. I am writing my own howto, and I would like to think I am doing a better job of it. I hope to have it finished in a couple weeks. I would say I am the proverbial 80% complete.
On 03/16/2017 02:20 PM, Robert Moskowitz wrote:
if exists "X-Spam-Flag" {
This isn't needed. If the flag doesn't exist, the 'if header ...' line won't match. You're doing two tests for every message where one is all that's needed.
if header :contains "X-Spam-Flag" "NO" {
You can just do "YES" here, and go straight to the command (fileinto). Yes/No is a boolean flag, it will either be one or the other.
fileinto "Spam"; stop;
It's not clear that you need the 'stop' here.
hope this helps,
Not completely. I 'program' in English writing standards like IEEE 802.1AR, 802.15.9, and RFCs. I have not really programmed since the mid-80s with 'B'. I leave the converting of our carefully worded standards to executables to others.... :) That said, is this what you are advising: require "fileinto"; if header :contains "X-Spam-Flag" "YES" { } else { fileinto "Spam"; } if header :contains "subject" ["***SPAM***"] { fileinto "Spam"; } Thanks!
On 03/16/2017 11:50 PM, Robert Moskowitz wrote:
Doug,
On 03/16/2017 11:23 PM, Doug Barton wrote:
Your pattern seems a little too complicated. See below.
I acquired this script from:
http://www.campworld.net/thewiki/pmwiki.php/LinuxServersCentOS/Cent6VirtMail...
No telling where he got it from. So I greatly appreciate any and all advice.
Blindly following things you find on the Internet is not a path to success. :)
I am writing my own howto, and I would like to think I am doing a better job of it.
You may consider whether your own depth of understanding is sufficient to improve the situation, or whether you are simply adding more noise. I wish you luck in any case.
Not completely. I 'program' in English writing standards like IEEE 802.1AR, 802.15.9, and RFCs. I have not really programmed since the mid-80s with 'B'.
I leave the converting of our carefully worded standards to executables to others.... :)
We all have our own areas of expertise. Nothing wrong with that.
That said, is this what you are advising:
Not precisely. You want to remove the 'else' in there, as the clause you have will do the opposite of what you intend. Also note that I removed your superfluous square brackets.
require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; } if header :contains "subject" "***SPAM***" { fileinto "Spam"; }
The best way to work with this is to start with simple rules on an individual client. Once you get a rule set that works, then you can move on to compiling it for the system. Always start as simple as possible though, and only add to it if your simple thing does not work. This is a pretty good tutorial on the syntax and options for Sieve. Given your intended purpose you should pay special attention to the 'create' modifier for 'fileinto'. Also, I would accomplish both things in the same rule using 'anyof' which should be slightly more efficient (which could make a big difference to server load depending on how many users you are supporting). https://support.tigertech.net/sieve hope this helps, Doug
All sieve scripts need to be compiled."default" means absence. So default scripts are used when user scripts don't exist. If users have their sieves scripts then the default won't be executed.
If you want to impose your script on all users then use sieve_before not sieve_default. For example, I use a sieve_before script to impose a backup copy of every e-mail delivered to my mailboxes to the corresponding backup mailboxes accounts. Since I want this script to get executed no matter what I use sieve_before not sieve_default. So I guess your SPAM script should also be a sieve_before.
-- Yassine
On Friday, March 17, 2017 8:08 AM, Doug Barton
Doug,
On 03/16/2017 11:23 PM, Doug Barton wrote:
Your pattern seems a little too complicated. See below.
I acquired this script from:
http://www.campworld.net/thewiki/pmwiki.php/LinuxServersCentOS/Cent6VirtMail...
No telling where he got it from. So I greatly appreciate any and all advice.
Blindly following things you find on the Internet is not a path to success. :)
I am writing my own howto, and I would like to think I am doing a better job of it.
You may consider whether your own depth of understanding is sufficient to improve the situation, or whether you are simply adding more noise. I wish you luck in any case.
Not completely. I 'program' in English writing standards like IEEE 802.1AR, 802.15.9, and RFCs. I have not really programmed since the mid-80s with 'B'.
I leave the converting of our carefully worded standards to executables to others.... :)
We all have our own areas of expertise. Nothing wrong with that.
That said, is this what you are advising:
Not precisely. You want to remove the 'else' in there, as the clause you have will do the opposite of what you intend. Also note that I removed your superfluous square brackets.
require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; } if header :contains "subject" "***SPAM***" { fileinto "Spam"; }
The best way to work with this is to start with simple rules on an individual client. Once you get a rule set that works, then you can move on to compiling it for the system. Always start as simple as possible though, and only add to it if your simple thing does not work. This is a pretty good tutorial on the syntax and options for Sieve. Given your intended purpose you should pay special attention to the 'create' modifier for 'fileinto'. Also, I would accomplish both things in the same rule using 'anyof' which should be slightly more efficient (which could make a big difference to server load depending on how many users you are supporting). https://support.tigertech.net/sieve hope this helps, Doug
On 03/17/2017 12:07 AM, Doug Barton wrote:
On 03/16/2017 11:50 PM, Robert Moskowitz wrote:
Doug,
On 03/16/2017 11:23 PM, Doug Barton wrote:
Your pattern seems a little too complicated. See below.
I acquired this script from:
http://www.campworld.net/thewiki/pmwiki.php/LinuxServersCentOS/Cent6VirtMail...
No telling where he got it from. So I greatly appreciate any and all advice.
Blindly following things you find on the Internet is not a path to success. :)
That is why I am here asking questions. Like I have done on the postfix, apache, openssl, amavis, and roundcubemail lists (and of course centos, centos-arm, and fedora). With BIND, I just sit down with Mark at IETF meetings :) Going to be doing that with Rich and openssl, as I want to start working with EDDSA certs, as does he.
I am writing my own howto, and I would like to think I am doing a better job of it.
You may consider whether your own depth of understanding is sufficient to improve the situation, or whether you are simply adding more noise. I wish you luck in any case.
Lots of the examples out there say, "use this conf file rather than the one in the package". I learned with postfix NOT to do that, but to use their postconf tool. So I have been brushing up on my SED skills to write SED commands to make the desired changes to the provided files. Once I test out the dovecot conf mods that they are working as I want I will post them here.
Not completely. I 'program' in English writing standards like IEEE 802.1AR, 802.15.9, and RFCs. I have not really programmed since the mid-80s with 'B'.
I leave the converting of our carefully worded standards to executables to others.... :)
We all have our own areas of expertise. Nothing wrong with that.
I once knew some AWK (back around '93 on SunOS), but that skill is long gone, and SED is not so hard to learn. Lots of guidance if you google a bit. Then test, test, test!
That said, is this what you are advising:
Not precisely. You want to remove the 'else' in there, as the clause you have will do the opposite of what you intend.
I thought so, but was not sure what you were advising me. Yet another reason to post a reply, "do I got it now", "no you don't" ;)
Also note that I removed your superfluous square brackets.
require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; } if header :contains "subject" "***SPAM***" { fileinto "Spam"; }
Thanks
The best way to work with this is to start with simple rules on an individual client. Once you get a rule set that works, then you can move on to compiling it for the system. Always start as simple as possible though, and only add to it if your simple thing does not work.
This is a pretty good tutorial on the syntax and options for Sieve. Given your intended purpose you should pay special attention to the 'create' modifier for 'fileinto'. Also, I would accomplish both things in the same rule using 'anyof' which should be slightly more efficient (which could make a big difference to server load depending on how many users you are supporting).
Particularly since this is a duo core armv7 (CubieTruck) that I am working with. I would really want to get one of the newer quad cores, so that amavis/clamav/spamassin could eat up 2 of them, and still have 2 left for postfix, dovecot, and other processes. I don't like the armv8 so far as they are 12V and ready power supplies just aren't out there like 5V for the armv7; plus they are still pricey. But armv8 is 64bit... See: http://medon.htt-consult.com/images/cubietower-3.JPG medon is the top server. It is a simple web server running Centos7-arm: http://medon.htt-consult.com/Centos7-armv7.html onlo is the bottom one, and it is my DNS outward master server. ROI replacing a bunch of intel SFFs like the one on the left was 18 months on power savings.
https://support.tigertech.net/sieve
hope this helps,
Yes it does. I have been reading a lot, recently! Bob
On 03/17/2017 12:07 AM, Doug Barton wrote:
Not precisely. You want to remove the 'else' in there, as the clause you have will do the opposite of what you intend. Also note that I removed your superfluous square brackets.
require "fileinto"; if header :contains "X-Spam-Flag" "YES" { fileinto "Spam"; } if header :contains "subject" "***SPAM***" { fileinto "Spam"; }
This is a pretty good tutorial on the syntax and options for Sieve. Given your intended purpose you should pay special attention to the 'create' modifier for 'fileinto'. Also, I would accomplish both things in the same rule using 'anyof' which should be slightly more efficient (which could make a big difference to server load depending on how many users you are supporting).
Reading this and 'man sievec'... Here is how I have modified your script above: require "fileinto"; if anyof ( header :contains "X-Spam-Flag" "YES", header :contains "subject" "***SPAM***" ) { fileinto "Spam"; } And for sievec, I still use: sieve_before = /home/sieve/globalfilter.sieve dovecot will find the /home/sieve/globalfilter.svbin and proceed with that. I don't have to specify the svbin in the sieve_before option. thanks Bob
participants (4)
-
chaouche yacine
-
Doug Barton
-
Robert Moskowitz
-
Stephan Bosch