Mail-SpamAssassin
view release on metacpan or search on metacpan
lib/Mail/SpamAssassin/BayesStore/Redis.pm view on Meta::CPAN
version 2.8.0 also IPv6 is supported. Bear in mind that Redis server only
offers limited access controls, so it is advisable to let the Redis server
bind to a loopback interface only, or to use other mechanisms to limit
access, such as local firewall rules.
The Redis backend for Bayes can put a Lua scripting support in a Redis
server to good use, improving performance. The Lua support is available
in Redis server since version 2.6. In absence of a Lua support, the Redis
backend uses batched (pipelined) traditional Redis commands, so it should
work with a Redis server version 2.4 (untested), although this is not
recommended for busy sites.
Expiration of token and 'seen' message id entries is left to the Redis
server. There is no provision for manually expiring a database, so it is
highly recommended to leave the setting bayes_auto_expire to its default
value 1 (i.e. enabled).
Example configuration:
bayes_store_module Mail::SpamAssassin::BayesStore::Redis
bayes_sql_dsn server=127.0.0.1:6379;password=foo;database=2
lib/Mail/SpamAssassin/Plugin/TxRep.pm view on Meta::CPAN
sender_reputation = weight_email * rep_email +
weight_email_ip * rep_email_ip +
weight_domain * rep_domain +
weight_ip * rep_ip +
weight_helo * rep_helo
You can disable the individual partial reputations by setting their respective
weight to zero. This will also reduce the size of the database, since each
partial reputation requires a separate entry in the database table. Disabling
some of the partial reputations in this way may also help with the performance
on busy servers, because the respective database lookups and processing will
be skipped too.
=over 4
=item B<txrep_weight_email>
range [0..10] (default: 3)
This weight factor controls the influence of the reputation of the standalone
email address, regardless of the originating IP address. When adjusting the
lib/Mail/SpamAssassin/SpamdForkScaling.pm view on Meta::CPAN
our $TEST_MODE_CAUSE_RANDOM_WRITE_RETRIES = 0;
# test instrumentation point: simulate ping failures (for unspecified
# reasons) once in every N pings
our $TEST_MODE_CAUSE_RANDOM_PING_FAILURES = 0;
###########################################################################
# we use the following protocol between the master and child processes to
# control when they accept/who accepts: server tells a child to accept with a
# PF_ACCEPT_ORDER, child responds with "B$pid\n" when it's busy, and "I$pid\n"
# once it's idle again. In addition, the parent sends PF_PING_ORDER
# periodically to ping the child processes. Very simple protocol. Note that
# the $pid values are packed into 4 bytes so that the buffers are always of a
# known length; if you need to transfer longer data, assign a new protocol verb
# (the first char) and use the length of the following data buffer as the
# packed value.
use constant PF_ACCEPT_ORDER => "A....\n";
use constant PF_PING_ORDER => "P....\n";
# timeout for a sysread() on the command channel. if we go this long
lib/Mail/SpamAssassin/SpamdForkScaling.pm view on Meta::CPAN
my ($self, $pid) = @_;
$self->{pid} = $pid; # save calling $$ all the time
}
sub update_child_status_idle {
my ($self) = @_;
# "I b1 b2 b3 b4 \n "
$self->report_backchannel_socket("I".pack("l",$self->{pid})."\n");
}
sub update_child_status_busy {
my ($self) = @_;
# "B b1 b2 b3 b4 \n "
$self->report_backchannel_socket("B".pack("l",$self->{pid})."\n");
}
sub report_backchannel_socket {
my ($self, $str) = @_;
my $sock = $self->{backchannel}->get_parent_socket();
$self->syswrite_with_retry($sock, $str, 'parent')
or die "syswrite() to parent failed: $!";
spamd/spamd.raw view on Meta::CPAN
}
sub accept_a_conn {
my ($timeout) = @_;
my $socket_info;
# $client is a global variable
($client, $socket_info) = accept_from_any_server_socket($timeout);
if ($scaling) {
$scaling->update_child_status_busy();
}
# Bah!
if ( !$client || !defined $client->connected() ) {
# this can happen when interrupted by SIGCHLD on Solaris,
# perl 5.8.0, and some other platforms with -m.
if ( $! == &Errno::EINTR ) {
return 0;
}
spamd/spamd.raw view on Meta::CPAN
Die on user errors (for the user passed from spamc) instead of falling back
to user C<--default-user> and using the default configuration.
=item B<-m> I<number> , B<--max-children>=I<number>
This option specifies the maximum number of children to spawn.
Spamd will spawn that number of children, then sleep in the background
until a child dies, wherein it will go and spawn a new child.
Incoming connections can still occur if all of the children are busy,
however those connections will be queued waiting for a free child.
The minimum value is C<1>, the default value is C<5>.
Please note that there is a OS specific maximum of connections that can be
queued (Try C<perl -MSocket -e'print SOMAXCONN'> to find this maximum).
Note that if you run too many servers for the amount of free RAM available, you
run the danger of hurting performance by causing a high swap load as server
processes are swapped in and out continually.
spamd/spamd.raw view on Meta::CPAN
=item B<--max-conn-per-child>=I<number>
This option specifies the maximum number of connections each child
should process before dying and letting the master spamd process spawn
a new child. The minimum value is C<1>, the default value is C<200>.
=item B<--round-robin>
By default, C<spamd> will attempt to keep a small number of "hot" child
processes as busy as possible, and keep any others as idle as possible, using
something similar to the Apache httpd server scaling algorithm. This is
accomplished by the master process coordinating the activities of the children.
This switch will disable this scaling algorithm, and the behaviour seen in
the 3.0.x versions will be used instead, where all processes receive an
equal load and no scaling takes place.
=item B<--timeout-tcp>=I<number>
This option specifies the number of seconds to wait for headers from a
client (spamc) before closing the connection. The minimum value is C<1>,
( run in 0.253 second using v1.01-cache-2.11-cpan-87723dcf8b7 )