Skip to content

Instantly share code, notes, and snippets.

@rushipkar90
rushipkar90 / Server Load
Last active November 24, 2020 23:26
Server Load
cat /usr/local/apache/conf/modsec2.user.conf | grep xmlrpc
#xmlrpc
===================
SecRule REQUEST_LINE "POST .*xmlrpc.*" "pass,initcol:ip=%{REMOTE_ADDR},setvar:ip.maxlimit=+1,deprecatevar:ip.maxlimit=1/600,nolog,id:35061"
SecRule IP:MAXLIMIT "@gt 5" "log,deny,id:350611,msg:'wp-xmlrpc: denying %{REMOTE_ADDR} (%{ip.maxlimit} connection attempts)'"
#wp-bruteforce
===================
SecRule REQUEST_LINE "POST .*wp-login.*" "pass,initcol:ip=%{REMOTE_ADDR},setvar:ip.maxlimit=+1,deprecatevar:ip.maxlimit=1/600,nolog,id:35011"
SecRule IP:MAXLIMIT "@gt 10" "log,deny,id:350111,msg:'wp-bruteforce: denying %{REMOTE_ADDR} (%{ip.maxlimit} connection attempts)'"
@rushipkar90
rushipkar90 / Grub mode
Last active May 7, 2018 17:25
Grub mode
Reboot the server is rescue mode and then apply below fix.
# nvme list
- Fix for NVMe Servers
mount /dev/md3 /mnt/
mount /dev/md2 /mnt/boot/
mount /dev/nvme0n1p1 /mnt/boot/efi/
mount -o bind /dev /mnt/dev
@rushipkar90
rushipkar90 / DirectAdmin Log Locations
Created March 13, 2018 11:41
DirectAdmin Log Locations
Ref: https://linuxadminblogs.wordpress.com/2015/01/28/direct-admin-file-locations/
Direct Admin file locations:
———
CONF FILES /etc/httpd/conf/httpd.conf
LOG FILES /var/log/httpd/error.log
START/STOP /usr/local/etc/rc.d/httpd start/stop
Scripts /usr/local/directadmin/scripts/
@rushipkar90
rushipkar90 / Server Monitoring Script
Created November 6, 2017 11:24
Server Monitoring Script
You may need to monitor server with the help of your server administrator and check domain access logs at the time of load spike to analyze further.
You can try this system monitoring script which records detailed logs of resource usage and process activity. Please use the following commands to install:
wget -O /root/sys-snap.pl https://raw.githubusercontent.com/cPanelTechs/SysSnapv2/master/sys-snap.pl
cd /root/ && chmod 744 sys-snap.pl && perl sys-snap.pl --start
The script connects data from the following places:
/proc/loadavg
/proc/meminfo
vmstat 1 10
@rushipkar90
rushipkar90 / QMAIL-REMOVE installation
Created March 30, 2017 04:05
QMAIL-REMOVE installation
HOW TO INSTALL QMAIL-REMOVE ON LINUX PLESK?
Ref: http://www.datanethosting.com/kb/plesk-linux/how-to-install-qmail-remove-on-linux-plesk
First we will install Qmail-Remove on the server. Download the latest version through given below link.
Using following command
#wget http://www.linuxmagic.com/opensource/qmail/qmail-remove/qmail-remove-0.95.tar.gz
@rushipkar90
rushipkar90 / qmail commands
Created March 30, 2017 04:05
qmail commands
How To Manage QMail Queue In Linux Plesk
Ref URL
----------------
http://geeksterminal.com/qmail-commands-logs-plesk-server/580/
https://www.24x7servermanagement.com/blog/how-to-manage-qmail-queue-in-linux-plesk/
----------------
1) To check the mail queue in plesk from command line, you can use the command :
@rushipkar90
rushipkar90 / postfix commands
Created March 30, 2017 04:04
postfix commands
Ref Links:
=============
https://jvulinux.wordpress.com/2014/12/26/commands-to-check-spamming-in-postfix-mail-server/
https://www.cyberciti.biz/tips/howto-postfix-flush-mail-queue.html
=============
Commands to check spamming in POSTFIX mail server
1. To see the mail queue:
@rushipkar90
rushipkar90 / spamemails.sh
Created November 17, 2016 11:25
spamemails.sh
#!/bin/bash
pprocess=`ps -ef | grep "spamemails.sh" | grep -v "grep" | wc -l`;
if [ "$pprocess" -le 2 ]
then
{
sh /usr/local/src/newmalicious.sh >> /usr/local/src/permupdates.txt;
}
fi
@rushipkar90
rushipkar90 / upgradephp_new.sh
Last active September 9, 2016 22:45
Upgradephp along with extensions
#/bin/bash
set -x
echo > /usr/local/src/customphpini.txt;
echo > /usr/local/src/commentphp.txt;
echo > /usr/local/src/oldextensions.txt;
echo > /usr/local/src/newextension.txt;
oldextension=`php -i | grep -w "extension_dir =" | grep -v "sqlite" | awk '{print $3}'`;
ls -la $oldextension | awk '{print $9}' | grep -v "./" | grep -v "../" | grep -v '^$' > /usr/local/src/oldextensions.txt;
thetime=`date +"%Y-%m-%d-%S"`;
php -m > /usr/local/src/modules.txt
@rushipkar90
rushipkar90 / upgradephp.sh
Created September 5, 2016 21:03
PHP Upgrade Script
#/bin/bash
set -x
echo > /usr/local/src/customphpini.txt;
echo > /usr/local/src/commentphp.txt;
thetime=`date +"%Y-%m-%d-%S"`;
php -m > /usr/local/src/modules.txt
echo "================================" >> /usr/local/src/modules.txt
/usr/local/apache/bin/apachectl -M >> /usr/local/src/modules.txt
cp -ar /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf_$thetime;
cp -ar /usr/local/lib/php.ini /usr/local/lib/php.ini_$thetime;