Bug 6297 - 'nopublish' rules should not end up in tarballs or online updates
Summary: 'nopublish' rules should not end up in tarballs or online updates
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: 3.3.0
Hardware: All All
: P2 major
Target Milestone: 3.3.2
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard: needs investigation
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-20 06:48 UTC by Mark Martinec
Modified: 2011-06-27 21:51 UTC (History)
4 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status
Make KHOP_HELO_BOT nopublish, remove from active.list patch None Warren Togami [HasCLA]
mkrules_nopublish.t patch None Justin Mason [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Martinec 2010-01-20 06:48:34 UTC
Rules with a 'nopublish' tflag should not end up in published rules tarballs,
nor in on-line available sa-updates:

$ cd /var/db/spamassassin/3.003000.NET/updates_spamassassin_org
$ grep nopublish *.cf
72_active.cf:tflags      T_KHOP_BOTNET_2        nopublish

$ cd /var/db/spamassassin/3.003000.TAR/updates_spamassassin_org
$ grep nopublish *.cf
72_active.cf:tflags T_KHOP_BOTNET_2        nopublish
72_active.cf:tflags __RCVD_IN_ANBREP          net nopublish
72_active.cf:tflags __RCVD_IN_ANBREP_F          net nopublish
Comment 1 Justin Mason 2010-01-20 08:12:01 UTC
looks like this will block the 3.3.0 recut.
Comment 2 Warren Togami 2010-01-20 11:35:14 UTC
I figured out how it got into the tarball, but not the sa-update channel.

I fixed this issue in svn right before the 3.3.0 cut.  Unfortunately the nightly auto-promote did not remove those __* rules from rules/active.list.  It seems anything listed in active.list goes into the rules tarball.  Subsequent auto-promotions cleaned it up from active.list so it was no longer an issue.

So we can safely cut the 3.3.0 release after verifying that rules/active.list contains what we want.

Leave this bug open to add further safeties to the update_stable scripts after 3.3.0.
Comment 3 Warren Togami 2010-01-20 13:59:42 UTC
T_KHOP_BOTNET_2 is a separate issue from ANBREP.

72_active.cf:meta	 KHOP_HELO_BOT	__HELO_NO_DOMAIN && T_KHOP_BOTNET_2
72_active.cf:describe KHOP_HELO_BOT	Suspect botnet sender claims no domain name

rulesrc/sandbox/khopesh/20_khop_general.cf:
meta     KHOP_HELO_BOT  __HELO_NO_DOMAIN && KHOP_BOTNET_2
describe KHOP_HELO_BOT  Suspect botnet sender claims no domain name

rulesrc/sandbox/khopesh/20_s25r.cf:
meta     KHOP_BOTNET_2  __LAST_EXTERNAL_RELAY_NO_AUTH && !(__FROM_FREEMAIL || __NOT_SPOOFED || __GREYLISTED) && (__S25R_3 || __S25R_4 || __S25R_5 || __S25R_6 || (RDNS_DYNAMIC + __S25R_1 + __S25R_2) > 1)
describe KHOP_BOTNET_2  Relay looks like a dynamic address
tflags   KHOP_BOTNET_2  nopublish

rules/active.list:
# good enough
KHOP_HELO_BOT

KHOP_HELO_BOT was auto-promoted, but it relies upon KHOP_BOTNET_2 which is marked as nopublish in khopesh's sandbox.  The active.list and meta boolean appear to be forcing T_KHOP_BOTNET_2 to be an active rule despite nopublish?

It appears the safest thing we can do now is switch KHOP_HELO_BOT to nopublish, remove it from rules/active.list.  Then we should be able to safely cut the 3.3.0.  We can decide if it is a good idea to enable KHOP_HELO_BOT and an appropriate score later.

Any objections?

This does suggest there is a bug having to do with auto-promotion, where auto-promote forcefully publishes a meta boolean dependent rule even if that dependency is nopublish.  Let us solve this for 3.3.1.
Comment 4 Warren Togami 2010-01-20 14:09:53 UTC
Created attachment 4654 [details]
Make KHOP_HELO_BOT nopublish, remove from active.list

Trivial patch.  Any objections?

I suspect with this patch and perhaps Bug #6295 we can safely cut 3.3.0.
Comment 5 Sidney Markowitz 2010-01-20 14:13:17 UTC
+1 on the patch, in case it needs a vote
Comment 6 Warren Togami 2010-01-20 14:39:18 UTC
Sending        rules/active.list
Sending        rulesrc/sandbox/khopesh/20_khop_general.cf
Transmitting file data ..
Committed revision 901410.

ANBREP and T_KHOP_BOTNET_2 now removed from active.list.  It should now be safe to cut 3.3.0.
Comment 7 Justin Mason 2010-01-20 15:15:14 UTC
so a recut now will avoid the ANBREP rules issue entirely?

btw, rule changes do not require votes, and +1 on the patch anyway ;)
Comment 8 Justin Mason 2010-01-20 15:46:15 UTC
Created attachment 4655 [details]
mkrules_nopublish.t

