You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/01/25 14:03:53 UTC
svn commit: r499778 - in /spamassassin/trunk/lib/Mail/SpamAssassin: Conf.pm
Plugin/WLBLEval.pm
Author: jm
Date: Thu Jan 25 05:03:52 2007
New Revision: 499778
URL: http://svn.apache.org/viewvc?view=rev&rev=499778
Log:
bug 5304: move documentation for whitelist_from, whitelist_from_rcvd, unwhitelist_from, def_whitelist_from_rcvd, whitelist_allows_relays, unwhitelist_from_rcvd, blacklist_from, unblacklist_from, whitelist_to, more_spam_to, all_spam_to, and blacklist_to, back to Conf.pm from Mail/SpamAssassin/Plugin/WLBLEval.pm -- since they are basic config settings, frequently used by endusers and documentation needs to be easily accessible.
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm?view=diff&rev=499778&r1=499777&r2=499778
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm Thu Jan 25 05:03:52 2007
@@ -266,8 +266,296 @@
}
});
-# TODO: this should go into 'WHITELIST AND BLACKLIST OPTIONS' when
-# bug 5304 is fixed
+=head2 WHITELIST AND BLACKLIST OPTIONS
+
+=over 4
+
+=item whitelist_from add@ress.com
+
+Used to specify addresses which send mail that is often tagged (incorrectly) as
+spam. If you want to whitelist your own domain, be aware that spammers will
+often impersonate the domain of the recipient. The recommended solution is to
+instead use C<whitelist_from_rcvd> as explained below.
+
+Whitelist and blacklist addresses are now file-glob-style patterns, so
+C<fr...@somewhere.com>, C<*...@isp.com>, or C<*.domain.net> will all work.
+Specifically, C<*> and C<?> are allowed, but all other metacharacters are not.
+Regular expressions are not used for security reasons.
+
+Multiple addresses per line, separated by spaces, is OK. Multiple
+C<whitelist_from> lines is also OK.
+
+The headers checked for whitelist addresses are as follows: if C<Resent-From>
+is set, use that; otherwise check all addresses taken from the following
+set of headers:
+
+ Envelope-Sender
+ Resent-Sender
+ X-Envelope-From
+ From
+
+In addition, the "envelope sender" data, taken from the SMTP envelope
+data where this is available, is looked up.
+
+e.g.
+
+ whitelist_from joe@example.com fred@example.com
+ whitelist_from *@example.com
+
+=cut
+
+ push (@cmds, {
+ setting => 'whitelist_from',
+ type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
+ });
+
+=item unwhitelist_from add@ress.com
+
+Used to override a default whitelist_from entry, so for example a distribution
+whitelist_from can be overridden in a local.cf file, or an individual user can
+override a whitelist_from entry in their own C<user_prefs> file.
+The specified email address has to match exactly the address previously
+used in a whitelist_from line.
+
+e.g.
+
+ unwhitelist_from joe@example.com fred@example.com
+ unwhitelist_from *@example.com
+
+=cut
+
+ push (@cmds, {
+ command => 'unwhitelist_from',
+ setting => 'whitelist_from',
+ code => \&Mail::SpamAssassin::Conf::Parser::remove_addrlist_value
+ });
+
+=item whitelist_from_rcvd addr@lists.sourceforge.net sourceforge.net
+
+Use this to supplement the whitelist_from addresses with a check against the
+Received headers. The first parameter is the address to whitelist, and the
+second is a string to match the relay's rDNS.
+
+This string is matched against the reverse DNS lookup used during the handover
+from the internet to your internal network's mail exchangers. It can
+either be the full hostname, or the domain component of that hostname. In
+other words, if the host that connected to your MX had an IP address that
+mapped to 'sendinghost.spamassassin.org', you should specify
+C<sendinghost.spamassassin.org> or just C<spamassassin.org> here.
+
+Note that this requires that C<internal_networks> be correct. For simple cases,
+it will be, but for a complex network, or running with DNS checks off
+or with C<-L>, you may get better results by setting that parameter.
+
+e.g.
+
+ whitelist_from_rcvd joe@example.com example.com
+ whitelist_from_rcvd *@axkit.org sergeant.org
+
+=item def_whitelist_from_rcvd addr@lists.sourceforge.net sourceforge.net
+
+Same as C<whitelist_from_rcvd>, but used for the default whitelist entries
+in the SpamAssassin distribution. The whitelist score is lower, because
+these are often targets for spammer spoofing.
+
+=cut
+
+ push (@cmds, {
+ setting => 'whitelist_from_rcvd',
+ code => sub {
+ my ($self, $key, $value, $line) = @_;
+ unless (defined $value && $value !~ /^$/) {
+ return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
+ }
+ unless ($value =~ /^\S+\s+\S+$/) {
+ return $Mail::SpamAssassin::Conf::INVALID_VALUE;
+ }
+ $self->{parser}->add_to_addrlist_rcvd ('whitelist_from_rcvd',
+ split(/\s+/, $value));
+ }
+ });
+
+ push (@cmds, {
+ setting => 'def_whitelist_from_rcvd',
+ code => sub {
+ my ($self, $key, $value, $line) = @_;
+ unless (defined $value && $value !~ /^$/) {
+ return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
+ }
+ unless ($value =~ /^\S+\s+\S+$/) {
+ return $Mail::SpamAssassin::Conf::INVALID_VALUE;
+ }
+ $self->{parser}->add_to_addrlist_rcvd ('def_whitelist_from_rcvd',
+ split(/\s+/, $value));
+ }
+ });
+
+=item whitelist_allows_relays add@ress.com
+
+Specify addresses which are in C<whitelist_from_rcvd> that sometimes
+send through a mail relay other than the listed ones. By default mail
+with a From address that is in C<whitelist_from_rcvd> that does not match
+the relay will trigger a forgery rule. Including the address in
+C<whitelist_allows_relay> prevents that.
+
+Whitelist and blacklist addresses are now file-glob-style patterns, so
+C<fr...@somewhere.com>, C<*...@isp.com>, or C<*.domain.net> will all work.
+Specifically, C<*> and C<?> are allowed, but all other metacharacters are not.
+Regular expressions are not used for security reasons.
+
+Multiple addresses per line, separated by spaces, is OK. Multiple
+C<whitelist_allows_relays> lines is also OK.
+
+The specified email address does not have to match exactly the address
+previously used in a whitelist_from_rcvd line as it is compared to the
+address in the header.
+
+e.g.
+
+ whitelist_allows_relays joe@example.com fred@example.com
+ whitelist_allows_relays *@example.com
+
+=cut
+
+ push (@cmds, {
+ setting => 'whitelist_allows_relays',
+ type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
+ });
+
+=item unwhitelist_from_rcvd add@ress.com
+
+Used to override a default whitelist_from_rcvd entry, so for example a
+distribution whitelist_from_rcvd can be overridden in a local.cf file,
+or an individual user can override a whitelist_from_rcvd entry in
+their own C<user_prefs> file.
+
+The specified email address has to match exactly the address previously
+used in a whitelist_from_rcvd line.
+
+e.g.
+
+ unwhitelist_from_rcvd joe@example.com fred@example.com
+ unwhitelist_from_rcvd *@axkit.org
+
+=cut
+
+ push (@cmds, {
+ setting => 'unwhitelist_from_rcvd',
+ code => sub {
+ my ($self, $key, $value, $line) = @_;
+ unless (defined $value && $value !~ /^$/) {
+ return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
+ }
+ unless ($value =~ /^(?:\S+(?:\s+\S+)*)$/) {
+ return $Mail::SpamAssassin::Conf::INVALID_VALUE;
+ }
+ $self->{parser}->remove_from_addrlist_rcvd('whitelist_from_rcvd',
+ split (/\s+/, $value));
+ $self->{parser}->remove_from_addrlist_rcvd('def_whitelist_from_rcvd',
+ split (/\s+/, $value));
+ }
+ });
+
+=item blacklist_from add@ress.com
+
+Used to specify addresses which send mail that is often tagged (incorrectly) as
+non-spam, but which the user doesn't want. Same format as C<whitelist_from>.
+
+=cut
+
+ push (@cmds, {
+ setting => 'blacklist_from',
+ type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
+ });
+
+=item unblacklist_from add@ress.com
+
+Used to override a default blacklist_from entry, so for example a
+distribution blacklist_from can be overridden in a local.cf file, or
+an individual user can override a blacklist_from entry in their own
+C<user_prefs> file. The specified email address has to match exactly
+the address previously used in a blacklist_from line.
+
+
+e.g.
+
+ unblacklist_from joe@example.com fred@example.com
+ unblacklist_from *@spammer.com
+
+=cut
+
+
+ push (@cmds, {
+ command => 'unblacklist_from',
+ setting => 'blacklist_from',
+ code => \&Mail::SpamAssassin::Conf::Parser::remove_addrlist_value
+ });
+
+
+=item whitelist_to add@ress.com
+
+If the given address appears as a recipient in the message headers
+(Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will
+be whitelisted. Useful if you're deploying SpamAssassin system-wide,
+and don't want some users to have their mail filtered. Same format
+as C<whitelist_from>.
+
+There are three levels of To-whitelisting, C<whitelist_to>, C<more_spam_to>
+and C<all_spam_to>. Users in the first level may still get some spammish
+mails blocked, but users in C<all_spam_to> should never get mail blocked.
+
+The headers checked for whitelist addresses are as follows: if C<Resent-To> or
+C<Resent-Cc> are set, use those; otherwise check all addresses taken from the
+following set of headers:
+
+ To
+ Cc
+ Apparently-To
+ Delivered-To
+ Envelope-Recipients
+ Apparently-Resent-To
+ X-Envelope-To
+ Envelope-To
+ X-Delivered-To
+ X-Original-To
+ X-Rcpt-To
+ X-Real-To
+
+=item more_spam_to add@ress.com
+
+See above.
+
+=item all_spam_to add@ress.com
+
+See above.
+
+=cut
+
+ push (@cmds, {
+ setting => 'whitelist_to',
+ type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
+ });
+ push (@cmds, {
+ setting => 'more_spam_to',
+ type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
+ });
+ push (@cmds, {
+ setting => 'all_spam_to',
+ type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
+ });
+
+=item blacklist_to add@ress.com
+
+If the given address appears as a recipient in the message headers
+(Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will
+be blacklisted. Same format as C<blacklist_from>.
+
+=cut
+
+ push (@cmds, {
+ setting => 'blacklist_to',
+ type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
+ });
=item whitelist_auth add@ress.com
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm?view=diff&rev=499778&r1=499777&r2=499778
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm Thu Jan 25 05:03:52 2007
@@ -50,307 +50,7 @@
$self->register_eval_rule("check_from_in_default_whitelist");
$self->register_eval_rule("check_forged_in_default_whitelist");
- $self->set_config($mailsaobject->{conf});
-
return $self;
-}
-
-sub set_config {
- my ($self, $conf) = @_;
- my @cmds = ();
-
-=head2 WHITELIST AND BLACKLIST OPTIONS
-
-=over 4
-
-=item whitelist_from add@ress.com
-
-Used to specify addresses which send mail that is often tagged (incorrectly) as
-spam. If you want to whitelist your own domain, be aware that spammers will
-often impersonate the domain of the recipient. The recommended solution is to
-instead use C<whitelist_from_rcvd> as explained below.
-
-Whitelist and blacklist addresses are now file-glob-style patterns, so
-C<fr...@somewhere.com>, C<*...@isp.com>, or C<*.domain.net> will all work.
-Specifically, C<*> and C<?> are allowed, but all other metacharacters are not.
-Regular expressions are not used for security reasons.
-
-Multiple addresses per line, separated by spaces, is OK. Multiple
-C<whitelist_from> lines is also OK.
-
-The headers checked for whitelist addresses are as follows: if C<Resent-From>
-is set, use that; otherwise check all addresses taken from the following
-set of headers:
-
- Envelope-Sender
- Resent-Sender
- X-Envelope-From
- From
-
-In addition, the "envelope sender" data, taken from the SMTP envelope
-data where this is available, is looked up.
-
-e.g.
-
- whitelist_from joe@example.com fred@example.com
- whitelist_from *@example.com
-
-=cut
-
- push (@cmds, {
- setting => 'whitelist_from',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
- });
-
-=item unwhitelist_from add@ress.com
-
-Used to override a default whitelist_from entry, so for example a distribution
-whitelist_from can be overridden in a local.cf file, or an individual user can
-override a whitelist_from entry in their own C<user_prefs> file.
-The specified email address has to match exactly the address previously
-used in a whitelist_from line.
-
-e.g.
-
- unwhitelist_from joe@example.com fred@example.com
- unwhitelist_from *@example.com
-
-=cut
-
- push (@cmds, {
- command => 'unwhitelist_from',
- setting => 'whitelist_from',
- code => \&Mail::SpamAssassin::Conf::Parser::remove_addrlist_value
- });
-
-=item whitelist_from_rcvd addr@lists.sourceforge.net sourceforge.net
-
-Use this to supplement the whitelist_from addresses with a check against the
-Received headers. The first parameter is the address to whitelist, and the
-second is a string to match the relay's rDNS.
-
-This string is matched against the reverse DNS lookup used during the handover
-from the internet to your internal network's mail exchangers. It can
-either be the full hostname, or the domain component of that hostname. In
-other words, if the host that connected to your MX had an IP address that
-mapped to 'sendinghost.spamassassin.org', you should specify
-C<sendinghost.spamassassin.org> or just C<spamassassin.org> here.
-
-Note that this requires that C<internal_networks> be correct. For simple cases,
-it will be, but for a complex network, or running with DNS checks off
-or with C<-L>, you may get better results by setting that parameter.
-
-e.g.
-
- whitelist_from_rcvd joe@example.com example.com
- whitelist_from_rcvd *@axkit.org sergeant.org
-
-=item def_whitelist_from_rcvd addr@lists.sourceforge.net sourceforge.net
-
-Same as C<whitelist_from_rcvd>, but used for the default whitelist entries
-in the SpamAssassin distribution. The whitelist score is lower, because
-these are often targets for spammer spoofing.
-
-=cut
-
- push (@cmds, {
- setting => 'whitelist_from_rcvd',
- code => sub {
- my ($self, $key, $value, $line) = @_;
- unless (defined $value && $value !~ /^$/) {
- return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
- }
- unless ($value =~ /^\S+\s+\S+$/) {
- return $Mail::SpamAssassin::Conf::INVALID_VALUE;
- }
- $self->{parser}->add_to_addrlist_rcvd ('whitelist_from_rcvd',
- split(/\s+/, $value));
- }
- });
-
- push (@cmds, {
- setting => 'def_whitelist_from_rcvd',
- code => sub {
- my ($self, $key, $value, $line) = @_;
- unless (defined $value && $value !~ /^$/) {
- return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
- }
- unless ($value =~ /^\S+\s+\S+$/) {
- return $Mail::SpamAssassin::Conf::INVALID_VALUE;
- }
- $self->{parser}->add_to_addrlist_rcvd ('def_whitelist_from_rcvd',
- split(/\s+/, $value));
- }
- });
-
-=item whitelist_allows_relays add@ress.com
-
-Specify addresses which are in C<whitelist_from_rcvd> that sometimes
-send through a mail relay other than the listed ones. By default mail
-with a From address that is in C<whitelist_from_rcvd> that does not match
-the relay will trigger a forgery rule. Including the address in
-C<whitelist_allows_relay> prevents that.
-
-Whitelist and blacklist addresses are now file-glob-style patterns, so
-C<fr...@somewhere.com>, C<*...@isp.com>, or C<*.domain.net> will all work.
-Specifically, C<*> and C<?> are allowed, but all other metacharacters are not.
-Regular expressions are not used for security reasons.
-
-Multiple addresses per line, separated by spaces, is OK. Multiple
-C<whitelist_allows_relays> lines is also OK.
-
-The specified email address does not have to match exactly the address
-previously used in a whitelist_from_rcvd line as it is compared to the
-address in the header.
-
-e.g.
-
- whitelist_allows_relays joe@example.com fred@example.com
- whitelist_allows_relays *@example.com
-
-=cut
-
- push (@cmds, {
- setting => 'whitelist_allows_relays',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
- });
-
-=item unwhitelist_from_rcvd add@ress.com
-
-Used to override a default whitelist_from_rcvd entry, so for example a
-distribution whitelist_from_rcvd can be overridden in a local.cf file,
-or an individual user can override a whitelist_from_rcvd entry in
-their own C<user_prefs> file.
-
-The specified email address has to match exactly the address previously
-used in a whitelist_from_rcvd line.
-
-e.g.
-
- unwhitelist_from_rcvd joe@example.com fred@example.com
- unwhitelist_from_rcvd *@axkit.org
-
-=cut
-
- push (@cmds, {
- setting => 'unwhitelist_from_rcvd',
- code => sub {
- my ($self, $key, $value, $line) = @_;
- unless (defined $value && $value !~ /^$/) {
- return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
- }
- unless ($value =~ /^(?:\S+(?:\s+\S+)*)$/) {
- return $Mail::SpamAssassin::Conf::INVALID_VALUE;
- }
- $self->{parser}->remove_from_addrlist_rcvd('whitelist_from_rcvd',
- split (/\s+/, $value));
- $self->{parser}->remove_from_addrlist_rcvd('def_whitelist_from_rcvd',
- split (/\s+/, $value));
- }
- });
-
-=item blacklist_from add@ress.com
-
-Used to specify addresses which send mail that is often tagged (incorrectly) as
-non-spam, but which the user doesn't want. Same format as C<whitelist_from>.
-
-=cut
-
- push (@cmds, {
- setting => 'blacklist_from',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
- });
-
-=item unblacklist_from add@ress.com
-
-Used to override a default blacklist_from entry, so for example a
-distribution blacklist_from can be overridden in a local.cf file, or
-an individual user can override a blacklist_from entry in their own
-C<user_prefs> file. The specified email address has to match exactly
-the address previously used in a blacklist_from line.
-
-
-e.g.
-
- unblacklist_from joe@example.com fred@example.com
- unblacklist_from *@spammer.com
-
-=cut
-
-
- push (@cmds, {
- command => 'unblacklist_from',
- setting => 'blacklist_from',
- code => \&Mail::SpamAssassin::Conf::Parser::remove_addrlist_value
- });
-
-
-=item whitelist_to add@ress.com
-
-If the given address appears as a recipient in the message headers
-(Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will
-be whitelisted. Useful if you're deploying SpamAssassin system-wide,
-and don't want some users to have their mail filtered. Same format
-as C<whitelist_from>.
-
-There are three levels of To-whitelisting, C<whitelist_to>, C<more_spam_to>
-and C<all_spam_to>. Users in the first level may still get some spammish
-mails blocked, but users in C<all_spam_to> should never get mail blocked.
-
-The headers checked for whitelist addresses are as follows: if C<Resent-To> or
-C<Resent-Cc> are set, use those; otherwise check all addresses taken from the
-following set of headers:
-
- To
- Cc
- Apparently-To
- Delivered-To
- Envelope-Recipients
- Apparently-Resent-To
- X-Envelope-To
- Envelope-To
- X-Delivered-To
- X-Original-To
- X-Rcpt-To
- X-Real-To
-
-=item more_spam_to add@ress.com
-
-See above.
-
-=item all_spam_to add@ress.com
-
-See above.
-
-=cut
-
- push (@cmds, {
- setting => 'whitelist_to',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
- });
- push (@cmds, {
- setting => 'more_spam_to',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
- });
- push (@cmds, {
- setting => 'all_spam_to',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
- });
-
-=item blacklist_to add@ress.com
-
-If the given address appears as a recipient in the message headers
-(Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will
-be blacklisted. Same format as C<blacklist_from>.
-
-=cut
-
- push (@cmds, {
- setting => 'blacklist_to',
- type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST
- });
-
- $conf->{parser}->register_commands(\@cmds);
}
sub check_from_in_blacklist {