Once per server:
apt-get update && apt-get upgrade
apt-get install libapache2-mod-wsgi
apt-get install python-setuptools python-dev build-essential
easy_install -U pip
# www.fduran.com | |
# what is this process? - mini forensics on unknown running process | |
ls -l /proc/$pid/exe | |
dpkg -S /path/to/process_binary | |
strings /path/to/process_binary | |
hexdump -C /path/to/process_binary | |
netstat -tapn|grep tang | |
lsof $pid |
# www.fduran.com | |
# exclude a process from being killed by oom killer | |
echo -17 > /proc/$PID/oom_adj | |
# The possible values of oom_adj range from -17 to +15. The higher the score, more likely the associated process is to be killed by OOM-killer: https://lwn.net/Articles/317814/ |
#!/bin/bash | |
# generate a number of files with random sizes in a range | |
min=1 # min size (MB) | |
max=10 # max size (MB) | |
nofiles=20 # number of files | |
for i in `eval echo {1..$nofiles}` | |
do | |
dd bs=1M count=$(($RANDOM%max + $min)) if=/dev/urandom of=./files/file$i |
# see http://mysqltuner.com/ | |
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl | |
perl mysqltuner.pl |
# WP "Error establishing database connection" | |
# substitute with site's index static page (when it's up, not with the error duh) | |
wget http://example.com -O [/path/to/wp]/wp-content/db-error.php |
# calculate mysql schemas disk size | |
mysql -h dbhost.example.com -u theuser -pThePassword -e 'select table_schema as DB, round(sum((data_length+index_length)/1024/1024),1) as MB from information_schema.tables group by table_schema order by MB desc' |
#!/bin/bash | |
# check if mysql slave is running | |
log=/var/log/mysqlslave.log | |
[email protected] | |
date >> $log | |
res=`mysql -u root -pPassword -h db.example.com -N -B -e "show status like 'Slave_running'"|cut -f2` | |
if [ $res = 'ON' ] |
# tail log file in browser | |
# go to server.example.com:777 | |
pip install tailon | |
tailon -f /var/log/example.log -b 0:0:0:0:777 & |
# Checking for Shellshock attempts in web server logs | |
egrep "};|}\s*;" /var/log/apache2/access.log |