spamassassin (cmd line) connection to Redis

2014-05-22 Thread Matteo Dessalvi

Hi all.

As stated in the subject I am just trying to test my
SpamAssassin 3.4.0 installation (I am using the Debian
Jessie package), with the usual method described here:

http://wiki.apache.org/spamassassin/TestingInstallation

In the output of the command: spamassassin -D  gTube_spam.txt
I have got the following error:

(...)
May 22 12:31:39.240 [8390] warn: plugin: eval failed: bayes: Redis
failed: Redis error: ERR operation not permitted at /usr/share/perl5
/Mail/SpamAssassin/BayesStore/Redis.pm line 233, GEN2 line 1. at
/usr/share/perl5/Mail/SpamAssassin/BayesStore/Redis.pm line 265.
(...)

In the end the test have worked perfectly, because SA has
correctly classified the GTUBE spam sample but I am worried
about that Redis error.

The SA local.cf contains the following string:

bayes_sql_dsn   server=10.1.1.19:6379;password=mypass;database=2
(...)

which, I taught, should be enough for SA. Note that if
I am using the redis-cli from the command line, specifying
the same parameters, I did not have any connection/authorization
problem.

Looking for the line 233 stated in the error message, I found
that the error is raised inside the sub on_connect but it looks
like it's not a Redis authentication error.

Any clues about what I am doing wrong?
Thanks in advance!

Best regards,
Matteo


Re: spamassassin (cmd line) connection to Redis

2014-05-22 Thread Axb

On 05/22/2014 12:56 PM, Matteo Dessalvi wrote:

Hi all.

As stated in the subject I am just trying to test my
SpamAssassin 3.4.0 installation (I am using the Debian
Jessie package), with the usual method described here:

http://wiki.apache.org/spamassassin/TestingInstallation

In the output of the command: spamassassin -D  gTube_spam.txt
I have got the following error:

(...)
May 22 12:31:39.240 [8390] warn: plugin: eval failed: bayes: Redis
failed: Redis error: ERR operation not permitted at /usr/share/perl5
/Mail/SpamAssassin/BayesStore/Redis.pm line 233, GEN2 line 1. at
/usr/share/perl5/Mail/SpamAssassin/BayesStore/Redis.pm line 265.
(...)

In the end the test have worked perfectly, because SA has
correctly classified the GTUBE spam sample but I am worried
about that Redis error.

The SA local.cf contains the following string:

bayes_sql_dsn   server=10.1.1.19:6379;password=mypass;database=2
(...)

which, I taught, should be enough for SA. Note that if
I am using the redis-cli from the command line, specifying
the same parameters, I did not have any connection/authorization
problem.

Looking for the line 233 stated in the error message, I found
that the error is raised inside the sub on_connect but it looks
like it's not a Redis authentication error.

Any clues about what I am doing wrong?
Thanks in advance!


have you included this in your local.cf ?

bayes_store_module  Mail::SpamAssassin::BayesStore::Redis



Re: spamassassin (cmd line) connection to Redis

2014-05-22 Thread Axb

On 05/22/2014 12:56 PM, Matteo Dessalvi wrote:

Hi all.

As stated in the subject I am just trying to test my
SpamAssassin 3.4.0 installation (I am using the Debian
Jessie package), with the usual method described here:

http://wiki.apache.org/spamassassin/TestingInstallation

In the output of the command: spamassassin -D  gTube_spam.txt
I have got the following error:

(...)
May 22 12:31:39.240 [8390] warn: plugin: eval failed: bayes: Redis
failed: Redis error: ERR operation not permitted at /usr/share/perl5
/Mail/SpamAssassin/BayesStore/Redis.pm line 233, GEN2 line 1. at
/usr/share/perl5/Mail/SpamAssassin/BayesStore/Redis.pm line 265.
(...)

In the end the test have worked perfectly, because SA has
correctly classified the GTUBE spam sample but I am worried
about that Redis error.

The SA local.cf contains the following string:

bayes_sql_dsn   server=10.1.1.19:6379;password=mypass;database=2
(...)

which, I taught, should be enough for SA. Note that if
I am using the redis-cli from the command line, specifying
the same parameters, I did not have any connection/authorization
problem.

Looking for the line 233 stated in the error message, I found
that the error is raised inside the sub on_connect but it looks
like it's not a Redis authentication error.

Any clues about what I am doing wrong?
Thanks in advance!


what happens if you don't use authentication?



Re: spamassassin (cmd line) connection to Redis

