netfilter-devel digest, Vol 1 #479 - 13 msgs
A message that is not in the archive (sent off-list or not yet received): 20030522153802.23426.74032.Mailman@kashyyyk
----- Original Message -----
From: <[email protected]>
To: <[email protected]>
Sent: Thursday, May 22, 2003 11:38 PM
Subject: netfilter-devel digest, Vol 1 #479 - 13 msgs
Quoted 719 lines
Send netfilter-devel mailing list submissions to
[email protected]To subscribe or unsubscribe via the World Wide Web, visit
https://lists.netfilter.org/mailman/listinfo/netfilter-devel
or, via email, send a message with subject or body 'help' to [email protected]You can reach the person managing the list at
[email protected]When replying, please edit your Subject line so it is more specific than "Re: Contents of netfilter-devel digest..."
Today's Topics:
1. Re:Interesting failure with RPC state tracker (Ian Latter)
2. L2TP protocol source port number changed (ChungLiang)
3. Re: L2TP protocol source port number changed (Patrick Schaaf)
4. Re: L2TP protocol source port number changed (Patrick Schaaf)
5. Re: L2TP protocol source port number changed (ChungLiang)
6. Re: L2TP protocol source port number changed (Patrick Schaaf)
7. Re: L2TP protocol source port number changed (ChungLiang)
8. Re: L2TP protocol source port number changed (Patrick Schaaf)
9. updated ctnetlink (Balazs Scheidler)
10. Re: updated ctnetlink (Martin Josefsson)
11. Re: updated ctnetlink (Balazs Scheidler)
12. Re: updated ctnetlink (Martin Josefsson)
13. Re: Re:Interesting failure with RPC state tracker (Brian J. Murrell)--__--__--
Message: 1
To: "Brian J. Murrell" <[email protected]>
Subject: Re:Interesting failure with RPC state tracker
From: "Ian Latter" <[email protected]>
Cc: [email protected]
Date: Thu, 22 May 2003 09:24:06 +1000
Reply-To: "Ian Latter" <[email protected]>Hello Brian and Dev ppls,
I have been thinking about this recently ... after being informed of a
pointer error on the module name I've taken to doing a bit of research on the whole kernel module thing.I'll post a link on it later, but I found a site that discussed the RPC
module within Firewall-1 in greater detail than I had seen previously.One of the things that Firewall-1's RPC code did, that I didn't like, was
that if you choose to "match" an RPC, then the matching module will automatically allow RPC portmapper requests through the firewall. I don't like the idea of "hidden rules", and hence in the Netfilter version, you need to permit the RPC portmapper requests explicitly. So what you've seen is correct ... and this sort of ruleset;Usage:
The intended usage of these modules would be with a ruleset like;
# New session from client to server (portmapper get) -A PREROUTING -t nat -i eth0 -p udp -m rpc --rpcs 100002
-s ${client} --sport 0:1023 -d ${server} --dport 111 -j ACCEPT# Continued session from client to server (portmapper answer) -A PREROUTING -t nat -i eth1 -m state -p udp
-s ${server} --sport 111 -d ${client} --dport 0:1023 --state ESTABLISHED -j ACCEPT.. should work ... (was this what you found?) .. except for the "DUMP" request. I'll need to read up on this one (I remember reading it through when I rejigged the module, but I ended up discarding it).
There are two other features in the Firewall-1 RPC code that I want
to add to the Netfilter RPC module;1) Cached portmapper resolution -- establishing a slab cache the dynamically stores the port vs the procedure number in memory such that future RPC portmapper requests are redundant
2) A kernel socket call to the RPC portmapper -- in case the RPC module or rule is only activated after the client has already performed a portmapper resolution request, currently the RPC module would fail to permit the valid RPC request. If, however, the RPC port range was treated as a possible set of RPC "targets", but for which a valid (matched) IP address had failed to resolve a port for a given procedure; then the RPC module would make its own request to the portmapper to resolve the port and validate the match. The resolution could then be added to the local slab cache to accelerate future matches.
While it *sounds* like I'm a great guy ready to do big things, the truth is
that I haven't fixed my pointer module name problem in three weeks, so these mods might be a little way off ;-)I am very appreciative of feedback on the use of this module and your
successes/failures. Of particular interest is performance ... let me know how you go with thrashing this thing under NFS ... because that is one of the big unanswered questions here ..Thanks for the feedback ... I'll check out that DUMP command and see
what I can do ... which kernel version are you using?(Cool database software, btw, I implemented it for an ISP in AU who had heard of it and used it before).
----- Original Message -----
Quoted 21 lines
From: "Brian J. Murrell" <[email protected]>
To: <[email protected]>
Subject: Interesting failure with RPC state tracker
Date: Wed, 21 May 2003 17:58:55 -0400I have been trying to get NFS to work through Netfilter with the rpc mdoule in p-o-m/extra.
I have finally gotten it to work successfully, but the struggle I had getting it to work had an interesting outcome.
The reason my initial attempts failed is because the RPC tracking module depends on intercepting GETPORT calls and opening expectations on the assumption that if a client asks for the port for a given service on a given server, it will want to connect to it.
The problem that this causes with Linux's "mount" command is that the mount command (in util-linux) does a RPC portmap "DUMP" (tcp:111 on the server) just like "rpcinfo -p" does. It then extracts the port number from there.
Quoted 11 lines
If you put a rule in the filter to block access to the portmapper's TCP port on the server, the above process fails and then normal RPC processing continues, with a GETPORT call to determine the port number.
Thots?
b.
Signature · 1 line
Brian J. Murrell <[email protected]>--
Ian Latter
Internet and Networking Security Officer
Macquarie University--__--__--
Message: 2
Date: Thu, 22 May 2003 13:04:39 +0800
From: ChungLiang <[email protected]>
To: [email protected]
Subject: L2TP protocol source port number changedHello,
I have tried L2TP protocol under netfiler and it seems the second connection's source port will be changed to 1024 from 1071.
But I remember seeing some build having both connection having the source port staying at 1071. Does anybody have any comment on this issue? What should be done at the compile time to let multiple connection use the same outgoing port? Thanks a lot.
Best regards,
ChungLiang--__--__--
Message: 3
Date: Thu, 22 May 2003 07:59:21 +0200
From: Patrick Schaaf <[email protected]>
To: ChungLiang <[email protected]>
Cc: [email protected]
Subject: Re: L2TP protocol source port number changedQuoted 2 lines
I have tried L2TP protocol under netfiler and it seems the second connection's source port will be changed to 1024 from 1071.
From reading the RFC for L2TP, it is clear that only the first, initial packet establishing a new tunnel, will have 1701 (not 1071, that was probably a typo?) as the _destination_ port. By answering with different ports, a LNS can switch the operational tunnel around onto other ports - and even onto a different endpoint IP address!
The RFC even alludes to problems with NAT devices (and consequently stateful tracking).
In practise, at least between ERX and Cisco systems, this appears to be avoided, and communication runs source/dest port 1701. However, by misconfiguring the Cisco LNS, I could clearly see the endpoint IP address switching. It is not unlikely that once the 2^16 session IDs of a single tunnel run out, that the Cisco will switch to an additional tunnel on nonstandard ports.
For a proper solution, somebody would need to write a conntrack helper for L2TP, to setup expectations / create RELATED connections, by analyzing the tunnel establishment. As far as I can see, such a setup would then provide a security hole enabling an attacker to permit more or less arbitrary UDP traffic, if they can hand-craft a suitable packet. So one needs to be very careful. NOTE: that's a vague feeling of mine, I have not analysed this deeply.
best regards
Patrick--__--__--
Message: 4
Date: Thu, 22 May 2003 08:10:46 +0200
From: Patrick Schaaf <[email protected]>
To: ChungLiang <[email protected]>
Cc: [email protected]
Subject: Re: L2TP protocol source port number changedChungLiang & all,
my previous mail was a bit wrong on the real problem with L2TP:
Seeing the initial tunnel establishment packet from LAC to LNS, one can NOT infer the IP address and port that the LNS will use for the second, acknowledging, packet. The LNS is free to choose one, it just has to answer back to the LAC and the port the LAC used in the initial packet.
Thus, no exact expectation can be set up by inspecting the initial packet; you need to capture any UDP traffic flowing back to the initial LAC IP/port, and use the source information of that captured packet to then set up the expectation.
Does the current NAT core allow such a partial expectation setup?
best regards
Patrick--__--__--
Message: 5
Date: Thu, 22 May 2003 14:25:57 +0800
From: ChungLiang <[email protected]>
To: Patrick Schaaf <[email protected]>
Cc: [email protected]
Subject: Re: L2TP protocol source port number changedDear Patrick,
Thanks for your reply and I am sorry for my typo.
Maybe I did not state my question clearly enough so I will do it again. From what I seem on the packets, it seems that microsoft L2TP server will only response with both source and destination port set to 1701.
And I have seen linux build which works. This means that for different computers connecting through this linux route's netfilter to have 1701 as both source and destination port number. So it works.
Now I have build my own linux router and found out the second computer will not have the source port staying at 1701 but changing to 1024 by the NAT. I am wondering what should I do to make this go away and stay at 1701. Thanks.
Best regards,
ChungLiangQuoted 28 lines · Patrick Schaaf
Quoted 5 lines
I have tried L2TP protocol under netfiler and it seems the second connection's source port will be changed to 1024 from 1071.
From reading the RFC for L2TP, it is clear that only the first,
initial packet establishing a new tunnel, will have 1701 (not 1071, that was probably a typo?) as the _destination_ port. By answering with different ports, a LNS can switch the operational tunnel around onto other ports - and even onto a different endpoint IP address!
The RFC even alludes to problems with NAT devices (and consequently stateful tracking).
In practise, at least between ERX and Cisco systems, this appears to be avoided, and communication runs source/dest port 1701. However, by misconfiguring the Cisco LNS, I could clearly see the endpoint IP address switching. It is not unlikely that once the 2^16 session IDs of a single tunnel run out, that the Cisco will switch to an additional tunnel on nonstandard ports.
For a proper solution, somebody would need to write a conntrack helper for L2TP, to setup expectations / create RELATED connections, by analyzing the tunnel establishment. As far as I can see, such a setup would then provide a security hole enabling an attacker to permit more or less arbitrary UDP traffic, if they can hand-craft a suitable packet. So one needs to be very careful. NOTE: that's a vague feeling of mine, I have not analysed this deeply.
Quoted 4 lines
best regards
Patrick--__--__--
Message: 6
Date: Thu, 22 May 2003 08:30:17 +0200
From: Patrick Schaaf <[email protected]>
To: ChungLiang <[email protected]>
Cc: [email protected]
Subject: Re: L2TP protocol source port number changedQuoted 4 lines
Now I have build my own linux router and found out the second computer will not have the source port staying at 1701 but changing to 1024 by the NAT. I am wondering what should I do to make this go away and stay at 1701. Thanks.
NOW I get you. Easy: change your NAT rules suitably. All decisions about WHAT should be NATted, are made by YOUR rules.
If you don't know how to do that, please go ask the [email protected] mailing list. It is now not a _development_ question.
best regards
Patrick--__--__--
Message: 7
Date: Thu, 22 May 2003 14:46:13 +0800
From: ChungLiang <[email protected]>
To: Patrick Schaaf <[email protected]>
Cc: [email protected]
Subject: Re: L2TP protocol source port number changedDear Patrick,
Yes, that could be done in the rules one way or another. What I am wondering is that the rules are the same in both routers with same kernel version. So I am curious what compiler option or something needs to be set to achieve the result. Thanks.
Best regards,
ChungLiangQuoted 9 lines · Patrick Schaaf
Quoted 4 lines
Now I have build my own linux router and found out the second computer will not have the source port staying at 1701 but changing to 1024 by the NAT. I am wondering what should I do to make this go away and stay at 1701. Thanks.
NOW I get you. Easy: change your NAT rules suitably. All decisions about WHAT should be NATted, are made by YOUR rules.
Quoted 8 lines
If you don't know how to do that, please go ask the [email protected] mailing list. It is now not a _development_ question.
best regards
Patrick--__--__--
Message: 8
Date: Thu, 22 May 2003 09:00:40 +0200
From: Patrick Schaaf <[email protected]>
To: ChungLiang <[email protected]>
Cc: [email protected]
Subject: Re: L2TP protocol source port number changedQuoted 3 lines
Yes, that could be done in the rules one way or another. What I am wondering is that the rules are the same in both routers with same kernel version.
Do you have both working and nonworking routers available, and you can reproduce both working and nonworking operations? Does a diff between the two rulesets really show identical rules?
If I understand you correctly, the L2TP peers (your Windows box on one end, something at the other) are one and the same in both setups? You only vary the box in between?
Can you put a HUB between the Windows box and the working vs. nonworking NAT router, and use a third box to sniff the traffic in both cases?
If that's all true, then you have a really interesting situation. I have no idea what to make of it, and I cannot imagine, both kernels being the same, that any amount of compile time options could help.
best regards
Patrick--__--__--
Message: 9
Date: Thu, 22 May 2003 14:44:50 +0200
From: Balazs Scheidler <[email protected]>
To: [email protected]
Subject: updated ctnetlinkHi,
while trying to resolve issues with TPROXY I came to the conclusion that I might need ctnetlink, but the version in pom seems to be outdated. Is there a more current version? And provided there is none, shall I put resources into updating it to the latest kernels?
Signature · 13 lines
Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1 --__--__-- Message: 10 Subject: Re: updated ctnetlink From: Martin Josefsson <[email protected]> To: Balazs Scheidler <[email protected]> Cc: Netfilter-devel <[email protected]> Organization: Date: 22 May 2003 15:31:20 +0200Quoted 6 lines · Balazs Scheidler
Hi,
while trying to resolve issues with TPROXY I came to the conclusion that I might need ctnetlink, but the version in pom seems to be outdated. Is there a more current version? And provided there is none, shall I put resources into updating it to the latest kernels?
The version in p-o-m is working fine here on 2.4.21-rc1 (with a few fixes so userspace can't crash the kernel so easily
http://kashyyyk.netfilter.org/~gandalf/patches/nfnetlink_conntrack-fix.diff
one hunk of it has been integrated into p-o-m)Signature · 11 lines
/Martin --__--__-- Message: 11 Date: Thu, 22 May 2003 15:59:43 +0200 From: Balazs Scheidler <[email protected]> To: Martin Josefsson <[email protected]> Cc: Netfilter-devel <[email protected]> Subject: Re: updated ctnetlinkQuoted 8 lines · Martin Josefsson
Quoted 6 lines · Balazs Scheidler
Hi,
while trying to resolve issues with TPROXY I came to the conclusion that I might need ctnetlink, but the version in pom seems to be outdated. Is there a more current version? And provided there is none, shall I put resources into updating it to the latest kernels?
Quoted 4 lines
The version in p-o-m is working fine here on 2.4.21-rc1 (with a few fixes so userspace can't crash the kernel so easily
http://kashyyyk.netfilter.org/~gandalf/patches/nfnetlink_conntrack-fix.diff
one hunk of it has been integrated into p-o-m)hm it is in the oldnat/ section of the p-o-m, it was the reason I thought it was obsoleted.
Signature · 13 lines
Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1 --__--__-- Message: 12 Subject: Re: updated ctnetlink From: Martin Josefsson <[email protected]> To: Balazs Scheidler <[email protected]> Cc: Netfilter-devel <[email protected]> Organization: Date: 22 May 2003 16:03:37 +0200Quoted 7 lines · Balazs Scheidler
Quoted 4 lines
The version in p-o-m is working fine here on 2.4.21-rc1 (with a few fixes so userspace can't crash the kernel so easily
http://kashyyyk.netfilter.org/~gandalf/patches/nfnetlink_conntrack-fix.diff
one hunk of it has been integrated into p-o-m)hm it is in the oldnat/ section of the p-o-m, it was the reason I thought it was obsoleted.
That one is :)
But
extra/nfnetlink-ctnetlink-0.11.patchisn'tSignature · 15 lines
/Martin --__--__-- Message: 13 Subject: Re: Re:Interesting failure with RPC state tracker From: "Brian J. Murrell" <[email protected]> To: [email protected] Date: 22 May 2003 11:37:22 -0400 --=-h3AZFvWJzv84WvRnZt2+ Content-Type: text/plain Content-Transfer-Encoding: quoted-printableQuoted 1 line · Ian Latter
Hello Brian and Dev ppls,
Hi All,
Quoted 2 lines
I'll post a link on it later, but I found a site that discussed the RPC
module within Firewall-1 in greater detail than I had seen previously.Cool.
Quoted 1 line
One of the things that Firewall-1's RPC code did, that I didn't like, w=
as
Quoted 2 lines
that if you choose to "match" an RPC, then the matching module will automatically allow RPC portmapper requests through the firewall.
Hmmmm. What does this mean exactly? Simply an implicit:
iptables -I FORWARD -s $client/32 -d $server/32 -p tcp --dport 111 -j ACCEP= T
iptables -I FORWARD -s $client/32 -d $server/32 -p udp --dport 111 -j ACCEP= Tis installed if a rule that allowed $client to use RPC service 100003 on $server was created?
This seems straightforward enough. Afterall, the rule the user created will not work work without (at least) the above UDP rule in place.
Quoted 2 lines
I
don't like the idea of "hidden rules", and hence in the Netfilter version=,
Quoted 11 lines
you need to permit the RPC portmapper requests explicitly. So what you've seen is correct ... and this sort of ruleset;
=20
Usage:
=20The intended usage of these modules would be with a ruleset like; =20 # New session from client to server (portmapper get) -A PREROUTING -t nat -i eth0 -p udp -m rpc --rpcs 100002 -s ${client} --sport 0:1023 -d ${server} --dport 111 -j ACCEPTI wish the example did not use PREROUTING -t nat but rather simply FORWARD or INPUT. IMHO, it would be more clear what the module is all about.
Quoted 4 lines
# Continued session from client to server (portmapper answer) -A PREROUTING -t nat -i eth1 -m state -p udp
-s ${server} --sport 111 -d ${client} --dport 0:1023 --state ESTABLISHED -j ACCEPTWhy is this needed? Does conntrack not automatically do this for me (i.e. just like any other udp rule)? I don't have any rule of this sort in my policy and RPCs are working just fine here in my FORWARD chain.
Quoted 2 lines
... should work ... (was this what you found?) .. except for the "DUMP" request.
Yes, an application using the DUMP (i.e rpcinfo -p) request to find port numbers is kinda cheating. But it works and there are application(s) using it. Linux's mount command is one.
Quoted 2 lines
I'll need to read up on this one (I remember reading it through
when I rejigged the module, but I ended up discarding it).It's simply call that rpcinfo -p uses to get a dump of all registered RPC routines and their port numbers.
Quoted 6 lines
There are two other features in the Firewall-1 RPC code that I want
to add to the Netfilter RPC module;
=20
1) Cached portmapper resolution -- establishing a slab cache the dynamically stores the port vs the procedure number in memory such that future RPC portmapper requests are redundantOnce you have an RPC GETPORT (which the client will do when it wants to know a port on the server) is there really much to be saved looking up the port in a table vs. just parsing the GETPORT reply?
Quoted 4 lines
2) A kernel socket call to the RPC portmapper -- in case the RPC module or rule is only activated after the client has already=20 performed a portmapper resolution request, currently the RPC module would fail to permit the valid RPC request.
Indeed. But how is this situation any different than a regular UDP/TCP session that is ESTABLISHED when a rule is put in place that affects it's port?
Omce the client has used RPC to find the port of an RPC service it's just regular TCP/UDP business as usual, is it not?
Quoted 2 lines
If, however,
the RPC port range"the RPC port range"? I will have to dig my TCP/IP Illustrated Volume I out of storage, but IIRC, RPC servers just use ephemeral port numbers and register them with the portmapper don't they? I don't recall there being any "range" of ports reserved for RPC servers.
Quoted 2 lines
was treated as a possible set of RPC "targets",
but for which a valid (matched) IP address had failed to resolv=e a
Quoted 2 lines
port for a given procedure; then the RPC module would make its=20 own request to the portmapper to resolve the port and validate =
the
Quoted 1 line
match. The resolution could then be added to the local slab ca=
che
Quoted 1 line
to accelerate future matches.
But the problem is if the RPC netfilter module does not catch the GETPORT call, there is nothing afterwards that can indicate to netfilter that an ESTABLISHED session on a given port is to an RPC server vs. just any other TCP/UDP server.
Quoted 1 line
While it *sounds* like I'm a great guy ready to do big things, the tru=
th is
Quoted 2 lines
that I haven't fixed my pointer module name problem in three weeks, so=20 these mods might be a little way off ;-)
I hear ya!
Quoted 2 lines
I am very appreciative of feedback on the use of this module and your
successes/failures. Of particular interest is performance ... let me kno=w
Quoted 2 lines
how you go with thrashing this thing under NFS ... because that is one of the big unanswered questions here ..
Well, beyond initially mounting an NFS filesystem, the RPC module has nothing to do with NFS. Once the filesystem is mounted, it's just regular ol' UDP on whatever port the portmapper told the client (usually 2049).
This does bring up an interesting issue however. The normal timeouts for UDP sessions are not nearly long enough for NFS. NFS can go quite a long while without sending any traffic back and forth (no accesses to the filesystem). Other than a "hard" rule allowing the client to talk to the server on port 2049, I am not sure how to handle this though.
Quoted 2 lines
Thanks for the feedback ... I'll check out that DUMP command and see
what I can do ...Well, it's an interesting problem because just because a client asks for the list of service/ports a server is providing, it does not really mean the client will want to use a service/port, and even if it does, the netfilter RPC module cannot possibly know which one of the list the client retrieves that it will want to use. What expectation do you install for a port dump?
Quoted 1 line
which kernel version are you using?
2.4.20ish.
Quoted 2 lines
(Cool database software, btw, I implemented it for an ISP in AU who had heard of it and used it before).
Which database software is that?
b.
--=20
Brian J. Murrell <[email protected]>--=-h3AZFvWJzv84WvRnZt2+
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)iD8DBQA+zO6xl3EQlGLyuXARAjqwAJ9kt+5xVPOdlzpWxYQydzrNjGnjAgCfYvsq PhHIMkctLFSYpvwpF8RtyNU=
=qnAX
-----END PGP SIGNATURE-------=-h3AZFvWJzv84WvRnZt2+--
--__--__--
_______________________________________________
netfilter-devel mailing list
[email protected]
https://lists.netfilter.org/mailman/listinfo/netfilter-develEnd of netfilter-devel Digest