Exporting all addresses: Difference between revisions

No edit summary
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{BC|Community Sandbox}}
__FORCETOC__
<div class="col-md-12 ibox-content">
=Exporting all addresses=
{{KB|{{ZC}}|{{ZCS 8.8}}|{{ZCS 8.7}}|{{ZCS 8.6}}|}}
Exporting all addresses (mailboxes, aliases and distribution lists) is a vital tool if you have a backup MX and only want it to accept email for valid recipients. One reason for that is to stop spammers who simply use a dictionary of common names to generate recipient email addresses which would flood a backup MX with undeliverable email. Some anti-spam providers (e.g. Postini) have automatic provisioning processes for making this possible.
Exporting all addresses (mailboxes, aliases and distribution lists) is a vital tool if you have a backup MX and only want it to accept email for valid recipients. One reason for that is to stop spammers who simply use a dictionary of common names to generate recipient email addresses which would flood a backup MX with undeliverable email. Some anti-spam providers (e.g. Postini) have automatic provisioning processes for making this possible.


A naive process of extracting mailboxes looks like this:
A naive process of extracting mailboxes looks like this:
   /opt/zimbra/bin/zmaccts | grep 'active' | egrep -v '^\W+' | awk '{print $1}'
   /opt/zimbra/bin/zmaccts | grep 'active' | egrep -v '^\W+' | awk '{print $1}'


Unfortunately, this doesn't give distribution lists and aliases, so a more sophisticated approach is necessary, for which there is no specific tool and requires using the ldap tool thus:
Unfortunately, this doesn't give distribution lists and aliases, so a more sophisticated approach is necessary, for which there is no specific tool and requires using the ldap tool thus:


'''In ZCS 8.7 and above:'''
  /opt/zimbra/common/bin/ldapsearch -LLL -x -D"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_userdn | \
        awk '{print $3}'`" -w"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_password | \
        awk '{print $3}'`" -H `/opt/zimbra/bin/zmlocalconfig ldap_url | \
        awk '{print $3}'` $* | \
        grep ^mail | \
        awk '{print $2}' | \
        sort > zimbra_recipients.list
'''In ZCS 8.6 or below:'''
   /opt/zimbra/openldap/bin/ldapsearch -LLL -x -D"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_userdn | \
   /opt/zimbra/openldap/bin/ldapsearch -LLL -x -D"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_userdn | \
         awk '{print $3}'`" -w"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_password | \
         awk '{print $3}'`" -w"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_password | \
Line 16: Line 29:
         awk '{print $2}' | \
         awk '{print $2}' | \
         sort > zimbra_recipients.list
         sort > zimbra_recipients.list


If your backup MX is exim, then you need to add the following to the config file:
If your backup MX is exim, then you need to add the following to the config file:
Line 26: Line 38:
   sed -e 's/^/^/' -e 's/\./\\\./' -e 's/@.*$/$/' > exim_valid_emails.list < zimbra_recipients.list
   sed -e 's/^/^/' -e 's/\./\\\./' -e 's/@.*$/$/' > exim_valid_emails.list < zimbra_recipients.list


More methods here: http://www.zimbra.com/forums/etc/19968-solved-looking-reporting-output-names-alias-etc.html
=More Methods=
More methods here:  
*https://forums.zimbra.org/viewtopic.php?t=28953


{{Article_Footer|unknown|1/3/2008}}
{{Article_Footer|unknown|1/3/2008}}


[[Category:Anti-spam]]
[[Category:Anti-spam]]
[[Category:Backup and Restore]]
[[Category:Migration]]

Latest revision as of 17:29, 18 January 2018

Exporting all addresses

   KB 2318        Last updated on 2018-01-18  




0.00
(0 votes)

Exporting all addresses (mailboxes, aliases and distribution lists) is a vital tool if you have a backup MX and only want it to accept email for valid recipients. One reason for that is to stop spammers who simply use a dictionary of common names to generate recipient email addresses which would flood a backup MX with undeliverable email. Some anti-spam providers (e.g. Postini) have automatic provisioning processes for making this possible.

A naive process of extracting mailboxes looks like this:

 /opt/zimbra/bin/zmaccts | grep 'active' | egrep -v '^\W+' | awk '{print $1}'

Unfortunately, this doesn't give distribution lists and aliases, so a more sophisticated approach is necessary, for which there is no specific tool and requires using the ldap tool thus:

In ZCS 8.7 and above:

 /opt/zimbra/common/bin/ldapsearch -LLL -x -D"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_userdn | \
       awk '{print $3}'`" -w"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_password | \
       awk '{print $3}'`" -H `/opt/zimbra/bin/zmlocalconfig ldap_url | \
       awk '{print $3}'` $* | \
       grep ^mail | \
       awk '{print $2}' | \
       sort > zimbra_recipients.list

In ZCS 8.6 or below:

 /opt/zimbra/openldap/bin/ldapsearch -LLL -x -D"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_userdn | \
       awk '{print $3}'`" -w"`/opt/zimbra/bin/zmlocalconfig -s zimbra_ldap_password | \
       awk '{print $3}'`" -H `/opt/zimbra/bin/zmlocalconfig ldap_url | \
       awk '{print $3}'` $* | \
       grep ^mail | \
       awk '{print $2}' | \
       sort > zimbra_recipients.list

If your backup MX is exim, then you need to add the following to the config file:

 accept
   local_parts = /etc/exim/zimbra_valid_emails.list
   domains = +relay_to_domains
 deny

The list of recipients needs to be converted to a form that exim will process, e.g.

 sed -e 's/^/^/' -e 's/\./\\\./' -e 's/@.*$/$/' > exim_valid_emails.list < zimbra_recipients.list

More Methods

More methods here:

Verified Against: unknown Date Created: 1/3/2008
Article ID: https://wiki.zimbra.com/index.php?title=Exporting_all_addresses Date Modified: 2018-01-18



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search