[NTLUG:Discuss] How to dump a list of email addresses from your mail server?
David Stanaway
david at stanaway.net
Wed Sep 19 18:33:50 CDT 2007
We would need to know what mail server you were using - and how it is
configured to help their.
Eg, are you using postfix with local users, an /etc/aliases and and
/etc/postfix/virtual like me? Or do you have something else?
You can get all your local accounts with
getent passwd
unless you have some odd PAM magic happening for your mail services.
You could get your alias users from your alias files and virtual files
with the appropriate dbm flavor util.
/usr/bin/db4.3_dump -p /etc/aliases.db
/usr/bin/db4.3_dump -p /etc/postfix/virtual.db
You will need some magic to look at that - you would probably be better
to use perl or python and its db<X> library.
The data section of the db_dump is a line for the key, and a line for
the value ...
Daniel Hauck wrote:
> I'm preparing to deploy ESVA (a vmware appliance for email filtering) at
> home. I have been using it at work with fantastic results. One feature
> on there that is absolutely necessary is to specify the relay_recipients
> for Postfix to use, rejecting all other incoming emails. To simply
> accept all email for a domain will result in thousands of different
> random email addresses being sent to my domains, each being filtered and
> scanned before finally being rejected by the actual email server. It
> results in a HEAVY processor load and I don't want it.
>
> At work, we have an exchange email server and with a handy-dandy Perl
> script that does some LDAP magic, I am able to download a list of all
> email addresses from the exchange server and feed it to ESVA via an
> hourly cron job. (This allows me to simply add or delete a user and the
> list will update itself within the hour automagically)
>
> I want to do the same thing at home but the problem is, I don't have any
> such LDAP thing running at home... I'm all Linux and it's set up rather
> simply. So, with that said, what would be an easy way to have the
> mail/web server I'm loading generate a list of valid email addresses for
> the domains I'm hosting? This would be accounts *and* aliases.
>
> I suppose performing multiple steps where I scan the passwd file and
> then the aliases file might work but I'm no shell or perl script wizard
> to be sure. So before I do it "the hard way" I'm hoping someone with
> superior skillz could show me what a dummy I am by showing me an easier way?
>
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
>
>
More information about the Discuss
mailing list