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/Cent6VirtMailServer 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/Cent6VirtMailServer > > > 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 <dougb at dougbarton.us> 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/Cent6VirtMailServer > > > 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/Cent6VirtMailServer >> >> >> >> 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). > > https://support.tigertech.net/sieveReading 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