Page 1 of 1
bypass string
Posted: 28 Mar 2018 22:30
by mattch
Is there a way to set a bypass string or code? Some string of characters within subject or body that allows a message to bypass spam checks.
Re: bypass string
Posted: 29 Mar 2018 13:34
by pdwalker
Why do you want to do that?
Why not whitelist the address if you want to avoid spam checks?
Or create a custom spamassassin rule to give your keywords a low spam score?
What problem are you really trying to solve?
Re: bypass string
Posted: 29 Mar 2018 14:22
by mattch
I have an EFA server that serves multiple remote domains. Periodically i need to send out test emails, usually the telnet test to test mail flow on the various remote mail servers. Occasionally i will tweak postfix settings and its annoying to do tests and they get flagged for spam. I have been white listing my email, but my to's and from's can change depending on the task at hand. I just found it cumbersome to make a white list entry for these tests. I guess i was spoiled with the barracuda allowing this feature.
Im going to play with spamassasin keywords to see if that can accomplish my goal. Thank you for the TIP, i will post my findings in case anyone else might be interested in that.

Re: bypass string
Posted: 29 Mar 2018 17:17
by pdwalker
Yes, then for that, the easiest solution is to create a custom spamassassin rule in your local spamassassin file.
You can add a magic word to your subject and give it a weight of -100 which will definitely pass the filter.
I’m not at a computer, so I can’t dig up one of my rules easily, but there are examples in the forums, or you can look at the existing rules under /var/lib/spamassassin/...
Let us know if you get it to work, or if you need help.
Re: bypass string
Posted: 02 Apr 2018 02:29
by mattch
I got it working, exactly what i wanted. THANKS!
a few things:
1) the file i added the rule to: /etc/mail/spamassasin/local.cf
added at end of file:
body BYPASS_RULE /thestringforbypass/
score BYPASS_RULE -100
describe BYPASS_RULE Bypass Rule
2) the describe description does not seem to show up but the rule does work
3) I read somewhere else that im supposed to run sa-update and sa-compile to get the rule working, however i just restart mailscanner and the rule starts working.
when should sa-update and sa-compile be ran and why?
Thanks again!!

Re: bypass string
Posted: 03 Apr 2018 03:18
by pdwalker
1/ correct place.
2/ to update the rule descriptions, go to "Tools and Links", and select "Update SpamAssassin Rule Descriptions" under the Tools section. You'll have to do this every time you add a new rule, or change a rule description.
3/ yeah, that's what I read, but I'm not sure what that is actually for. At a guess, I think it is for the rules in /var/lib/spamassassin/ You'll see two directories there, the source files and the "compiled" directly.
changes to local.cf seem to get picked up immediately.
Re: bypass string
Posted: 03 Apr 2018 08:12
by henk
when should sa-update and sa-compile be ran and why?
Normally this runs once a day: /etc/cron.daily/mailscanner (/usr/sbin/ms-cron DAILY -> ms-update-sa)
When you add or update rules, you can add them to the generated compiled rules which speeds up SpamAssassin
https://spamassassin.apache.org/full/3. ... ompile.txt
Code: Select all
spamassassin -D --lint 2>&1 | grep compile
...
Apr 3 10:03:33.563 [18087] dbg: zoom: loading compiled ruleset from /var/lib/spamassassin/compiled/5.010/3.004001
Apr 3 10:03:33.569 [18087] dbg: zoom: using compiled ruleset in /var/lib/spamassassin/compiled/5.010/3.004001/Mail/SpamAssassin/CompiledRegexps/body_0.pm for Mail::SpamAssassin::CompiledRegexps::body_0
Apr 3 10:03:33.574 [18087] dbg: zoom: skipping rule __KAM_COMPROMISED3, code differs in compiled ruleset
Apr 3 10:03:33.577 [18087] dbg: zoom: able to use 1058/1059 'body_0' compiled rules (99.905%)
Apr 3 10:03:33.625 [18087] dbg: rules: compiled one_line_body tests
....
Re: bypass string
Posted: 03 Apr 2018 08:54
by pdwalker
useful tip henk, thanks!