On Sat, 26 Jun 2010, Massimiliano Giovine wrote:
What does it do? How can i read the documentation of the spamassassin
behavior with whitelisting?
Firstly, the behaviour of the various whitelist options are described in
the Mail::SpamAssassin::Conf documentation. There is a copy on the web
at:
http://spamassassin.apache.org/full/3.3.x/doc/Mail_SpamAssassin_Conf.html
Now I have to ask what functionality you are trying to achieve that is not
already in SA? Are you simply trying to give your users a 'friendly' way
to add whitelist entries to their spamassassin config?
If so, and the volume of entries is not large, I would suggest you use an
'include whitelistfile' command in the user's .spamassassin/user_prefs and
then use whatever user interface you like to put a listing of whitelist
commands into that file.... Using a separate file would avoid issues with
a script error corrupting the main user_prefs file.
- Charles
2010/6/22 Martin Gregorie <mar...@gregorie.org>:
On Tue, 2010-06-22 at 07:28 +0200, Massimiliano Giovine wrote:
Really thanks for the answers.
So, i need to configure my spamassassin installation to use the
running database (i'm already using a mysql database for other reason)
for whitelisting or i have to write the logic of a whitelist using my
database installationa?
You can do it all in SA. The steps are:
1)add another table to the database. This need only have a single column
that contains the list of e-mail addresses you want to whitelist.
The column needs to be the prime key, which is normally indexed.
The e-mail address needs to be indexed for good performance.
2)you need a way of adding addresses to the table. If you're happy to
use SQL you can use the MySQL interactive SQL tool or wrap it
in a shell script to implement a shell command like
whitelist someb...@example.com"
3)of course you need some form of backup, but MySQL's standard database
backup and restore tools should do just fine. If you already have
a whitelist, you can easily load it into the database with the MySQL
bulk loader.
4)you need to write or otherwise obtain a Spamassassin plugin to access
the database and a rule to call the plugin.
My whitelisting plugin interrogates a database view containing a
moderately complex query. This appears to the plugin as the sort of
table I've just described. If I was implementing your plugin I'd:
- define a table that uses my view name as the table name and contains
the same column name. This way I could use my existing plugin to
access the whitelist table without any SQL changes, i.e.
create table whitelist ( email varchar(80) primary key );
- Modify my plugin to work with MySQL. I use PostgresQL as my database
but I think the changes would be minimal - possibly little more than
configuration changes. I've never used MySQL, so can't be more
definite.
Is there something i can read to go deep into this argument?
There isn't a lot. There's an SA document about writing plugins, which
is quite helpful. I found it was easy enough to read that and then grab
a plugin that accessed a database and modify that, but I do know some
Perl and understand object-oriented programming. You need both to
successfully create a plugin without too much trial and error. I found
that figuring out the database access was easy enough, but the SA
facility for configuring a plugin, i.e. telling it what sort of database
to access and where to find it, was poorly documented and did need quite
a bit of experimentation to get right.
Caveat: As I've never used MySQL the preceding description assumes that
it has all the tools that come as standard with every other SQL database
I've used.
Martin
--
-Massimiliano Giovine
Aksel Peter Jørgensen dice: "Why make things difficult, when it is
possible to make them cryptic and totally illogic, with just a little
bit more effort?"
Blog: http://opentalking.blogspot.com
"Linus Torvalds doesn't die, he simply returns zero."