Solved

sendmail ldap lookup sbs 2003

Posted on 2009-07-08
4
499 Views
Last Modified: 2013-12-24
hi.. hoping some email experts might be able to pin this one down 4 me..

I have sendmail configured as a backup mailserver for my domain that stores and forwards mail iin events of primary downtime. Mail is forwarded on with mailertable. This works ok, but get ndrs for non existent users on the domain. If I build a virtuser list with all my email addresses i believe it may help to stop this bounced ndr as mail will be dropped. what i was wondering is it possible to retrieve a list of email addresses from my exchange server with an ldap lookup to automatically populate the virtuser table?  one other thing i do get a large number of failed relay non delivery emails. at the moment i am firing these off to /dev/null because they are all spam rubbish is this the best way to certain them?
0
Comment
Question by:dodyryda1
  • 3
4 Comments
 
LVL 26

Expert Comment

by:jar3817
ID: 24803863
I'm using a version of this perl script to fetch all the email addresses (users,contacts, groups, public folders) from AD:

http://www-personal.umich.edu/~malth/gaptuning/postfix/getadsmtp.pl

Obviously you'll have to change the domain controllers names and probably your search base. Look for this line: "push(@valid, $mail." OK\n");" and change that to the format of your virtusertable file.

Once you have it working ok you can schedule it via cron to auto update.
0
 
LVL 26

Expert Comment

by:jar3817
ID: 24804087
By default that'll work for every account, but you probably want to exclude the disabled accounts. Add this to the filter to exclude disabled accounts:

( !(userAccountControl:1.2.840.113556.1.4.803:=2))
0
 

Accepted Solution

by:
dodyryda1 earned 0 total points
ID: 24806788
nice one thanks jar3817 i think this is exactly what i'm after, bit new to this so to check.....

once configure with my setup correctly simply executing this script from a terminal will populate my virtuser table automatically correct?. I can then schedule this to run cron etc, to populate virtuser with any changes in AD correct?

To double check on the usage of this setup, By having these email addresses in the virtuser table,  I then can configure sendmail to drop mail silently from addresses not contained in this table to prevent being slammed with these ndr's. And forward everything on to my main server with mailertable


I do wish to exclude my disable users so filter will be something like

 if ( $mail =~ s/^(smtp|SMTP)://gs ) ( !(userAccountControl:1.2.840.113556.1.4.803:=2)) {
       push(@valid, $mail." OK\n");
     }

thanks for your help..
0
 
LVL 26

Assisted Solution

by:jar3817
jar3817 earned 250 total points
ID: 24808313
Yup..

But the disabled exclusion part goes in the filter part of the search, mine looks like this:

(& (!(userAccountControl:1.2.840.113556.1.4.803:=2)) (mailnickname=*) (| (&(objectCategory=person) (objectClass=user)(!(homeMDB=*))(!(msExchHomeServerName=*))) (&(objectCategory=person)(objectClass=user)(|(homeMDB=*) (msExchHomeServerName=*)))(&(objectCategory=person)(objectClass=contact)) (objectCategory=group)(objectCategory=publicFolder)(objectClass=msExchDynamicDistributionList) ))

Also keep in mine you may need to restart sendmail when you change the virtusertable file for the changes to take effect.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Utilizing an array to gracefully append to a list of EmailAddresses
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now