PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /opt/sharedrads/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //opt/sharedrads/check_pop3

#!/bin/bash
# Changelog
# 2011-06-01:wtg  Changed --failed_login to use $LINES variable and also show domains

LINESDEF="120000";
LINES=$LINESDEF
if [ $# -eq 3 ] && [ "$2" == "--lines" ];
then
        LINES=$3;
        #echo $LINES;
fi
#echo $LINES
function printUsage () {
    echo "This script will check /var/log/maillog for a few common issues:"

        echo =Check Basic Login Info=
    echo;echo "$0 --login_email"
    echo "Prints the email addresses with the most logins.";echo;

    echo;echo "$0 --login_ip"
    echo "Prints the IP addresses with the most logins.";echo;

    echo;echo "$0 --login_failed"
    echo "Prints highest number of failed logins by IP, address, and the both Address and IP.";echo;

    echo;echo "$0 --option --lines NUMLINES"
    echo "This will execute the option, checking NUMLINES back throgh the log file (default is ${LINESDEF})"

    echo;echo "$0 --checkerror";
    echo "Checks to see if you are hitting the maximum number allowed connections";
    echo "(Use this if you get complaints of webmail/IMAP being 'slow'!";

    echo;echo "$0 --help"
    echo "You're looking at it!"
}
case $1 in
--login_ip)
    tail -${LINES-45000} /var/log/maillog | grep pop3d | awk '{print $8}' | sed -e '/^$/d' | sort | uniq -c | sort -nk1
    ;;

--login_email)
    tail -${LINES-45000} /var/log/maillog | grep pop3d | awk '/LOGIN/{print $7}' | sort | uniq -c | sort -nk1 | tail -2
    ;;

--login_failed)
    echo "=Sorted by IP="
    tail -${LINES-45000} /var/log/maillog | grep pop3d | awk '/LOGIN FAILED/{print $9 }' | sort | uniq -c | sort -nk1 | tail -15
    echo "=Sorted by Address="
    tail -${LINES-45000} /var/log/maillog | grep pop3d | awk '/LOGIN FAILED/{print $8 }' | sort | uniq -c | sort -nk1 | tail -15
    echo "=Sorted by Domain="
    tail -${LINES-45000} /var/log/maillog | grep pop3d | awk '/LOGIN FAILED/{gsub(/user=.*@/,"",$0);print $8 }' | sort | uniq -c | sort -nk1 | tail -15
    echo "=Sorted by Address and IP="
    tail -${LINES-45000} /var/log/maillog | grep pop3d | awk '/LOGIN FAILED/{print $8, $9}' | sort | uniq -c | sort -nk1 | tail -15
    ;;
--checkerror)
    tail -${LINES-45000} /var/log/maillog |grep "maximum active connections";
    ;;

--help)
    printUsage;
    exit 0
    ;;
*)
    printUsage;
    exit 1
    ;;
esac