Here’s a quick IPTables rule to setup an alternate non-standard SMTP port without reconfiguring the mail server software:
1 2 |
/sbin/iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2525 \ -j REDIRECT --to-ports 25 |
Here’s a quick IPTables rule to setup an alternate non-standard SMTP port without reconfiguring the mail server software:
1 2 |
/sbin/iptables -t nat -A PREROUTING -p tcp -m tcp --dport 2525 \ -j REDIRECT --to-ports 25 |
To export the mailbox for user@acme.com as a zip file use this command:
/opt/zimbra/bin/zmmailbox -z -m user@acme.com getRestURL \
‘//?fmt=zip&query=is:anywhere’ > user_at_acme_com.zip
Here is the same as a tgz file:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com getRestURL \
“//?fmt=tgz” > /tmp/account.tgz
And here’s a restore of the tgz file:
/opt/zimbra/bin/zmmailbox -z -m user@domain.com postRestURL \
“//?fmt=tgz&resolve=reset” /tmp/account.tgz
Here’s a simple script that will provide a report on mailbox size for every mailbox on a Zimbra server. The report is sorted by box size in descending order:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
#!/usr/bin/perl my $all_accounts=`zmprov gaa`; my @accounts = split(/\n/,$all_accounts); my @sizes; foreach $account (@accounts) { my $mb_size=`zmmailbox -z -m $account gms`; chomp($mb_size); my $size; if ($mb_size =~ /(.+)\ GB/) { $size = $1 * 1024 * 1024; } elsif ($mb_size =~ /(.+)\ MB/) { $size = $1 * 1024; } elsif ($mb_size =~ /(.+)\ KB/) { $size = $1; } elsif ($mb_size =~ /(.+)\ B/) { $nsize = $1; if ($nsize eq 0) { $size = 0; } else { $size = abs(1024/$1); }; }; $next = scalar(@sizes); $sizes[$next][0] = $account; $sizes[$next][1] = $size; }; @sizes = sort { $a->[1] <=> $b->[1] } @sizes; my $D=`date +'%m/%d/%y %H:%M'`; chomp($D); print "==========================================================\n"; print " Zimbra Mailbox Report\n"; print " \n"; print " All sizes in KB."; print " Generated on: $D\n"; print "==========================================================\n"; for (my $i = $#sizes-1; $i >= 0; $i--) { printf ("%15.2f %s\n",$sizes[$i][1], $sizes[$i][0]); }; |
You can disable SSLv2 in Courier by adding the following line to both /etc/courier-imap/imapd-ssl and /etc/courier-imap/pop3d-ssl:
1 |
TLS_CIPHER_LIST="HIGH:MEDIUM:!SSLv2:!LOW:!EXP:!aNULL:@STRENGTH" |
After restarting Courier you should test with openssl to verify SSLv2 has been disabled properly:
1 |
openssl s_client -connect localhost:995 -ssl2 |
You can test that weak ciphers have been disabled with the following:
1 |
openssl s_client -connect localhost:995 -cipher EXP:LOW |
Recently we needed to setup a postfix server that would route all email to a local mailbox regardless of original destination. Here’s the solution:
1) Add this line to /etc/postfix/main.cf (if it’s not already present):
recipient_canonical_maps = regexp:/etc/postfix/canonical
2) Add the following line to /etc/postfix/canonical (replace “username”):
/.*/ username@localhost
3) Run “postfix reload”
That should make it deliver all mail to the specificed local user. Make sure localhost is in the mydomains file (or the mydomains setting in main.cf, if it doesn’t use a seperate file), or just use any valid local domain.