====== Exim и ylmf-pc ======
Я пришёл к тебе с elho рассказать что в спамкоп ты сейчас уедешь неопытный админ.
Обнаружил в логах странные записи. Оказалось это [[https://en.wikipedia.org/wiki/Cutwail_botnet|старый ботнет Cutwail]].
В reject.log ежедневно подобные записи
# cat /var/log/exim/reject.log | grep ylmf-pc
2017-11-29 19:52:16 auth_login authenticator failed for (ylmf-pc) [84.199.232.154]: 535 Incorrect authentication data
2017-11-29 19:52:26 auth_login authenticator failed for (ylmf-pc) [84.199.232.154]: 535 Incorrect authentication data
2017-11-29 22:57:37 auth_login authenticator failed for mail.hhint.nl (ylmf-pc) [213.126.55.154]: 535 Incorrect authentication data
2017-11-29 22:57:47 auth_login authenticator failed for mail.hhint.nl (ylmf-pc) [213.126.55.154]: 535 Incorrect authentication data
2017-11-29 23:50:00 auth_login authenticator failed for (ylmf-pc) [187.4.230.17]: 535 Incorrect authentication data
2017-11-29 23:50:11 auth_login authenticator failed for (ylmf-pc) [187.4.230.17]: 535 Incorrect authentication data
2017-11-30 08:33:57 auth_login authenticator failed for ghe1544479.lnk.telstra.net (ylmf-pc) [101.187.124.125]: 535 Incorrect authentication data (set_id=sales@portia.ru)
2017-11-30 08:34:14 auth_login authenticator failed for ghe1240337.lnk.telstra.net (ylmf-pc) [149.135.117.174]: 535 Incorrect authentication data (set_id=sales@portia.ru)
===== Как с этим бороться? =====
==== Exim ====
Подсказки на Github
* https://github.com/Exim/exim/wiki/BlockCracking
* https://github.com/Exim/exim/wiki/AclHeloTricks
Блокируем один HELO
acl_smtp_helo = acl_check_helo
acl_smtp_helo:
#BEGIN ACL_SMTP_HELO_BLOCK
drop
condition = ${if eq {$sender_helo_name}{ylmf-pc} {yes}{no}}
log_message = HELO/EHLO - ylmf-pc blocked
message = I Nailed You at HELO
accept
#END ACL_SMTP_HELO_BLOCK
Блокируем несколько HELO (пример [[https://www.watters.ws/mediawiki/index.php/Block_SMTP_connections_based_on_HELO_name|отсюда]], не проверял, но наверное работает)
acl_check_helo:
accept
hosts = +own_hosts
deny condition = ${if or { \
{eq {${lc:$sender_helo_name}}{example.com}} \
{eq {${lc:$sender_helo_name}}{1.2.3.4}} \
} {true}{false} }
accept
==== Exim с установленным WHM/cPanel ====
Рассмотрим ещё один вариант, когда нужно заблокировать более одного HELO.
* https://forums.cpanel.net/threads/how-to-block-based-on-helo-in-exim-advanced-editor.461451/
* https://lists.exim.org/lurker/message/20150326.170521.15314088.it.html
- Создаём файл ''/etc/heloblocks'' где будут перечислены HELO, которые мы будем блокировать
- В WHM переходим Exim Configuration Manager → Advanced Editor.
- Ищем ''acl_smtp_helo'', в ''custom_begin_smtp_helo'' добавляем
drop
condition = ${lookup{$sender_helo_name}lsearch{/etc/heloblocks}{yes}{no}}
log_message = HELO/EHLO - ylmf-pc blocked
message = ylmf-pc blocked
accept
{{:linux:mail:exim_acl_smtp_helo.png?nolink|}}
Файл ''/etc/heloblocks''
ylmf-pc
yarde.com
==== Postfix ====
Нечасто работаю с Postfix, поэтому оставлю только одну ссылку - https://bløgg.no/tag/ylmf-pc/, возможно когда-нибудь пригодится.
Блокировка топором через iptables
iptables -A INPUT -p tcp --dport 25 -m string --string ylmf-pc --algo bm -j DROP
===== Как проверить, что это исправило ситуацию? =====
Подключимся по телнету (омг, 2017 год! Я всё ещё его использую) и представимся по форме
Вывод Windows CMD
220 mx.foobar.com ESMTP Exim 4.88 Fri, 01 Dec 2017 15:33:50 +0300
helo ylmf-pc
550 Administrative prohibition
Подключение к узлу утеряно.
В reject.log запись такая
2017-12-01 15:33:58 H=(ylmf-pc) [188.x.y.z] rejected EHLO or HELO ylmf-pc: HELO/EHLO - ylmf-pc blocked
===== Ссылки =====
* https://serverfault.com/questions/667322/email-server-attack-from-telnet
* https://utcc.utoronto.ca/~cks/space/blog/spam/YlmfPcPlague
* http://unixa.ru/korotko-o-glavnom-./blokiruem-ylmf-pc-na-exim.html
* http://www.astrohip.com/zablokirovat-ylmf-pc-exim/
* http://www.remetter.de/os_linux_dienste_exim.php