Community discussions

MikroTik App
 
ediaz
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Tue May 22, 2012 10:38 am

firewall filter rule for text string

Tue Jul 16, 2013 12:27 pm

Hi,

I want to block DNS requests for "isc.org" domain, which are being abused for a DDoS attack. I've created a filter rule:

/ip firewall filter
add action=drop chain=forward content="isc\03org" disabled=no dst-port=\
53 protocol=udp

But it does not work. If I create a similar rule without the \03org, it efectively blocks anything in the form "*isc*".

What is the sintaxt for the text matching in filter rules? Does it accept wildcards/regex in any way? DNS queries separate domain segments with ETX (0x03)

In the wiki I can only find:

http://wiki.mikrotik.com/wiki/Manual:IP/Firewall/Filter

content (string; Default: ) Match packets that contain specified text

Regards
 
ediaz
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 59
Joined: Tue May 22, 2012 10:38 am

Re: firewall filter rule for text string

Tue Jul 16, 2013 12:35 pm

A smart guy here at the office did a fuzzy and dirty trick that just works:

echo -e '\003' > tmpfile
he the did cut&paste from that file to the web browser (opera).

The filter rule now shows:

0 chain=forward action=drop protocol=udp dst-port=53 content=\03isc\03org

where the "\03" show in blue (if I enter it manually from ssh console or other browser, it shows in regular grey).

While this solves our problem now, I would rather know how to enter this kind of characters in a filter rule in a cleaner way.

Regards
 
Rudios
Forum Veteran
Forum Veteran
Posts: 973
Joined: Mon Mar 11, 2013 12:58 pm
Location: The Netherlands

Re: firewall filter rule for text string

Tue Jul 16, 2013 2:02 pm

You should assign the rule to your input chain, not on the forward chain
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: firewall filter rule for text string

Tue Jul 23, 2013 3:25 am

try 'export' instead of 'print' command

UPD:
/ip firewall mangle set 8 content="isc\03org"
works fine for me, "\03" is in blue when doing 'print'

Who is online

Users browsing this forum: anav, maldridge, rcarreira88 and 79 guests