netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is TCP over IPsec broken in 2.6.18?
@ 2006-09-22 11:29 Evgeniy Polyakov
  2006-09-22 11:35 ` Evgeniy Polyakov
  2006-09-22 12:19 ` Evgeniy Polyakov
  0 siblings, 2 replies; 41+ messages in thread
From: Evgeniy Polyakov @ 2006-09-22 11:29 UTC (permalink / raw)
  To: netdev

Hello.

I've found strange behaviour of transport mode IPsec in 2.6.18 tree.
After key daemons exchanged keys (I use racoon) I try following command
on 2.6.18 machine: telnet 192.168.4.79 22 (telnet from 2.6.18 to 2.6.17 based one)
and get very slow response, here is related tcpdump output:

15:15:47.396925 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x21), length 84
15:15:47.397391 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x18), length 84
15:15:47.397025 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x22), length 84
15:15:47.404166 IP 192.168.4.79.ssh > 192.168.4.78.47256: P 2541002438:2541002458(20) ack 1601271418 win 91 
15:15:48.279375 IP 192.168.4.79.ssh > 192.168.4.78.47256: P 0:20(20) ack 1 win 91 
15:15:50.031487 IP 192.168.4.79.ssh > 192.168.4.78.47256: P 0:20(20) ack 1 win 91 
15:15:53.535710 IP 192.168.4.79.ssh > 192.168.4.78.47256: P 0:20(20) ack 1 win 91 
15:16:00.544154 IP 192.168.4.79.ssh > 192.168.4.78.47256: P 0:20(20) ack 1 win 91 
15:16:14.561064 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x19), length 100
15:16:14.561218 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x23), length 84

Unencrypted packets somehow sneaked into the wire.

ping works ok:
15:15:37.919617 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x1c), length 116
15:15:37.919858 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x13), length 116
15:15:38.920772 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x1d), length 116
15:15:38.920823 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x14), length 116
15:15:39.920823 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x1e), length 116
15:15:39.920883 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x15), length 116
15:15:40.920848 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x1f), length 116
15:15:40.920893 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x16), length 116

It was introduced somewhere in 2.6.18 development cycle and as far as I
recall not at the beginning of it (I found it porting IPsec acrypto to 2.6.18,
unfortunately I do not have version which works anymore, except 2.6.17
tree which works ok with both acrypto and vanilla trees), likely after
transport/tunnel modules introduction by Herbert Xu.

telnet from 2.6.17 tree to 2.6.18 tree works ok too:

15:24:33.428978 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x1b), length 84
15:24:33.429130 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x2d), length 84
15:24:33.429236 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x1c), length 84
15:24:33.436885 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x2e), length 100
15:24:33.436962 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x1d), length 84
15:24:35.293140 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x1e), length 84
15:24:35.293259 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x2f), length 84
15:24:35.293315 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x30), length 100
15:24:35.293365 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x1f), length 84
15:24:35.293372 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x31), length 84
15:24:35.293514 IP 192.168.4.79 > 192.168.4.78: ESP(spi=0x0961a360,seq=0x20), length 84
15:24:35.293639 IP 192.168.4.78 > 192.168.4.79: ESP(spi=0x027181f9,seq=0x32), length 84

All tcpdumps were obtained on 2.6.17 machine.
On the same machine I frequently get following logs in syslog:

Sep 22 15:10:52 kano racoon: INFO: ISAKMP-SA established 192.168.4.79[500]-192.168.4.78[500] spi:9865a72e87784e17:cb2af1cfc436bd13 
Sep 22 15:10:52 kano racoon: ERROR: none message must be encrypted
Sep 22 15:10:53 kano racoon: INFO: respond new phase 2 negotiation: 192.168.4.79[500]<=>192.168.4.78[500]
Sep 22 15:10:53 kano racoon: INFO: IPsec-SA established: ESP/Transport 192.168.4.78[0]->192.168.4.79[0] spi=40993273(0x27181f9)
Sep 22 15:10:53 kano racoon: INFO: IPsec-SA established: ESP/Transport 192.168.4.79[0]->192.168.4.78[0] spi=157393760(0x961a360)
Sep 22 15:11:02 kano racoon: ERROR: none message must be encrypted
Sep 22 15:11:12 kano racoon: INFO: IPsec-SA expired: ESP/Transport 192.168.4.78[0]->192.168.4.79[0] spi=3540507(0x36061b)
Sep 22 15:11:12 kano racoon: WARNING: the expire message is received but the handler has not been established.
Sep 22 15:11:12 kano racoon: ERROR: 192.168.4.78 give up to get IPsec-SA due to time up to wait.

I do not recall if they existed when 2.6.17<->2.6.17 communication was
established.

I can use git bisect to track bug down if someone will show me simple tutorial.

-- 
	Evgeniy Polyakov

^ permalink raw reply	[flat|nested] 41+ messages in thread
* RE: [PATCH] Fix for IPsec leakage with SELinux enabled - V.02
@ 2006-10-04 14:02 Venkat Yekkirala
  0 siblings, 0 replies; 41+ messages in thread
From: Venkat Yekkirala @ 2006-10-04 14:02 UTC (permalink / raw)
  To: James Morris, Evgeniy Polyakov
  Cc: David S. Miller, Herbert Xu, netdev, Stephen Smalley,
	Venkat Yekkirala, Paul Moore, Daniel J Walsh

Evegeniy,

