Kaptain.
Telegram /
LinkedIn /
Email /
GIT /
RSS /
GPG /

№ 8128 В разделе
Sysadmin
от March 11th, 2016,
В подшивках: Linux
asql это убер штука из репозитория дебиана\убунты, которая парсит логи apache\nginx в память и хранит их там в виде БД. Но “sql” не просто так в названии появилось. Эта мегакрутая херовина позволяет к полученой базе посылать sql запросы! Итак, простой пример из жизни по отлову ботнета, который усиленно пытался подобрать пароль к моему няшному бложику.
root@boroda:/var/log/nginx# asql asql v1.6 - type 'help' for help. asql> load access-blog.log Loading: access-blog.log asql> show The table 'log' table has the following columns: id - ID of the request source - IP, or hostname, which made the request. request - The HTTP request status - The HTTP status-code returned size - The size of the response served, in bytes. method - The HTTP method invoked (GET, PUT, POST etc). referer - The HTTP referer (sic). agent - The User-Agent which made the request. version - The HTTP version used by this client. date - The date and time at which the request was made. label - Any label applied when the logfile was read. user - The remote (authenticated) user, if any. asql> select distinct(source) from logs where request="/xmlrpc.php" 91.239.66.84 104.128.228.61 50.62.161.20 62.149.143.62 66.147.240.154 92.60.114.159 5.178.68.254 ....
Как вы видите, использование этой программы экстремально облегчает анализ логов. Полученый список IP отправляете в iptables. Чтобы забыть окончательно о проблеме заблокируйте доступ к xmlrpc.php 😉
Fortune cookie: A savvy young hooker named Gail Got busted and lodged in the jail. But the jailer got hot, To be lodged in her twat, And so Gail made the bail with her tail.
Leave a Reply