here's a test script that exercises this bug.  I haven't been able to fix the issue though -- mkrules currently doesn't understand "nopublish" in itself -- the rules/active.list generator does -- but I think it does.
Comment 9 Justin Mason 2010-01-27 02:21:12 UTC
moving most remaining 3.3.0 bugs to 3.3.1 milestone
Comment 10 Justin Mason 2010-01-27 03:16:47 UTC
reassigning, too
Comment 11 Paul Fisher 2010-02-24 01:47:53 UTC
nopublish rules for online updates that involve network traffic are particularly bad.  The current UPDATE version 912513 contains 22 nopublish rules, 14 of which are net rules -- including new DNSBLs like T_RCVD_IN_NIX_SPAM that result in additional DNS traffic.  Perhaps the recommendation should be for sa-update to be disabled until this bug is fixed.

As a large site, we keep external DNS traffic to an absolute minimum and rely on DNSBLs that are served up locally via rbldnsd to keep reasonable scantimes and not flood unsuspecting DNSBLs.
Comment 12 Daryl C. W. O'Shea 2010-02-24 01:58:56 UTC
(In reply to comment #11)
> nopublish rules for online updates that involve network traffic are
> particularly bad.  The current UPDATE version 912513 contains 22 nopublish
> rules, 14 of which are net rules -- including new DNSBLs like

Ick.  I wasn't aware of this.  I saw a couple of comments via email that said "I fixed this" but it appears that it wasn't fixed, just worked around for a single day.

> T_RCVD_IN_NIX_SPAM that result in additional DNS traffic.  Perhaps the
> recommendation should be for sa-update to be disabled until this bug is fixed.

No, please don't promote that people should disable sa-update.  If people do, we won't be able to get the rules revoked by a subsequent update.

I'm looking into this now.

> As a large site, we keep external DNS traffic to an absolute minimum and rely
> on DNSBLs that are served up locally via rbldnsd to keep reasonable scantimes
> and not flood unsuspecting DNSBLs.

Hmm.  I'm not yet sure how to best handle this.  We want to be able to push out new DNSBLs via updates, but I completely understand (and live) your situation.
Comment 13 Paul Fisher 2010-02-24 02:14:57 UTC
(In reply to comment #12)
> Hmm.  I'm not yet sure how to best handle this.  We want to be able to push out
> new DNSBLs via updates, but I completely understand (and live) your situation.

This hasn't been a significant issue in the past, since the DNSBLs in SpamAssassin have been rather static.  I believe most production DNSBLs in SA know that they'll be receiving a lot of traffic, perhaps from large sites that haven't yet disabled or modified the default rules.  If adding new DNSBLs becomes common in SA online updates, we'll likely just script a system where we're notified of additions.
Comment 14 Daryl C. W. O'Shea 2010-02-24 03:59:57 UTC
(In reply to comment #13)
> If adding new DNSBLs
> becomes common in SA online updates, we'll likely just script a system where
> we're notified of additions.

Yeah, I pondering if there's something we can do for people who don't bother to try and detect new DNSBLs but shouldn't be querying public name servers.  Maybe there needs to be a config option to signify if you're someone who can or can not use public name servers.

Any who... I've committed what is probably a dirty hack to build/mkrules to avoid publishing these nopublish rules.

[dos@cyan trunk]$ svn ci -m 'bug 6297: HACK? prevent rules with "tflags nopublish" from appearing in 72_active.cf; note that this needs testing to see what happens if a meta rule does something like "&& !$rule", where $rule has tflags no publish'
Sending        build/mkrules
Transmitting file data .
Committed revision 915656.
Comment 15 Justin Mason 2010-03-02 09:56:45 UTC
(In reply to comment #14)
> Any who... I've committed what is probably a dirty hack to build/mkrules to
> avoid publishing these nopublish rules.
> 
> [dos@cyan trunk]$ svn ci -m 'bug 6297: HACK? prevent rules with "tflags
> nopublish" from appearing in 72_active.cf; note that this needs testing to see
> what happens if a meta rule does something like "&& !$rule", where $rule has
> tflags no publish'
> Sending        build/mkrules
> Transmitting file data .
> Committed revision 915656.

this came up yesterday with FORM_FRAUD_3 et al in rulesrc/sandbox/jhardin/20_lotsa_money.cf , which was a meta rule depending on a "tflags nopublish" rule.  t/basic_meta.t caught it, so we can detect it.
Comment 16 Justin Mason 2010-03-02 11:17:30 UTC
: 103...; svn commit -m "add more linting to the mkupdates sanity test stage, using the t/basic*.t t
est cases.  will catch 'tflags nopublish' leakage, bug 6297" build/mkupdates/                       
Sending        build/mkupdates/run_part2
Transmitting file data .
Committed revision 917941.



With this change, updates will not build if there's a "tflags nopublish" rule in the output.  moving this down the priority list as the key issue is now resolved, it's just a matter of finding a cleaner (ie. in mkrules) way to do it.
Comment 17 Justin Mason 2010-03-04 00:30:55 UTC
> With this change, updates will not build if there's a "tflags nopublish" rule
> in the output.  moving this down the priority list as the key issue is now
> resolved, it's just a matter of finding a cleaner (ie. in mkrules) way to do
> it.

I was wrong -- there's now a different script generating 3.3.x updates, /home/updatesd/svn/mkupdates-with-scores/mkupdate-with-scores ,  so this change needs to be merged into that too :(  bumping back up priority.
Comment 18 Justin Mason 2010-03-12 14:34:28 UTC
this doesn't need to block 3.3.1.  it's an ongoing issue, not release-related.
Comment 19 Justin Mason 2010-03-23 16:34:04 UTC
moving all open 3.3.1 bugs to 3.3.2
Comment 20 Karsten Bräckelmann 2010-03-23 17:43:05 UTC
Moving back off of Security, which got changed by accident during the mass Target Milestone move.
Comment 21 Warren Togami 2010-12-28 02:56:22 UTC
Comment #14 said:
> Any who... I've committed what is probably a dirty hack to build/mkrules to
> avoid publishing these nopublish rules.

> [dos@cyan trunk]$ svn ci -m 'bug 6297: HACK? prevent rules with "tflags
> nopublish" from appearing in 72_active.cf; note that this needs testing to see
> what happens if a meta rule does something like "&& !$rule", where $rule has
> tflags no publish'
> Sending        build/mkrules
> Transmitting file data .
> Committed revision 915656.

Apparently this hack had the unpleasant side-effect of also removing certain rules from 70_sandbox.cf, meaning they are no longer in the masscheck.  This was filed as Bug #6527.
Comment 22 Kevin A. McGrail 2011-06-27 21:37:25 UTC
First pass considered resolved and the rest is a duplicate of bug 6527 where there is more information
Comment 23 Warren Togami 2011-06-27 21:49:28 UTC
(In reply to comment #22)
> First pass considered resolved and the rest is a duplicate of bug 6527 where
> there is more information

No, bug 6527 is an unwanted side-effect of the hack added in comment #14 here.  It seems the original problem of THIS bug was never fixed.
Comment 24 Kevin A. McGrail 2011-06-27 21:51:25 UTC
(In reply to comment #23)
> (In reply to comment #22)
> > First pass considered resolved and the rest is a duplicate of bug 6527 where
> > there is more information
> 
> No, bug 6527 is an unwanted side-effect of the hack added in comment #14 here. 
> It seems the original problem of THIS bug was never fixed.

The cf file in question was NOT marked nopublish. I have updated it as such and confirmed that make build_rules does not include it.  This bug is resolved though the related bug that 70_sandbox.cf is not correct in bug 6527 is very valid.