2014-05-22 Thread Matteo Dessalvi

On 22.05.2014 13:10, Axb wrote:

have you included this in your local.cf ?

bayes_store_module  Mail::SpamAssassin::BayesStore::Redis


These are the relevant configuration lines for the
Redis SA module:

bayes_store_module  Mail::SpamAssassin::BayesStore::Redis
bayes_sql_dsn   server=10.1.1.19:6379;password=mypass;database=2
bayes_token_ttl 21d
bayes_seen_ttl   8d
bayes_auto_expire 1


On 22.05.2014 13:12, Axb wrote:


what happens if you don't use authentication?



It looks like the problem lies in the authentication.
When I have tried with an empty 'password=' (after
disabling the requirepass in the redis.conf) I have
got the following messages: (I have included empty
lines for the sake of readbility):

(...)
dbg: bayes: learner_new 
self=Mail::SpamAssassin::Plugin::Bayes=HASH(0x3cc14c0), 
bayes_store_module=Mail::SpamAssassin::BayesStore::Redis


dbg: bayes: learner_new: got 
store=Mail::SpamAssassin::BayesStore::Redis=HASH(0x42161c0)


dbg: plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x3cc14c0) 
implements 'learner_is_scan_available', priority 0


dbg: bayes: _open_db(not yet connected)

dbg: bayes: Redis on-connect, db_id 2

dbg: bayes: CLIENT SETNAME command failed, don't worry, possibly an old 
redis version: ERR Syntax error, try CLIENT (LIST | KILL ip:port)


dbg: bayes: redis server version 2.4.14, memory used 6.8 MiB, Lua is not 
available


dbg: bayes: initialized empty database, version 3

dbg: bayes: nspam_nham_get nspam=0, nham=0

dbg: bayes: not available for scanning, only 0 spam(s) in bayes DB  200
(...)

Of course this is just the initial test, so I do not have enough
bayes data. The 'CLIENT SETNAME' error is probably due to my old
Redis version but other than that it looks fine.

I will try again with the authentication enabled and see if
I stumble in the same problem as before.

Best regards,
Matteo



Re: spamassassin (cmd line) connection to Redis

2014-05-22 Thread Axb

On 05/22/2014 02:06 PM, Matteo Dessalvi wrote:


dbg: bayes: redis server version 2.4.14, memory used 6.8 MiB, Lua is not
available


You're using an ancient Redis version with no LUA support.

Redis 2.8.9 is the latest stable version.

I'd suggest you update Redis before you go on chasing windmills.




Re: spamassassin (cmd line) connection to Redis

2014-05-22 Thread Matteo Dessalvi

Yes, you are definitely right: with the latest stable
Redis version (2.8.9 indeed) everything works smoothly
with the authentication.

Thanks for pointing me in the right direction!

Best regards,
Matteo

On 22.05.2014 14:10, Axb wrote:


You're using an ancient Redis version with no LUA support.

Redis 2.8.9 is the latest stable version.

I'd suggest you update Redis before you go on chasing windmills.




Re: spamassassin (cmd line) connection to Redis

2014-05-22 Thread Axb


On 05/22/2014 03:27 PM, Matteo Dessalvi wrote:

Yes, you are definitely right: with the latest stable
Redis version (2.8.9 indeed) everything works smoothly
with the authentication.

Thanks for pointing me in the right direction!

Best regards,
Matteo

On 22.05.2014 14:10, Axb wrote:


You're using an ancient Redis version with no LUA support.

Redis 2.8.9 is the latest stable version.

I'd suggest you update Redis before you go on chasing windmills.




Good to hear you got it working.

If your box is high traffic, watch the Redis memory usage.
When it does the dump to file it duplicates memory usage so if you 
expect Redis to use 2GB of memory, you'll need 4GB of free memory to do 
the dump. Swapping is not a happy option


my Redis usage looks like.

bayes_token_ttl 432000
bayes_seen_ttl  2d


0.000  0   22202312  0  non-token data: nspam
0.000  09593796  0  non-token data: nham


# Clients
connected_clients:203
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:4085255152
used_memory_human:3.80G
used_memory_rss:6439870464
used_memory_peak:6307356768
used_memory_peak_human:5.87G
used_memory_lua:126976
mem_fragmentation_ratio:1.58
mem_allocator:jemalloc-3.2.0


used_memory_peak is what it used to do the dump to file.

and even with that amount of data, Bayes is extremely fast and goes 
totally unnoticed in overall msg processing time.