Pages

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……..