From LedHed's Wiki
Revision as of 14:06, 3 April 2007 by Ledhed (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Creating an email whitelist.

Reference: http://hardware.newsforge.com/article.pl?sid=04/12/02/1728210&tid=126


Postfix MySQL Maps

protected_users.cf

dbname = postfix
hosts = localhost
user = postfix
password = ********
table = protected_users
select_field = class
where_field = recipient


whitelist.cf

dbname = postfix
hosts = localhost
user = postfix
password = ********
table = whitelist
select_field = action
where_field = sender


Main.cf

SMTPD_RECIPIENT_RESTRICTIONS

Edit /etc/postfix/main.cf Add this line to the smtpd_recipient_restrictions section.

mysql:/etc/postfix/protected_users.cf

SMTPD_RESTRICTION_CLASSES

Create a restriction class. Add these lines anywhere in main.cf

smtpd_restriction_classes = whitelist
whitelist = check_sender_access mysql:/etc/postfix/whitelist.cf, reject


MySQL

Create the 2 tables needed by postfix.

Protected Users Table

CREATE TABLE `protected_users` (
`recipient` VARCHAR( 50 ) NOT NULL ,
`class` VARCHAR( 10 ) NOT NULL,
UNIQUE ( `recipient` )
);

Whitelist Table

CREATE TABLE `whitelist` (
`sender` VARCHAR( 50 ) NOT NULL ,
`action` VARCHAR( 2 ) NOT NULL ,
UNIQUE ( `sender` )
);