iptables -m string problem

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Author Message
Janevski
DD-WRT Novice


Joined: 21 Sep 2014
Posts: 3

PostPosted: Sun Sep 21, 2014 13:10    Post subject: iptables -m string problem Reply with quote
Hello,

I have TP-Link WDR3600 DD-WRT v24-sp2 (03/25/13) std (SVN revision 21061) and i need to use the iptables string match module.
I have tried manually downloading and deploying the iptables package from Optware and it works, however i've downloaded the iptables-mod-filter iptables module and the kmod-ipt-filter Linux kernel module too and so far i am not able to get the string match module working.

Tried insmod but it won't accept the module (xt_string) without any error message, come to think of it, it won't display stderr on anything, perhaps busybox related.

The error message generated using the Optware iptables is something within the lines of: "Couldn't load match `string':No such file or directory"

PS: Needless to say, i've googled for a solution to this problem for quite long, found some forum threads, but still no luck with dd-wrt.

Any help, advise, comment is welcomed and appreciated.

Best Regards,
Jovan
Sponsor
Sash
DD-WRT Guru


Joined: 20 Sep 2006
Posts: 17619
Location: Hesse/Germany

PostPosted: Mon Sep 22, 2014 8:59    Post subject: Reply with quote
iptables is already included in basic builds...so ipkg will not work in differing kernels
_________________
Forum Guidelines...How to get help
&
Forum Rules
&
RTFM/STFW
&
Throw some buzzwords into the WIKI search Exclamation
_________________
I'm NOT rude, just offer pure facts!
_________________
Atheros (TP-Link & Clones, etc ) debrick service in EU
_________________
Guide on HowTo be Safe, Secure and Protect Your Online Anonymity!
Janevski
DD-WRT Novice


Joined: 21 Sep 2014
Posts: 3

PostPosted: Mon Sep 22, 2014 21:21    Post subject: Reply with quote
Sash wrote:
iptables is already included in basic builds...so ipkg will not work in differing kernels


Hello Sash,

Thank You for Your comment.

Actually i am not using ipkg, opkg, nor ipkg-opt package manager, i manually add the packages to the /opt directory, which is a mount point of an USB flash storage.
The /opt directory is already included in the PATH environment variable, so no problem there.
I ran into some problems while trying to use ipkg, therefore i just use:
tar xzvf package-name.ipk
tar xzvf data.tar.gz
Until all dependencies are met, i guess it's not the smartest way, but it worked, so far, until now.

My initial problem is that my current dd-wrt stock iptables has no string search modules included with it. Therefore i am unable to use iptables -m string rules.

I have tried my rules on CentOS and Debian - they work.

Best Regards,
Jovan
Sash
DD-WRT Guru


Joined: 20 Sep 2006
Posts: 17619
Location: Hesse/Germany

PostPosted: Tue Sep 23, 2014 11:56    Post subject: Reply with quote
since we support word matching in the gui there must be a workaround for strings
_________________
Forum Guidelines...How to get help
&
Forum Rules
&
RTFM/STFW
&
Throw some buzzwords into the WIKI search Exclamation
_________________
I'm NOT rude, just offer pure facts!
_________________
Atheros (TP-Link & Clones, etc ) debrick service in EU
_________________
Guide on HowTo be Safe, Secure and Protect Your Online Anonymity!
Janevski
DD-WRT Novice


Joined: 21 Sep 2014
Posts: 3

PostPosted: Thu Sep 25, 2014 21:56    Post subject: Reply with quote
Sash wrote:
since we support word matching in the gui there must be a workaround for strings


Sash, thank You for Your reply.

I've considered using the built in weburl module, however it's intended for HTTP only according to the source code.

Here's the help function, source https://www.gargoyle-router.com/gargoyle/projects/gargoyle/repository/revisions/106256d13af4fa2d91ba3d1da88712cfd46d0955/entry/netfilter-match-modules/weburl/extension/libipt_weburl.c
Code:

...
static void help(void)
{
        printf(        "weburl options:\n  --contains [!] [STRING]\n  --contains_regex [!] [REGEX]\n --matches_exactly [!] [STRING]\n --domain_only\n --path_only\n");
}
...


And here's the initial filtering of only HTTP GET, POST and HEAD starting strings, source http://www.gargoyle-router.com/gargoyle/projects/gargoyle/repository/revisions/bf5d25d68a4686e489ad9a6d512ed1a8f48576be/entry/netfilter-match-modules/weburl/module/ipt_weburl.c
Code:

...
//first test if we're dealing with a web page request
if(strnicmp((char*)packet_data, "GET ", 4) == 0 || strnicmp(  (char*)packet_data, "POST ", 5) == 0 || strnicmp((char*)packet_data, "HEAD ", 5) == 0)
...


No luck for me there, i have the need for filtering beyond HTTP, weburl as it's name suggests, is bound to HTTP. Perhaps the string modules could go as a feature request? Compiled they don't seem that big, so it won't affect the dd-wrt images that much. The string module could even replace the weburl module, but it doesn't necessarily have to.

Best Regards,
Jovan
sillik
DD-WRT Novice


Joined: 15 Feb 2015
Posts: 1

PostPosted: Sun Feb 15, 2015 7:41    Post subject: Please yes! String matching as feature request... Reply with quote
iptables compiled for use with the string matching module... how I wish. I have a need that would be met perfectly with in-packet string matching. Even if the practical performance is imperfect by data broken across packets, it would be very, very useful to me.

How do I request this as a feature add for dd-wrt? I'm too ignorant (for now) to compile this feature as a submission to the community - if that's even allowed.

Thanks.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum