Unban 1 IP
1. Kiểm tra IP có bị chặn không.
iptables -v -L -n
2. Gỡ IP ra khỏi danh sánh
fail2ban-client set asterisk-cpbx unbanip 10.10.6.65
#!/bin/sh
# scan /var/log/secure for ssh attempts
# use iptables to block the bad guys
# Looking for attempts on existing and non-existing users. For example:
# Nov 2 22:44:07 pbxer sshd[28318]: Failed password for root from 74.143.42.70 port 52416 ssh2
# Nov 3 00:06:57 pbxer sshd[31767]: Failed password for invalid user mat3 from 192.203.145.200 port 35841 ssh2
tail -1000 /var/log/secure | awk '/sshd/ && /Failed password for/ { if (/invalid user/) try[$13]++; else try[$11]++; }
END { for (h in try) if (try[h] > 4) print h; }' |
while read ip
do
# note: check if IP is already blocked...
/sbin/iptables -L -n | grep $ip > /dev/null
if [ $? -eq 0 ] ; then
# echo "already denied ip: [$ip]" ;
true
else
# echo "Subject: denying ip: $ip" | /usr/sbin/sendmail notify@email.com
logger -p authpriv.notice "*** Blocking SSH attempt from: $ip"
/sbin/iptables -I INPUT -s $ip -j DROP
fi
done
awk does all the magic. It grabs relevant lines,
splits the lines into tokens, stores IP addresses in a hash and counts
how many times they were seen, and finally outputs all IP addresses that
were seen more than four times.# scan the secure log every 2 minutes */2 * * * * /root/scan-secure.sh
After a few months you might find that the iptables are started to get cluttered.
dd if=/dev/hda of=/dev/hdb
lspci | grep VGA00:02.0 VGA compatible controller: Intel Corporation 82852/855GM Integrated Graphics Device (rev 02):/path/to/socket to your hostname like this:define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpress');
define('DB_PASSWORD', 'wordpress');
define('DB_HOST', 'localhost:/tmp/mysql.sock'); // my computer has the mysql socket on /tmp/mysql.sock> mysql -u wordpress -p -h localhost wordpresss (backslash + s). That will give you a screen full of status information like this:skip-grant-tables below [mysqld]skip-grant-tables below [mysqld]SELECT table_schema "Data Base Name", sum( data_length + index_length) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;Command login Database:
root@sserver # free -m
total used free shared buffers cached
Mem: 12174 7824 4349 0 414 5953
-/+ buffers/cache: 1456 10718
Swap: 24003 241 23761
root@server # sync; echo 3 > /proc/sys/vm/drop_caches
root@server # free -m
total used free shared buffers cached
Mem: 12174 1684 10489 0 9 125
-/+ buffers/cache: 1549 10624
Swap: 24003 241 23761