1

I have been using sendmail as MTA & SquirrelMail for webmail. I used to have following setup to restrict recepient in SquirrelMail. SquirrelMail had a plugin called Recepientrestrictions which can check two php files

  1. Config.PHP - contains list of different domains where my domain user can send mails (sysadmins & Directors of company can send mails to anybody)
  2. recepientrestrictions.php - contains list of specific addresses such as user@gmail.com or user1@yahoo.com to whom my domain user can send mail.(again sysadmin & Directors of company can send mails to anybody)

Now the problem is:

I am migrating to Zentyal as email server. Zentyal uses Postfix in background & Roundcube for webmail.

I have got a partial solution which is a general rule for all users in my domain (couldn't seperate sysadmin/ directors to send mail to anybody on internet) which restricts mails delivered to specific domains which is as follows.

  1. Add this into main.cf:

    smtpd_recipient_restrictions = check_recipient_access 
                hash:/etc/postfix/recipient_domains, reject 
    
  2. /etc/postfix/recipient_domains is the whitelist file:

    mycompany.com OK 
    anotherdomain.com OK 
    
  3. Generate hash file: postmap /etc/postfix/recipient_domains

  4. Restart postfix service.

Even after this it doesn't block a mail sent to anybody@gmail.com or anybody@yahoo.com . Also I want to enable sending mail to few mail id's on webmail providers with the help of a whitelist file. e.g.

somebody@gmail.com OK
somebody@yahoo.com OK
foo@gmail.com OK

In short the scheme is :

  • Group1 sends mail to anybody on the planet.
  • Group2 sends mail thro' two whitelists 1) domain wise 2) specific users of webmail.

Question is how to achieve this scheme?

1 Answers1

0

To check the access of a user for a mail address, use the smtpd_sender_login_maps parameter:

smtpd_sender_login_maps = hash:/etc/postfix/sender_login_maps

Use entries like:

bob@example.com bob
alice@example.com alice
@bob.example.com bob

The second column is the login name (used for authentication). For more information look at the docs. This example uses a hashtable, but you can also use a database or whatever you want to use.

sebix
  • 4,175
  • 2
  • 25
  • 45