Вот несколько правил брандмауэра, чтобы остановить/замедлить подборщики паролей, пытающихся взломать ваш FTP-сервер. В этом примере FTP-сервер — маршрутизатор MikroTik. Чтобы защитить FTP-сервер за MikroTik, нужно использовать цепочку forward вместо цепочек input и output. Начальный этап (этап 1) добавляет IP-адрес во временный список адресов ftp_stage1 (таймауты через 1 минуту). А затем каждая попытка входа в течение минуты запускает следующие этапы (этап 2 - этап 4) до тех пор, пока не достигнет последнего этапа (этап 5), который добавляет IP-адрес в ftp_blacklist (таймауты через 1 неделю). Нужно изменить in-interface на что-то другое, если ether1 — это не сетевая карта (NIC), подключенная к Интернету. Это правило отбрасывает всех перечисленных подборщиков паролей / ip firewall filter
add chain=input in-interface=ether1 protocol=tcp dst-port=21 src-address-list=ftp_blacklist action=drop
comment="drop ftp brute forcers" disabled=no Это правило добавляет подборщиков паролей в черный список (четвертая попытка входа в течение минуты) / ip firewall filter
add chain=output content="530 Login incorrect" dst-address-list=ftp_stage4 action=add-dst-to-address-list
address-list=ftp_blacklist address-list-timeout=1w comment="auto-firewall ftp - stage 5" disabled=no Третья попытка входа (в течение минуты) / ip firewall filter
add chain=output content="530 Login incorrect" dst-address-list=ftp_stage3 action=add-dst-to-address-list
address-list=ftp_stage4 address-list-timeout=1m comment="auto-firewall ftp - stage 4" disabled=no Вторая попытка входа (в течение минуты) / ip firewall filter
add chain=output content="530 Login incorrect" dst-address-list=ftp_stage2 action=add-dst-to-address-list
address-list=ftp_stage3 address-list-timeout=1m comment="auto-firewall ftp - stage 3" disabled=no Первая попытка входа (в течение минуты) / ip firewall filter
add chain=output content="530 Login incorrect" dst-address-list=ftp_stage1 action=add-dst-to-address-list
address-list=ftp_stage2 address-list-timeout=1m comment="auto-firewall ftp - stage 2" disabled=no Начальный этап / ip firewall filter
add chain=input in-interface=ether1 protocol=tcp dst-port=21 action=add-src-to-address-list
address-list=ftp_stage1 address-list-timeout=1m comment="auto-firewall ftp - stage 1" disabled=no
add chain=input in-interface=ether1 protocol=tcp dst-port=21 src-address-list=ftp_blacklist action=drop
comment="drop ftp brute forcers" disabled=no Это правило добавляет подборщиков паролей в черный список (четвертая попытка входа в течение минуты) / ip firewall filter
add chain=output content="530 Login incorrect" dst-address-list=ftp_stage4 action=add-dst-to-address-list
address-list=ftp_blacklist address-list-timeout=1w comment="auto-firewall ftp - stage 5" disabled=no Третья попытка входа (в течение минуты) / ip firewall filter
add chain=output content="530 Login incorrect" dst-address-list=ftp_stage3 action=add-dst-to-address-list
address-list=ftp_stage4 address-list-timeout=1m comment="auto-firewall ftp - stage 4" disabled=no Вторая попытка входа (в течение минуты) / ip firewall filter
add chain=output content="530 Login incorrect" dst-address-list=ftp_stage2 action=add-dst-to-address-list
address-list=ftp_stage3 address-list-timeout=1m comment="auto-firewall ftp - stage 3" disabled=no Первая попытка входа (в течение минуты) / ip firewall filter
add chain=output content="530 Login incorrect" dst-address-list=ftp_stage1 action=add-dst-to-address-list
address-list=ftp_stage2 address-list-timeout=1m comment="auto-firewall ftp - stage 2" disabled=no Начальный этап / ip firewall filter
add chain=input in-interface=ether1 protocol=tcp dst-port=21 action=add-src-to-address-list
address-list=ftp_stage1 address-list-timeout=1m comment="auto-firewall ftp - stage 1" disabled=no