Posts

SPAM mail removal script

Step:- 01 root@mail:/root# vi /root/removemail #!/usr/bin/perl $REGEXP = shift || die "no email-adress given (regexp-style, e.g. bl.*\@yahoo.co @data = qx</opt/zimbra/common/sbin/postqueue -p>; for (@data) { if (/^(\w+)(\*|\!)?\s/) { $queue_id = $1; } if($queue_id) { if (/$REGEXP/i) { $Q{$queue_id} = 1; $queue_id = ""; } } } #open(POSTSUPER,"|cat") || die "couldn't open postsuper" ; open(POSTSUPER,"|/opt/zimbra/common/sbin/postsuper -d -") || die "couldn't open postsuper foreach (keys %Q) { print POSTSUPER "$_\n"; }; close(POSTSUPER); Step:-02 root@mail:/root# chmod +x /root/removemail Step:-03 root@mail:/root#/root/removemail <spammer address>

Enable passwordless rsync/ssh

Scenario: Server:1 192.168.1.211 Server:1 192.168.1.222 Objective: Enable passwordless rsync from server1 to server2 Steps: 1. Enable root login 2. set root password 3. check current ssh status ssh -p 22 root@192.168.1.222 4. create your SSH key pair ssh-keygen -t rsa -b 4096 5. locate keys ls -ll /root/.ssh -rw------- 1 root root 3243 Jul 31 13:58 id_rsa -rw-r--r-- 1 root root 737 Jul 31 13:58 id_rsa.pub 6. ssh-copy-id root@192.168.1.222 /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root@192.168.1.222's password: Number of key(s) added: 1 Now try logging into the machine, with: "ssh 'root@192.168.1.222'" and check to make sure that only the key(s) you wanted were added. 7. Job is don...

How to fix annoying Zimbra certificate error || Deploy selfsigned certificate in Zimbra

Issue: ERROR: zclient.IO_ERROR (invoke sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target, server: localhost) (cause: javax.net.ssl.SSLHandshakeException sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.ce rtpath.SunCertPathBuilderException: unable to find valid certification path to requested target). Solution: 1. Create and deploy selfsigned certificate – Run as zimbra user: [root@mail zimbra]$ /opt/zimbra/bin/zmcertmgr createca -new [root@mail zimbra]$ /opt/zimbra/bin/zmcertmgr deployca [root@mail zimbra]$ /opt/zimbra/bin/zmcertmgr createcrt -new -days 365 [root@mail zimbra]$ /opt/zimbra/bin/zmcertmgr deploycrt self 2. Verify Deployed certificate: [root@mail zimbra]$ /opt/zimbra/bin/zmcertmgr viewdeployedcrt 3. Restart Zimbra services: [zimbra@mail ~]$ zmcontrol restart Ref: http://www.snapshotsofthemind...

Top 10 Mailbox size notification for Zimbra [Daily Basis]

Step: 01 vi /tmp/topmailbox.sh #!/bin/bash input=$(mktemp) output=$(mktemp) email=$(mktemp) sender="adminx@drbdtest.com" recipients="bolcorp@drbdtest.com" number=10 date=$(date +"%a, %d %b %Y %H:%M:%S %z (%Z)") datef="$(date +%F)" /opt/zimbra/bin/zmprov getQuotaUsage `zmhostname` | awk {'print $1" "$3" "$2'} >> ${input} cat $input | sort -rn -k 2 | while read line do usage=`echo $line | cut -f2 -d " "` quota=`echo $line | cut -f3 -d " "` user=`echo $line | cut -f1 -d " "` echo "`expr $usage / 1024 / 1024` of `expr $quota / 1024 / 1024` MB $user" >> ${output} done cat << EOF > ${email} Date: ${date} From: ${sender} To: ${recipients} Subject: Daily quota report for ${datef} top ${number} mailboxes by disk usage (quota) -------------------------------------- EOF head -${number} ${output} >> ${email} cat ${email} | /opt/zimbra/common/sbin/sendmail -t ${reci...

Zimbra user's mailbox size with details

Step: 01 vi /tmp/zimbra_size.sh #!/bin/bash # script to report zimbra mailbox size per folder for a specific user # based on info at http://www.zimbra.com/forums/administrators/23655-per-folder-size-command-line.html#post121758 # stsimb feb 2014 PATH=/opt/zimbra/bin:/bin:/usr/bin if [ "$(id -un)x" != "zimbrax" ]; then echo "Fatal error: This script needs to run as user zimbra." exit 1 fi if [ $# == 0 ] ; then echo "Report zimbra mailbox size per folder for a specific user" echo echo "Usage = $0 username" echo exit 1 fi USER=$1 backend="$(zmprov ga ${USER} zimbraMailHost | tail -2 | awk '{print $2}')" if [ "${backend}x" != "$(zmhostname)x" ]; then echo "Fatal error: need to run on ${backend} for ${USER}." exit 1 fi quota="$(expr `zmprov ga ${USER} zimbraMailQuota | tail -2 | awk '{print $2}'` / 1024 / 1024)" size="$(zmmailbox -z -m ${USER} gm...

Fixing Corrupted Mailbox Index

Issue:  Fixing Corrupted Mailbox Index Statement: Mail messages and attachments are automatically indexed before messages are deposited in a mailbox.  Each mailbox has an index file associated with it. This index file is required to retrieve search results from the mailbox. If a mailbox’s index file becomes corrupt or is accidentally deleted, you can re-index the messages in the mailbox from the Administration Console. Description: Text searches on an account might or might not fail with errors when the index is corrupt.  You cannot count on a user reporting a failed text search to identify that the index is corrupt.  You must monitor the index log for messages about corrupt indexes. If the server detects a corrupt index,  a message is logged to the Zimbra mailbox.log at the WARN logging level. The message starts with Possibly corrupt index.  When this message is displayed, the administrator must correct the problem. In many cases correcting the problem mig...

Mail log statistics || Postfix || Zimbra

Step: 01 vi /tmp/pflog.pl #!/usr/bin/perl -w # # ***** BEGIN LICENSE BLOCK ***** # Zimbra Collaboration Suite Server # Copyright (C) 2009, 2010 Zimbra, Inc. # # The contents of this file are subject to the Zimbra Public License # Version 1.3 ("License"); you may not use this file except in # compliance with the License. You may obtain a copy of the License at # http://www.zimbra.com/license. # # Software distributed under the License is distributed on an "AS IS" # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. # ***** END LICENSE BLOCK ***** # eval 'exec perl -S $0 "$@"' if 0; =head1 NAME pflogsumm.pl - Produce Postfix MTA logfile summary Copyright (C) 1998-2007 by James S. Seymour, Release 1.1.1. =head1 SYNOPSIS pflogsumm.pl -[eq] [-d <today|yesterday>] [-h <cnt>] [-u <cnt>] [--verp_mung[=<n>]] [--verbose_msg_detail] [--iso_date_time] [-m|--uucp_mung] [-i|--ignore_case] [--smtpd_stats] [...