This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo > /usr/local/src/temp_eximlog | |
echo > /usr/local/src/topsender.txt | |
echo > /usr/local/src/topsenderscript.txt | |
a=`date --date="1 hours ago" +%Y-%m-%d\ %H` | |
b=`date +%Y-%m-%d\ %H` | |
awk -v s="$a" -v e="$b" '$0~s,$0~e' /var/log/exim_mainlog >> /usr/local/src/temp_eximlog | |
cat /usr/local/src/temp_eximlog | grep dovecot | awk {'print $8, $9, $10, $11}' | replace "A=dovecot_plain:" "+" | grep "+" | cut -d "+" -f2 | awk '{print $1}' | sort | uniq -c | sort -nr > /usr/local/src/mailauths.txt | |
IFS=$'\n' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
freshclam; | |
echo > /usr/local/src/mailscamsind.txt; | |
echo > /usr/local/src/maliciousfilesind; | |
echo > /usr/local/src/permissionupdatedind; | |
echo > /usr/local/src/scanclamfile.log; | |
echo > /usr/local/src/scanclam.log; | |
#tail -10000 /var/log/exim_mainlog | grep -w "cwd" | grep -v "exim" | grep -v "root" | grep -vw "/" | cut -d= -f2 | awk '{print $1}' | sort | uniq -c | sort -rn >> /usr/local/src/mailscams.txt | |
#for i in `head -5 /usr/local/src/mailscams.txt | awk '{print $2}' | grep -v '^$'`; do | |
i=$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reference URL: http://www.cyberciti.biz/tips/top-linux-monitoring-tools.html | |
top -cd2 | |
vmstat 3 ---The command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity | |
vmstat -m ---Display Memory Utilization Slabinfo | |
vmstat -a ---Get Information About Active / Inactive Memory Pages | |
mpstat ---Display the utilization of each CPU individually using mpstat | |
w ---Find Out Who Is Logged on And What They Are Doing | |
uptime ---Tell How Long The System Has Been Running |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
echo > mailaccounts.txt; | |
CP_ACCOUNTS=`ls -1A /var/cpanel/users/ | grep -v "root" | grep -v "system"` | |
for user in `echo -n $CP_ACCOUNTS` | |
do | |
domain=`grep -i ^dns /var/cpanel/users/$user |cut -d= -f2`; | |
maindomain=`cat /etc/trueuserdomains | grep "$user" | cut -d : -f1`; | |
homedir=`cat /var/cpanel/userdata/"$user"/"$maindomain" | grep homedir | cut -d / -f2`; | |
for dom in `echo -n "$domain"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
echo > testpasswd; | |
genpasswd() { | |
tr -dc A-Za-z0-9_ < /dev/urandom | head -c 12 | xargs | |
} | |
cat /dev/null > mailaccounts.txt | |
CP_ACCOUNTS=`ls -1A /var/cpanel/users/ | grep -v "root" | grep -v "system"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/local/apache/conf/modsec2.user.conf | |
# Deprecated due to security issues so it should be off: http://blog.modsecurity.org/2008/08/transformation.html | |
SecCacheTransformations Off | |
# Check Content-Length and reject all non numeric ones | |
SecRule REQUEST_HEADERS:Content-Length "!^\d+$" "deny,log,auditlog,msg:'Content-Length HTTP header is not numeric', severity:'2',id:'1234123444'" | |
# Do not accept GET or HEAD requests with bodies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refer: http://www.inmotionhosting.com/support/website/server-usage/identify-and-block-bad-robots-from-website | |
How to identify bad bot for a domain | |
============ | |
cd /home/xyystgkp/access-logs | |
cat justforflorida.com | awk -F\" '{print $6}' | sort | uniq -c | sort -n | |
>> | |
36 Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36 | |
71 Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html) | |
95 WordPress/3.5.1; http://justforflorida.com/florida |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to configure a static IP address on CentOS 7/ RHEL 7 | |
==================== | |
http://ask.xmodulo.com/configure-static-ip-address-centos7.html | |
==================== | |
How to install MySQL Server 5.6 on CentOS 7 / RHEL 7 | |
========== | |
http://sharadchhetri.com/2014/07/31/how-to-install-mysql-server-5-6-on-centos-7-rhel-7/ | |
https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
for i in `cat /usr/local/src/innodb_databases-08012016.txt`; do | |
mysqldump -ER $i > /home/mysqldump-08012016/$i.sql; | |
done | |
//Before executing above script, file innodb_databases-08012016.txt which contains list of all the innodb databases must be present | |
on the location. To get the list of all innodb databases, use below commands | |
To find out Innodb databases |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
for i in `cat /usr/local/src/innodb_databases-08012016.txt`; do | |
echo $i; | |
echo "/var/lib/mysql/$i" | |
#ls -la /home/mysqlbackup/$i.sql | |
mv /var/lib/mysql/$i /home/sachinn/mysqlrestore; | |
mysqladmin create $i; | |
mysql $i < /home/mysqldump-08012016/$i.sql; | |
done |