If anybody is running ZCS V6 with the B&L lists could they try this and let me know how long it takes to run
Code:
#!/usr/bin/perl
use Net::LDAP;
my $zcs_server = 'your.zcs.server.fqdn';
my $zmamavis_pass = 'XXXXXXXXXX';
$ldap = Net::LDAP->new($zcs_server) or die "$@";
@acc_filter = ( 'zimbraMailDeliveryAddress', 'zimbraMailAlias' );
@wbl_filter = ( 'amavisWhitelistSender', 'amavisBlacklistSender' );
$ldap->bind('uid=zmamavis,cn=appaccts,cn=zimbra', password => $zmamavis_pass);
$result = $ldap->search(filter=>'(&(zimbraMailStatus=enabled))', attrs => \@acc_filter);
@accounts = $result->entries;
foreach $account (@accounts) {
foreach $emailaccount ($account->attributes) {
$email = $account->get_value($emailaccount);
$filter = "(&(zimbraMailDeliveryAddress=" . $email . ")(zimbraMailStatus=enabled))";
$result = $ldap->search(filter=>$filter, attrs => \@wbl_filter);
@lists = $result->entries;
foreach $wbl (@wbl_filter) {
foreach $list (@lists) {
foreach $entry ($list->get_value($wbl)) {
print "$email,$wbl,$entry\n";
}
}
}
}
}
$mesg = $ldap->unbind; This is just a test before I write the MailScanner hook and if you can let me know how many accounts that would be great. You should see something like
Code:
uxbod@xxxxxxxxxxx,amavisWhitelistSender,wl1@xyz.com
uxbod@xxxxxxxxxxx,amavisWhitelistSender,wl12@abc.com
uxbod@xxxxxxxxxxx,amavisBlacklistSender,bl1@ghi.com
It is not the most efficient code but it works

and I already have stub code for plugging into MS as a Perl module.