Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: CentOS for servers and Ubuntu for desktop
Posts: 25
Rep:
TARPIT and newer kernels
I specialize in ddos protected and high risk hosting, Im always trying to find better ways of blocking what gets to the server. Recently I checked out this article on http://www.secureworks.com/research/...s/?threat=ddos
And thought that would be a pretty awesome way to ban, if teh people with bots in their pc didnt think anything was going on they sure would when they get banned by that, well in theory.
So I got patch-o-matic, patched the iptables, compiled fine. Then I patched the kernel 2.6.22.2-grsecurity and on make modules it fails everytime at the tarpit module. The module was selectable from menuconfig so it does look like the patch went throug jut didnt on make. I tried a few different things to no avail would not compile.
Question is has anyone got this module working with the newer kernels? If so did you run into any problems? And anyone with any experience running the module any input would be appreciated
And do you think the grsecurity patches may have gotten in the way somehow?
The artcle isnt that old but they never said what kernel they used and all that unless I completely missed it.
I have the same problem, even with (near-) vanilla kernel 2.6.22, so do not blame grsecurity. I think that TARPIT is just outdated, needs to update to newer kernel API. Unfortunately netfilter bugzilla does not work for me. ( https://bugzilla.netfilter.org/bugzilla/index.cgi )
The exact error follows (also to help people googling exact phrase to find this thread):
Code:
CC [M] net/ipv4/netfilter/ipt_TARPIT.o
net/ipv4/netfilter/ipt_TARPIT.c: In function ‘tarpit_tcp’:
net/ipv4/netfilter/ipt_TARPIT.c:87: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:90: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:91: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:92: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:103: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:104: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:122: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:122: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:126: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:127: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:130: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:130: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:130: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:130: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:130: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:130: warning: type defaults to ‘int’ in declaration of ‘type name’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:137: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:162: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:163: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:167: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:168: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:169: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:179: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:182: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:183: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:186: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:187: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:187: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:188: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c: In function ‘tarpit’:
net/ipv4/netfilter/ipt_TARPIT.c:231: error: ‘struct sk_buff’ has no member named ‘nh’
net/ipv4/netfilter/ipt_TARPIT.c:235: error: ‘struct sk_buff’ has no member named ‘nh’
make[3]: *** [net/ipv4/netfilter/ipt_TARPIT.o] Error 1
Last edited by strohel; 08-31-2007 at 01:27 PM.
Reason: typos
I really wish someone would develop and update this module, it would be very handy.
And oh, that article I heard about it from was only published like a month or two ago so they probably used 2.4 kernels or something
To be fair, the sk_buff API change was officially merged in late April, and applies only to kernels greater than or equal to 2.6.22 (which was released in July).
Luckily, complying with the new API should be trivial. For example, try this search-and-replace on an affected source file:
Code:
sed 's/\([a-zA-Z_][a-zA-Z0-9_]*\)->nh.iph/ip_hdr(\1)/'
(where boldface represents text I typed at the command-line)
NOTICE: These changes may result in a file incompatible with kernels older than 2.6.22. If you want an always-working solution, use the patch-o-matic system to enable checking for kernel sublevel versions and provide two versions of the file. Alternatively you might armor each change with conditional compilation measures (by using #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) … #else … #endif)
Distribution: CentOS for servers and Ubuntu for desktop
Posts: 25
Original Poster
Rep:
UPDATE: I tried doing what you suggested but didnt work for me, I may just make a 2.6.21.5 hardened kernel and use it. Id rather have a new kernel though so Ill keep trying
Distribution: CentOS for servers and Ubuntu for desktop
Posts: 25
Original Poster
Rep:
Code:
root@cp [/src/linux/net/ipv4/netfilter]# \make TARPIT
make: *** No rule to make target `TARPIT'. Stop.
root@cp [/src/linux/net/ipv4/netfilter]# cd /src/linux
root@cp [/src/linux]# make modules
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CALL scripts/checksyscalls.sh
CC [M] net/ipv4/netfilter/ipt_TARPIT.o
net/ipv4/netfilter/ipt_TARPIT.c: In function 'tarpit_tcp':
net/ipv4/netfilter/ipt_TARPIT.c:82: warning: missing initializer
net/ipv4/netfilter/ipt_TARPIT.c:82: warning: (near initialization for 'fl.oif')
net/ipv4/netfilter/ipt_TARPIT.c:87: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:90: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:91: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:92: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:103: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:104: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:119: error: 'struct sk_buff' has no member named 'nf_debug'
net/ipv4/netfilter/ipt_TARPIT.c:122: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:122: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:126: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:127: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: warning: type defaults to 'int' in declaration of 'type name'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:137: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:162: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:163: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:167: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:168: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:169: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:179: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:182: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:183: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:186: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:187: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:187: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:188: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c: In function 'tarpit':
net/ipv4/netfilter/ipt_TARPIT.c:231: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:235: error: 'struct sk_buff' has no member named 'nh'
make[3]: *** [net/ipv4/netfilter/ipt_TARPIT.o] Error 1
make[2]: *** [net/ipv4/netfilter] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2
felosi: From the error, it looks like you haven't applied anything. Note that if you typed exact command as osor, it didn't change any file, it just showed the difference (output of sed command was piped to the diff command). In order to actually apply it, redirect output from sed to temporary file (sed '....' ipt_TARPIT.c > ipt_TARPIT.c.new), check the differences (diff -u ipt_TARPIT.c ipt_TARPIT.c.new) and then replace the ipt_TARPIT.c with your temporary file.
Note that if you typed exact command as osor, it didn't change any file, it just showed the difference (output of sed command was piped to the diff command).
Yes, sorry about that, I should have been more clear. The command that I entered only gives you a diff that you can apply with the patch utility. If you want to, you can apply the changes to the file “in-place” by using “sed … -i” on the file.
E.g.,
Code:
sed 's/\([a-zA-Z_][a-zA-Z0-9_]*\)->nh.iph/ip_hdr(\1)/' -i ipt_TARPIT.c
Distribution: CentOS for servers and Ubuntu for desktop
Posts: 25
Original Poster
Rep:
Ok thanks, Ill try it now. Sorry about that Im not too keen on this type of work yet. Ill do it now and see how it goes
UPDATE: Ok, I did the command osor posted above, this time i got less errors but some the same:
Quote:
net/ipv4/netfilter/ipt_TARPIT.c: In function 'tarpit_tcp':
net/ipv4/netfilter/ipt_TARPIT.c:82: warning: missing initializer
net/ipv4/netfilter/ipt_TARPIT.c:82: warning: (near initialization for 'fl.oif')
net/ipv4/netfilter/ipt_TARPIT.c:119: error: 'struct sk_buff' has no member named 'nf_debug'
net/ipv4/netfilter/ipt_TARPIT.c:122: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
net/ipv4/netfilter/ipt_TARPIT.c:130: warning: type defaults to 'int' in declaration of 'type name'
net/ipv4/netfilter/ipt_TARPIT.c:187: error: 'struct sk_buff' has no member named 'nh'
make[3]: *** [net/ipv4/netfilter/ipt_TARPIT.o] Error 1
make[2]: *** [net/ipv4/netfilter] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2
Ill try a few other things and see what happens.
I did what strohel said and got this error
Code:
net/ipv4/netfilter/ipt_TARPIT.c: In function 'tarpit_tcp':
net/ipv4/netfilter/ipt_TARPIT.c:82: warning: missing initializer
net/ipv4/netfilter/ipt_TARPIT.c:82: warning: (near initialization for 'fl.oif')
net/ipv4/netfilter/ipt_TARPIT.c:119: error: 'struct sk_buff' has no member named 'nf_debug'
net/ipv4/netfilter/ipt_TARPIT.c:130: error: 'struct sk_buff' has no member named 'nh'
make[3]: *** [net/ipv4/netfilter/ipt_TARPIT.o] Error 1
make[2]: *** [net/ipv4/netfilter] Error 2
make[1]: *** [net/ipv4] Error 2
make: *** [net] Error 2
UPDATE: Ok, I did the command osor posted above, this time i got less errors but some the same:
I did what strohel said and got this error
I made a couple errors in my solution.
The first is very simple, I left out a “/g” flag in the sed command. This basically means the find-and-replace will only work on the first match found in a line, and leave the rest of the text on that line alone. The problem is there are a few lines which use the same construct two times, and there is one line that uses it three times. In your case, you end up applying the find-and-replace one time when you followed my instructions, and you end up applying it two times when you followed strohel’s instructions. To remedy this, you can either apply the sed command a third time, or apply this modified sed command to the original file:
Code:
sed 's/\([a-zA-Z_][a-zA-Z0-9_]*\)->nh.iph/ip_hdr(\1)/g' -i ipt_TARPIT.c
(notice the added “g” flag.)
The second error I made was not looking closely enough at all your reported errors! In particular, I overlooked
Code:
net/ipv4/netfilter/ipt_TARPIT.c:119: error: 'struct sk_buff' has no member named 'nf_debug'
I’m not sure what this is still doing in the module (nf_debug was removed from the API over two years ago). To remedy this, just delete lines 118-120. I.e., delete these three lines:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.