Pages

Sunday, October 19, 2014

Dovecot Configuration with postfix MTA

We know there are some changes in new dovecot version. Let’s see how to configure new dovecot to work with postfix.


In new Dovecot package the single configuration file [dovecot.conf] has been divided in several files and stored in “/etc/dovecot/conf.d/” directory.

To get it work with postfix [without SMTP Authentication] we need to do the following.


File name: /etc/dovecot/conf.d/10-auth.conf

Unhash and Modify: disable_plaintext_auth = no


File name: /etc/dovecot/conf.d/10-mail.conf

Unhash and modify:    mail_location = mbox:~/mail:INBOX=/var/mail/%u [If you are using mailbox]

                                        mail_location = maildir:~/Maildir [If you are using Maildir]

                                        mail_privileged_group = mail

Now restart the dovecot service.


If you configure your postfix with SMTP authentication below changes are required.

File name: /etc/postfix/main.cf

Add / Modify:

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =  permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
broken_sasl_auth_clients = yes

Dovecot Configuration with above modification:

File Name: /etc/dovecot/conf.d/10-master.conf

service auth {
# Postfix smtp-auth
        unix_listener /var/spool/postfix/private/auth {
        mode = 0666
        user = postfix
        group = postfix
  }

Restart dovecot service.


Monday, June 9, 2014

Problem: DNS overwritten automatically in Ubuntu / Debian Server


Sometimes when we work with Ubuntu server we may face DNS resolve problem. If we check resolv.conf file we can see below status.

more /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN


Ohh!! That means if I entry my DNS in this file and save it will be OVERWRITTEN!! So?? How to solve this?? No tension its simple…


Just edit below file instead resolv.conf

vim /etc/resolvconf/resolv.conf.d/base

nameserver 8.8.8.8

nameserver 4.2.2.1

[Save and Exit]


Restart Service

/etc/init.d/resolvconf restart


Now check resolv.conf file and you will see this.

more /etc/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)

#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

nameserver 8.8.8.8

nameserver 4.2.2.1

Sunday, June 8, 2014

Sender Restriction for Group Email ID


Think you have a group email ID [alluser] with 500+ aliases. Boss has declared a bonus for all employee and he wants give the news everyone by mail. As a mail administrator you request your boss to send a common mail in alluser@staffs.com  and he did that.

Later you found other users started to reply thanks mail to that ID. For every single reply 500+ mail is generating and everyone is receiving that mail. So…. How to stop this??


We can restrict those group ID’s so that only specific users are allowed to send mails to those ID’s. Here’s the how to…………

[We are working with POSTFIX]

Edit the following in main.cf

smtpd_restriction_classes = groupaccessclass1, groupaccessclass2
groupaccessclass1 =
        check_sender_access hash:/etc/postfix/access_groupaccessclass1
        reject

groupaccessclass2 =
        check_sender_access hash:/etc/postfix/access_groupaccessclass2
        reject

smtpd_recipient_restrictions = hash:/etc/postfix/access_grouprecipient, permit_mynetworks, reject_unauth_destination

[Save and Exit]


***** First Declare smtpd_restriction_classes......... then define their duties..... then call them by smtpd_recipient_restrictions



Now who is authorized to send mails in group ID’s….

vim etc/postfix/access_grouprecipient

allusers@staffs.com                       access_groupaccessclass1
managers@staffs.com                  access_groupaccessclass2

[Save and Exit]

**** Only access_groupaccessclass1 has permission to send mail to allusers@staffs.com and access_groupaccessclass2 has permission to send mail to managers@staffs.com. Who is there in access_groupaccessclass1 and access_groupaccessclass2??


vim /etc/postfix/ access_groupaccessclass1

md@staffs.com                               OK
ceo@staffs.com                               OK

[Save and Exit]


vim /etc/postfix/ access_groupaccessclass2

md@staffs.com                               OK
xyz@staffs.com                               OK

[Save and Exit]


Now postmap all the created files [access_groupaccessclass1, access_groupaccessclass2 and access_grouprecipient]  in /etc/postfix.


postmap /etc/postfix/access_grouprecipient
postmap /etc/postfix/access_groupaccessclass1
postmap /etc/postfix/access_groupaccessclass2



Check now……..