Всички последващи примери са с мое IP, ще се наложи да си го смените
Ето как би изглеждала конфигурация, която блокира конкретни адреси за 3 часа, след 10 неуспешни опита:
Код: Избери всички
/ip firewall filter
add chain=input protocol=tcp dst-address=78.83.244.120 dst-port=21 src-address-list=ftp_blacklist action=drop comment="Dropvame izvestnite ni blacklist adresi"
add chain=output action=accept src-address=78.83.244.120 protocol=tcp src-port=21 content="530 Login incorrect" dst-limit=1/1m,9,dst-address/1m
add chain=output action=add-dst-to-address-list src-address=78.83.244.120 protocol=tcp src-port=21 content="530 Login incorrect" address-list=ftp_blacklist address-list-timeout=3h
Код: Избери всички
/ip firewall filter
add chain=input protocol=tcp dst-address=78.83.244.120 dst-port=21 src-address-list=ftp_blacklist action=drop comment="Dropvame izvestnite ni blacklist adresi"
/ip firewall mangle
add chain=output src-address=78.83.244.120 protocol=tcp src-port=21 content=530 Login incorrect dst-limit=1/1m,9,dst-address/1m action=accept
add chain=output src-address=78.83.244.120 protocol=tcp src-port=21 content=530 Login incorrect action=add-dst-to-address-list address-list=ftp_blacklist address-list-timeout=3h
За SSH нещата стоят малко по-различно, понеже не можем да четем криптираната сесия (в този пример се приемат до 3 връзки за минута):
Код: Избери всички
/ip firewall filter
add comment="dropvame nejelani vryzki" chain=input connection-mark=to_be_dropped action=drop
/ip firewall mangle
add chain=prerouting dst-address=78.83.244.120 protocol=tcp dst-port=22 connection-state=new dst-limit=1/1m,2,dst-address/1m action=mark-connection new-connection-mark=allowed_ssh passthrough=no
add chain=prerouting dst-address=78.83.244.120 protocol=tcp dst-port=22 packet-mark=!allowed_ssh connection-state=new action=mark-connection new-connection-mark=to_be_dropped passthrough=no
Естествено, би могло да маркирам и всички връзки от ftp_blocklist като връзки за дропване и да използвам общо 1 правило във филтъра.
ПС Не правете това на отдалечени рутери, до които нямате достъп (в случай на "гаф"):)