/ip firewall filter
add action=drop chain=input comment=Bogon_Drop in-interface=ether1 src-address-list=BOGON
add action=drop chain=forward in-interface=ether1 src-address-list=BOGON
add action=drop chain=forward comment=Drop_rdp_black_list dst-port=3389 in-interface=ether1 log=yes \
log-prefix=firewall protocol=tcp src-address-list=Rdp_black_list
add action=drop chain=input comment="Drop invalid packet" connection-state=invalid in-interface=ether1
add action=drop chain=forward connection-state=invalid
add action=drop chain=forward comment=Port_scanner_drop src-address-list="port scanners"
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=10m chain=forward \
comment="Port Scaner Detected" in-interface=ether1 protocol=tcp psd=21,3s,3,1
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=10m chain=forward \
in-interface=ether1 protocol=tcp tcp-flags=fin,!syn,!rst,!psh,!ack,!urg
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=10m chain=forward \
in-interface=ether1 protocol=tcp tcp-flags=fin,syn
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=10m chain=forward \
in-interface=ether1 protocol=tcp tcp-flags=syn,rst
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=10m chain=forward \
in-interface=ether1 protocol=tcp tcp-flags=fin,psh,urg,!syn,!rst,!ack
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=10m chain=forward \
in-interface=ether1 protocol=tcp tcp-flags=fin,syn,rst,psh,ack,urg
add action=add-src-to-address-list address-list="port scanners" address-list-timeout=10m chain=forward \
in-interface=ether1 protocol=tcp tcp-flags=!fin,!syn,!rst,!psh,!ack,!urg
add action=accept chain=input comment="Accept established,related" connection-state=established,related
add action=accept chain=input comment="Accept ICMP" protocol=icmp
add action=accept chain=input in-interface=bridge-office
add action=accept chain=input in-interface=bridge-ats
add action=accept chain=input in-interface=bridge-wi-fi
add action=accept chain=input in-interface=bridge-servers
add action=accept chain=input connection-state=established,related disabled=yes in-interface=ether1
add action=accept chain=input comment="PPTP Vpn" dst-address=176.106.244.2 dst-port=1723 in-interface=\
ether1 protocol=tcp
add action=accept chain=input protocol=gre
add action=accept chain=input comment=WinBox dst-address=176.106.244.2 dst-port=1357 in-interface=ether1 \
protocol=tcp
add action=drop chain=input comment="drop other packet"
add action=accept chain=forward comment="accept established,related" connection-state=established,related \
in-interface=ether1
add action=accept chain=forward comment="accept ICMP" protocol=icmp
add action=accept chain=forward comment="Accept ithernet" out-interface=ether1
add action=accept chain=forward in-interface=bridge-office
add action=accept chain=forward in-interface=bridge-wi-fi
add action=accept chain=forward in-interface=bridge-servers
add action=accept chain=forward in-interface=bridge-ats
add action=accept chain=forward comment="Web host Port" dst-address=192.168.0.100 dst-port=80 \
in-interface=ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward comment="Https Port" dst-address=192.168.0.100 dst-port=443 in-interface=\
ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward comment="Dns Port" dst-address=192.168.0.100 dst-port=53 in-interface=\
ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward dst-address=192.168.0.100 dst-port=53 in-interface=ether1 out-interface=\
bridge-servers protocol=udp
add action=accept chain=forward comment="Ftp Port" dst-address=192.168.0.100 dst-port=21 in-interface=\
ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward comment="Pop3 Port" dst-address=192.168.0.100 dst-port=110 in-interface=\
ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward dst-address=192.168.0.100 dst-port=995 in-interface=ether1 out-interface=\
bridge-servers protocol=tcp
add action=accept chain=forward comment="Imap Port" dst-address=192.168.0.100 dst-port=143 in-interface=\
ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward dst-address=192.168.0.100 dst-port=993 in-interface=ether1 out-interface=\
bridge-servers protocol=tcp
add action=accept chain=forward comment="Smtp Port" dst-address=192.168.0.100 dst-port=25 in-interface=\
ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward dst-address=192.168.0.100 dst-port=465 in-interface=ether1 out-interface=\
bridge-servers protocol=tcp
add action=accept chain=forward comment="Tor Port" dst-address=192.168.0.100 dst-port=9050 in-interface=\
ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward comment="Elasticsearch Port" dst-address=192.168.0.100 dst-port=9200 \
in-interface=ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward comment="IspManager port" dst-address=192.168.0.100 dst-port=1500 \
in-interface=ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward dst-address=192.168.0.101 dst-port=1501 in-interface=ether1 \
out-interface=bridge-servers protocol=tcp
add action=accept chain=forward comment="Ssh Port" dst-address=192.168.0.100 dst-port=2000 in-interface=\
ether1 out-interface=bridge-servers protocol=tcp
add action=add-src-to-address-list address-list=Rdp_black_list address-list-timeout=2w chain=forward \
comment=Rdp_add_black_list connection-state=new dst-port=3389 in-interface=ether1 protocol=tcp \
src-address-list=Rdp_stage3
add action=add-src-to-address-list address-list=Rdp_stage3 address-list-timeout=3m10s chain=forward \
comment=Rdp_stage3,2,1 connection-state=new dst-port=3389 in-interface=ether1 protocol=tcp \
src-address-list=Rdp_stage2
add action=add-src-to-address-list address-list=Rdp_stage2 address-list-timeout=3m10s chain=forward \
connection-state=new dst-port=3389 in-interface=ether1 protocol=tcp src-address-list=Rdp_stage1
add action=add-src-to-address-list address-list=Rdp_stage1 address-list-timeout=3m10s chain=forward \
connection-state=new dst-port=3389 in-interface=ether1 protocol=tcp
add action=accept chain=forward comment="Rdp Port" dst-address=192.168.0.105 dst-port=3389 in-interface=\
ether1 out-interface=bridge-servers protocol=tcp
add action=accept chain=forward comment="Ats Port" dst-address=192.168.2.101 dst-port=16000-16255 \
in-interface=ether1 out-interface=bridge-servers protocol=udp
add action=drop chain=forward comment="drop others forward packet"