Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 131411 - Mailfilter guide MySQL permissions
Summary: Mailfilter guide MySQL permissions
Status: RESOLVED FIXED
Alias: None
Product: [OLD] Docs on www.gentoo.org
Classification: Unclassified
Component: Other documents (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: nm (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-26 23:58 UTC by Sune Kloppenborg Jeppesen (RETIRED)
Modified: 2007-01-07 18:07 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
mailfilter-guide.xml.patch (mailfilter-guide.xml.patch,3.84 KB, patch)
2007-01-06 21:11 UTC, nm (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-26 23:58:53 UTC
Code Listing 9.1: Creating the MySQL database and user
mysql> GRANT ALL PRIVILEGES ON maildb.* TO 'mail'@'localhost' IDENTIFIED
BY 'very_secret_password';

Could be substituted by:

GRANT INSERT,UPDATE,DELETE,SELECT ON maildb.* TO 'mail'@'localhost'
IDENTIFIED BY 'very_secret_password';

And if the same db is not going to be used for quarantining to SQL you could likely restrict it to:

GRANT SELECT ON maildb.* TO 'mail'@'localhost'
IDENTIFIED BY 'very_secret_password';

Thx to Janne Pikkarainen for noting this.
Comment 1 Janne Pikkarainen 2006-04-27 00:10:34 UTC
Actually the same goes for Section 10 (Configuring SpamAssassin to use MySQL). There's a similar snippet:

---
10. Configuring Spamassassin to use MySQL
# mysql -u root -p mysql
mysql> GRANT ALL PRIVILEGES ON dbname.* TO 'dbuser'@'localhost' IDENTIFIED BY 'anoter_very_secret_password';
mysql> use dbname;
---

Also note a typo: "anoter_very..." should be "another_very..."

Comment 2 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2006-04-27 00:23:23 UTC
On the Bayes and AWL DBs the user needs INSERT,UPDATE,DELETE,SELECT permissions, SELECT is not enough.
Comment 3 Janne Pikkarainen 2006-06-01 05:57:49 UTC
*bump* :)

I just read the guide again. You may want to take a look at these parts of the guide, too:

---
Note:  The smtp-amavis line specifies that a maximum of two of these processes may run at any time. If you need a greater degree of concurrency tune this number to fit your needs. Remember that to match the number with $max_servers in amavisd.conf
---

- Maybe it should be mentioned that amavisd-new is quite memory-intensive and raising the amount of amavisd-new processes too high can easily lead to memory starvation and swapping, which leads to heavily decreased performance.

Next thing which took my attention was

---
10. Configuring Spamassassin to use MySQL
 As of Spamassassin 3.0 it is possible to store the Bayes and AWL data in a MySQL database. Here I will show how to easily accomplish this.
---

Ok, so guide mentions people that it's possible to use MySQL as a backend for Bayes and AWL, but it doesn't tell WHY one should consider using MySQL. I, for one, took the MySQL route just because at our heavily loaded site the default BerkeleyDB backend lead to all kind of deadlocks and performance problems even after tuning its DB_CONFIG file. MySQL performs a lot better.

So, mentioning about the performance would be good. Also maybe about how putting all the pieces to MySQL leads to easier overall system management? 
Comment 4 Janne Pikkarainen 2006-09-05 00:29:49 UTC
*bump* :-) At least the ALL PRIVILEGES part would be nice to have modified as soon as possible...
Comment 5 Janne Pikkarainen 2006-10-01 03:45:25 UTC
Yet another *bump* ...
Comment 6 Janne Pikkarainen 2006-10-12 04:15:45 UTC
I read the guide one more time and I'm beginning to think this bug should be renamed as "Ironing out couple of security issues from Mailfilter Guide". ;)

The guide assists people to put their MySQL connection settings to /etc/mail/spamassassin/local.cf:

---
(Tell Spamassissin to use MySQL for bayes data
bayes_store_module              Mail::SpamAssassin::BayesStore::SQL
bayes_sql_dsn                   DBI:mysql:sa_bayes:localhost:3306
bayes_sql_username              db_name
bayes_sql_password              another_very_secret_password

(Tell Spamassissin to use MySQL for AWL data
auto_whitelist_factory          Mail::SpamAssassin::SQLBasedAddrList
user_awl_dsn                    DBI:mysql:sa_bayes:localhost:3306
user_awl_sql_username           db_name
user_awl_sql_password           another_very_secret_password
---

That's a big no-no, too! Usually local.cf is readable by world, so putting a password there is not a good thing.

Instead you should put connection settings to /etc/mail/spamassassin/secrets.cf, which is only readable by root.
Comment 7 Francesco R. (RETIRED) gentoo-dev 2007-01-06 13:52:36 UTC
Great job Janne,

Docs team what about to update documentation with at least the following two changesets:

http://overlays.gentoo.org/proj/mysql/changeset/510?format=diff&new=510
http://overlays.gentoo.org/proj/mysql/changeset/511?format=diff&new=511

I don't want to interfere on comment #3 but that stuff is reasonable too imho.
Comment 8 nm (RETIRED) gentoo-dev 2007-01-06 21:11:04 UTC
Created attachment 105705 [details, diff]
mailfilter-guide.xml.patch

Proposed changes. If these look good, I will commit right away.

The only thing I noticed, that I already sent an email to vivo about, is that the config file changed in one code example from /etc/mail/spamassassin/local.cf to secrets.cf.

Is this supposed to be a complete local.cf --> secrets.cf filename change, or just this once, or what? There are many other references to local.cf, so I don't want to commit until I hear back on this.
Comment 9 nm (RETIRED) gentoo-dev 2007-01-06 21:11:31 UTC
CCing vivo for feedback.
Comment 10 nm (RETIRED) gentoo-dev 2007-01-07 18:07:50 UTC
Francesco responded on the secrets.cf thing, so I made one final change and committed the thing.

Thanks to everyone for reporting, commenting, reviewing, etc. :)

Fixed in CVS.