Please start with my patch which should actually address the issue
you were originally running into. I doubt that you were running into
the kind of errors that James' patch (which will need to be modified
to not treat -EACCES as an error to be propagated up the chain) would
handle.

Thanks,

venkat

> -----Original Message-----
> From: James Morris [mailto:jmorris@namei.org]
> Sent: Wednesday, October 04, 2006 8:00 AM
> To: Evgeniy Polyakov
> Cc: David S. Miller; Herbert Xu; netdev@vger.kernel.org; Stephen
> Smalley; Venkat Yekkirala; Paul Moore; Daniel J Walsh
> Subject: Re: [PATCH] Fix for IPsec leakage with SELinux enabled - V.02
> 
> 
> On Wed, 4 Oct 2006, Evgeniy Polyakov wrote:
> 
> > Linux kano 2.6.18 #5 SMP Mon Oct 2 18:44:30 MSD 2006 i686 
> i686 i386 GNU/Linux
> > [root@kano ~]# rpm -q selinux-policy-targeted
> > selinux-policy-targeted-2.3.17-2
> > 
> > I get only this messages in audit.log when remote racoon tries to
> > connect to system with selinux enabled in enforcing mode:
> > 
> 
> I think the policy has just not been written for racoon, and 
> it's being 
> denied by deault (cd'd Dan Walsh).
> 
> > type=AVC msg=audit(1159938297.845:625): avc:  denied  { 
> polmatch } for
> > scontext=system_u:object_r:unlabeled_t:s0
> > tcontext=root:system_r:unconfined_t:s0-s0:c0.c255 tclass=association
> > type=AVC msg=audit(1159938297.845:626): avc:  denied  { 
> polmatch } for
> > scontext=system_u:object_r:unlabeled_t:s0
> > tcontext=system_u:object_r:unlabeled_t:s0 tclass=association
> > type=AVC msg=audit(1159938307.837:627): avc:  denied  { 
> polmatch } for
> > scontext=system_u:object_r:unlabeled_t:s0
> > tcontext=system_u:object_r:unlabeled_t:s0 tclass=association
> > type=AVC msg=audit(1159938317.838:628): avc:  denied  { 
> polmatch } for
> > scontext=system_u:object_r:unlabeled_t:s0
> > tcontext=system_u:object_r:unlabeled_t:s0 tclass=association
> > type=AVC msg=audit(1159938327.839:629): avc:  denied  { 
> polmatch } for
> > scontext=system_u:object_r:unlabeled_t:s0
> > tcontext=system_u:object_r:unlabeled_t:s0 tclass=association
> > 
> > It is with your patch applied.
> > Should I try Venkat's or it is unrelated problem?
> > 
> > > -- 
> > > James Morris
> > > <jmorris@namei.org>
> > 
> > 
> 
> -- 
> James Morris
> <jmorris@namei.org>
> 

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2006-10-05 21:04 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-22 11:29 Is TCP over IPsec broken in 2.6.18? Evgeniy Polyakov
2006-09-22 11:35 ` Evgeniy Polyakov
2006-09-22 12:19 ` Evgeniy Polyakov
2006-09-22 12:23   ` Patrick McHardy
2006-09-22 14:03     ` Evgeniy Polyakov
2006-09-22 15:15       ` James Morris
2006-09-22 15:47         ` James Morris
2006-09-23  4:29         ` Evgeniy Polyakov
2006-09-24  5:11           ` James Morris
2006-09-24  9:08             ` Patrick McHardy
2006-09-24 14:33               ` James Morris
2006-09-24 23:54                 ` Herbert Xu
     [not found]                   ` <20060925103836.GA13966@2ka.mipt.ru>
2006-09-25 11:27                     ` Herbert Xu
2006-09-25 12:05                       ` Evgeniy Polyakov
2006-09-25 12:55                         ` jamal
2006-09-30  5:06                         ` James Morris
2006-09-30  5:14                           ` James Morris
2006-09-30  7:41                             ` James Morris
2006-09-30 11:15                             ` Evgeniy Polyakov
2006-09-30 14:36                               ` James Morris
2006-09-30 14:40                                 ` Evgeniy Polyakov
2006-09-30 14:42                                   ` Evgeniy Polyakov
2006-09-30 14:44                                   ` James Morris
2006-10-01  6:27                                     ` [PATCH] Fix for IPsec leakage with SELinux enabled James Morris
2006-10-02 11:20                                       ` Evgeniy Polyakov
2006-10-02 13:31                                         ` James Morris
2006-10-02 13:42                                           ` Evgeniy Polyakov
2006-10-02 14:05                                             ` James Morris
2006-10-02 14:27                                               ` [PATCH] Fix for IPsec leakage with SELinux enabled - V.02 James Morris
2006-10-02 16:00                                                 ` Evgeniy Polyakov
2006-10-02 16:13                                                   ` James Morris
2006-10-02 16:30                                                     ` Evgeniy Polyakov
2006-10-02 16:41                                                       ` James Morris
2006-10-04  5:08                                                         ` Evgeniy Polyakov
2006-10-04 13:00                                                           ` James Morris
2006-10-03 23:18                                                 ` David Miller
2006-10-04  1:33                                                   ` James Morris
2006-10-04 13:41                                                   ` Herbert Xu
2006-10-05 20:58                                                   ` James Morris
2006-10-05 21:04                                                     ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2006-10-04 14:02 Venkat Yekkirala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).