OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: how to reject emails sent to users not contained into the account DB

From: /dev/rob0 (rob0gmx.co.uk)
Date: Wed Aug 23 2006 - 17:40:54 CDT


On Wednesday 23 August 2006 17:04, andrea wrote:
> I've installed postfix 2.2.10 .....and I have a mysql database that
> contains all the user accounts.

User accounts in what address class? Usually SQL or LDAP maps means
virtual mailbox class, but your configuration is confusing.

> Now I want to accept only the
> messages sent to those accounts. I would like to set postfix in order
> to have this behavior: when a message arrive, if the TO user is
> contained into the database account it is delivered, otherwise it is
> rejected.
>
> To obtain this I've made this configuration :
>
> master.cf
> --------------
> smtp inet n - n - - smtpd
> -o smtpd_sasl_auth_enable=no
> -o smtpd_recipient_restrictions=check_recipient_maps

1. Typically the main smtpd(8) process is configured in main.cf, not
using -o options in master.cf.

2. You're not reading the documentation that came with your copy of
Postfix. check_recipient_maps is deprecated syntax.

> main.cf

Per DEBUG_README and the list welcome message, "postconf -n" is
preferred.

> mydestination = mysql:/etc/postfix/mysql-mydestination.cf

Okay, your SQL lookup is for local(8) address class. This is unusual.

> relay_domains = $mydestination

Unset this. See ADDRESS_CLASS_README: an address should only be in a
single address class.

> local_recipient_maps = mysql:/etc/postfix/mysql-utenti.cf

This will be queried for the bare username only.

> relay_recipient_maps = mysql:/etc/postfix/mysql-utenti.cf

Again, unset this. (Comment or remove it, unset is the default.)

[snip]
> Is this configuraton correct? Is a good solution ?

Typically local address class is for Unix accounts. Do you have home
directories and UID's for each of these SQL users? local(8) is probably
going to use NSS functions to look up user information. Is that set up
to query your SQL database too?

Anyway, the better answer for local(8) delivery is found in
LOCAL_RECIPIENT_README.html .
--
    Offlist mail to this address is discarded unless
    "/dev/rob0" or "not-spam" is in Subject: header