-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCP RST handling for FIN RCV #212
Comments
Well, we have challenged the law before. Mostly thanks to Tore, it seems :) Jool does not currently track TCP seqs at all (not even the upcoming 3.5 release), but it will have to be implemented eventually if we want to support FTP. I don't remember the details from when I started trying to fix FTP, but I do recall thinking it was going to be a lot of work. In fact, it might be effort better spent merging Jool with the kernel, because that should enable us access to iptables's seq tracking code. (And also the FTP NAT44 ALG.)
Before I say anything else, I'd like to point out that Dmitry Anipko did not suggest the state should be moved to The distinction is important because the Edit: Oops. I failed you realize you were linking to Murari Sridharan's message, not to Dmitry's. I do not understand why Murari changed the idea, but see below.
It won't work as advertised 100% of the time:
Let's say A and B are exchanging packets. N is in the
We have a problem now; N is in
Dmitry's solution doesn't have this problem as far as I can tell. Its only drawback is that the RST is going to break the connection if the endpoints do not exchange data during the TCP_TRANS period. (But if my home's ISP is of any indication, this is normal even without NAT64s in the way :P. Then again, it's pretty brittle in general.) I really don't have any objections to coding this, but it would not be enabled by default.
Noooooope :). Seqnum tracking is a lot of code for just this purpose, and since the filtering topic raised a lot of controversy I'd say it's fairly safe to assume the IETF rejected the idea during one of the meetings. (I cannot say the same for Dmitry's proposal however, as it kind of looks like they forgot about it.) But if we end up implementing seq checking anyway due to FTP, then improving RST analysis immediately after would be rather inevitable. tl;drI'm in for implementing Dmitry's proposal, which is not about moving to Filtering bad RSTs may eventually happen, but I'd say it's unlikely in the near future. (unless someone can propose some clever code) Objections? |
Thanks @ydahhrk for your detailed reply.
Well it would be perfect, actually I don't know how I ended up focusing on I totally agree with your conclusions, I'm ready to test the new code as soon as you release it. Do you plan to introduce a new (non-RFC6146) state to also handle the case data keep flowing after the RST? I mean something that allows to revert the timer to |
See, that's the beauty of Dmitry's solution: I don't have to. Aside from the RST special handling, The These are the two possible outcomes (that I know of) that involve a RST during one of the 1: B is legitimately trying to end the connection using an RSTBackground: N is in
Well, M can keep the session alive by sending more forged packets, but the state machine was already vulnerable to this anyway. 2: M is trying to tamper the connection by sneaking an RST inSame background as 1.
We're now back to where we were before the RST; M's attack did nothing. Assuming, that is, that B has something to send within 4 minutes. But if you're seeing lots of clients thinking they're being clever by ending with RST instead of FIN, breaking the ones that fulfill all of the following requirements to achieve better resource utilization is probably a reasonable tradeoff:
(It can't be the default, though, because it encourages sloppy TCP stacks.) I'll get to coding. |
I forgot to mention this issue in the commit message :C This is the code: https://github.com/NICMx/Jool/tree/issue212
(It's still missing the man page entry, but not |
Today I've tested it for just a few minutes and it seemed to be working as expected. If you want you can close this issue. I'll open a new one if I'll find any problem. Many thanks |
Thank you I'll get the 3.4.3 release started on monday :) |
Want credits in the README? (If so, please state what you'd like included) (Edit: Rats. I should have asked via mail. My bad.) |
Oh thanks, why not? Can't help with code but I try to do it in other ways.
|
3.4.3 released; closing. |
Hello @ydahhrk, @pierky. It's quite a while already but ... In the tcpdump we've found following:
Jool session will end up with EST timeout. I would expect after FIN and RST (from any IPv4 or IPv6) session will be with TRANS timeout. Also the documentation says: |
Ok. I'll test it tomorrow, since I don't hace my equipment today. The code does look like it should be working as advertised, though I won't know until I've tested it: https://github.com/NICMx/Jool/blob/master/src/mod/common/steps/filtering_and_updating.c#L359-L362
Did you find a solution? A pull request would be welcomed. |
Hello,
during some tests I've noticed that many TCP connections move to the
V4_FIN_RCV
/V6_FIN_RCV
states and stay there up to 2 hours (TCP_EST
), even if they are actually terminated on the hosts. Stuck connections adversely impact resource usage on a NAT64 box.As far as I can see from some tcpdump captures TCP RSTs are involved in all these connections, for example RST sent in response to FIN with no more packets to follow.
I know RFC6146 section 3.5.2.2 states that RSTs should be handled only for connections in
ESTABLISHED
state (moving them toTRANS
) but I wonder whether an optional configuration argument can be added to Jool to allow it to process RSTs inFIN RCV
states too.What I mean has already been discussed on BEHAVE:
link to message
Of course RST handling needs a special attention about sequencing to mitigate attacks, and this introduces another topic: firewalling/filtering on a NAT64 box. Many considerations have already been written about this too:
link to message
link to message
link to message
I don't know if internally Jool already implements sequencing checks, so if you think my proposal could be taken into account I would also ask
FIN RCV
->TRANS
transition on RST receipt?TRANS
, leaving to the hosts the validation effort, would suffice?Thank you for considering my request.
The text was updated successfully, but these errors were encountered: