[Bug 1612711] Re: TLS negation fails

2017-11-09 Thread Graham Leggett
More details.

The ClientHello packet in this case is larger than 255 bytes, and is
triggering the handshake failure in one of two ways.

When psql linked to openssl v1.0.1f attempts to connect to postgresql
linked to openssl v1.0.1f, the client side sends 8 bytes, then 1 byte,
then 305 bytes in my case:

listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:51:45.113996 IP 172.29.231.43.40454 > 172.29.228.240.5432: Flags [S], seq 
3580373978, win 26883, options [mss 8961,sackOK,TS val 12226525 ecr 
0,nop,wscale 7], length 0
11:51:45.114035 IP 172.29.228.240.5432 > 172.29.231.43.40454: Flags [S.], seq 
3310545722, ack 3580373979, win 26847, options [mss 8961,sackOK,TS val 12327573 
ecr 12226525,nop,wscale 7], length 0
11:51:45.114243 IP 172.29.231.43.40454 > 172.29.228.240.5432: Flags [.], ack 1, 
win 211, options [nop,nop,TS val 12226525 ecr 12327573], length 0
11:51:45.114271 IP 172.29.231.43.40454 > 172.29.228.240.5432: Flags [P.], seq 
1:9, ack 1, win 211, options [nop,nop,TS val 12226525 ecr 12327573], length 8
11:51:45.114277 IP 172.29.228.240.5432 > 172.29.231.43.40454: Flags [.], ack 9, 
win 210, options [nop,nop,TS val 12327573 ecr 12226525], length 0
11:51:45.114934 IP 172.29.228.240.5432 > 172.29.231.43.40454: Flags [P.], seq 
1:2, ack 9, win 210, options [nop,nop,TS val 12327574 ecr 12226525], length 1
11:51:45.115132 IP 172.29.231.43.40454 > 172.29.228.240.5432: Flags [.], ack 2, 
win 211, options [nop,nop,TS val 12226525 ecr 12327574], length 0
11:51:45.117703 IP 172.29.231.43.40454 > 172.29.228.240.5432: Flags [P.], seq 
9:314, ack 2, win 211, options [nop,nop,TS val 12226526 ecr 12327574], length 
305
11:51:45.119459 IP 172.29.228.240.5432 > 172.29.231.43.40454: Flags [P.], seq 
2:3941, ack 314, win 219, options [nop,nop,TS val 12327575 ecr 12226526], 
length 3939
11:51:45.120234 IP 172.29.231.43.40454 > 172.29.228.240.5432: Flags [P.], seq 
314:321, ack 3941, win 350, options [nop,nop,TS val 12226526 ecr 12327575], 
length 7
11:51:45.120324 IP 172.29.231.43.40454 > 172.29.228.240.5432: Flags [R.], seq 
321, ack 3941, win 350, options [nop,nop,TS val 12226526 ecr 12327575], length 0

The openssl v1.0.1f server side responds with a ServerHello, however the
client side rejects the ServerHello saying "unknown ca", even though
this same set of certificates works fine in Ubuntu Trusty.

In a second test, if I use openssl v1.0.2m compiled from source to
connect to the same server, the client side sends 308 bytes in one go:

listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
11:53:02.032126 IP 172.29.228.7.54912 > 172.29.228.240.5432: Flags [S], seq 
1471313029, win 26883, options [mss 8961,sackOK,TS val 645036074 ecr 
0,nop,wscale 7], length 0
11:53:02.032165 IP 172.29.228.240.5432 > 172.29.228.7.54912: Flags [S.], seq 
126514461, ack 1471313030, win 26847, options [mss 8961,sackOK,TS val 12346803 
ecr 645036074,nop,wscale 7], length 0
11:53:02.032490 IP 172.29.228.7.54912 > 172.29.228.240.5432: Flags [.], ack 1, 
win 211, options [nop,nop,TS val 645036074 ecr 12346803], length 0
11:53:02.039507 IP 172.29.228.7.54912 > 172.29.228.240.5432: Flags [P.], seq 
1:309, ack 1, win 211, options [nop,nop,TS val 645036076 ecr 12346803], length 
308
11:53:02.039521 IP 172.29.228.240.5432 > 172.29.228.7.54912: Flags [.], ack 
309, win 219, options [nop,nop,TS val 12346805 ecr 645036076], length 0
11:53:02.040625 IP 172.29.228.240.5432 > 172.29.228.7.54912: Flags [F.], seq 1, 
ack 309, win 219, options [nop,nop,TS val 12346805 ecr 645036076], length 0
11:53:02.041682 IP 172.29.228.7.54912 > 172.29.228.240.5432: Flags [.], ack 2, 
win 211, options [nop,nop,TS val 645036077 ecr 12346805], length 0
11:53:02.049476 IP 172.29.228.7.54912 > 172.29.228.240.5432: Flags [F.], seq 
309, ack 2, win 211, options [nop,nop,TS val 645036078 ecr 12346805], length 0
11:53:02.049492 IP 172.29.228.240.5432 > 172.29.228.7.54912: Flags [.], ack 
310, win 219, options [nop,nop,TS val 12346807 ecr 645036078], length 0

In this case the postgresql linked to openssl v1.0.1f immediately slams
the phone down after the initial ClientHello, leading to the "SSL
handshake has read 0 bytes" in the openssl client side.

It appears openssl v1.0.1f has a bug where ClientHello greater than 255
bytes causes the handshake to fail without accurately logging the cause.

In my case this is a regression from Ubuntu Trusty, where the identical
setup and certificates work fine.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1612711

Title:
  TLS negation fails

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1612711/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1612711] Re: TLS negation fails

2017-11-08 Thread Graham Leggett
Using openssl s_client on a MacOS Sierra machine connecting to the same
postgresql server, the failure is identical.

Looks like whatever is triggering this is caused by the server, but is
being failed by the client.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1612711

Title:
  TLS negation fails

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1612711/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1612711] Re: TLS negation fails

2017-11-08 Thread Graham Leggett
Despite printing "no peer certificate available" below, the postgresql
server serves three certificates (two intermediates and a leaf) as
picked up by ssldump.

In this case it is the client side that is triggering the handshake
failure, not the server. The client side refuses to add the cause of the
handshake failure to the error message, which is definitely a bug.

postgres@sql02:~$ openssl s_client -verify 10 -CAfile .postgresql/root.crt -key 
.postgresql/postgresql.key -cert .postgresql/postgresql.crt -connect sql01:5432 
-servername sql01
verify depth is 10
CONNECTED(0003)
139930468939416:error:140790E5:SSL routines:ssl23_write:ssl handshake 
failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 379 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol  : TLSv1.2
Cipher: 
Session-ID: 
Session-ID-ctx: 
Master-Key: 
Key-Arg   : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1510188432
Timeout   : 300 (sec)
Verify return code: 0 (ok)
---

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1612711

Title:
  TLS negation fails

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1612711/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1612711] Re: TLS negation fails

2017-11-08 Thread Graham Leggett
ssldump looks like the below.

>From ssldump, we can see that the server sent three separate
certificates. Openssl s_client however claims that no certificates were
detected.

New TCP connection #42: 172.29.231.43(33116) <-> 172.29.228.240(5432)
42 1  0.0038 (0.0038)  C>SV3.1(300)  Handshake
 ClientHello
   Version 3.3 
   random[32]=
 80 cf 99 66 b3 07 55 c2 3f cf b2 61 13 39 89 c1 
 33 37 f4 77 21 a3 fd 2e f9 fa 9b 65 4e b5 bd 24 
   cipher suites
   Unknown value 0xc030
   Unknown value 0xc02c
   Unknown value 0xc028
   Unknown value 0xc024
   Unknown value 0xc014
   Unknown value 0xc00a
   Unknown value 0xa5
   Unknown value 0xa3
   Unknown value 0xa1
   Unknown value 0x9f
   Unknown value 0x6b
   Unknown value 0x6a
   Unknown value 0x69
   Unknown value 0x68
   TLS_DHE_RSA_WITH_AES_256_CBC_SHA
   TLS_DHE_DSS_WITH_AES_256_CBC_SHA
   TLS_DH_RSA_WITH_AES_256_CBC_SHA
   TLS_DH_DSS_WITH_AES_256_CBC_SHA
   Unknown value 0x88
   Unknown value 0x87
   Unknown value 0x86
   Unknown value 0x85
   Unknown value 0xc032
   Unknown value 0xc02e
   Unknown value 0xc02a
   Unknown value 0xc026
   Unknown value 0xc00f
   Unknown value 0xc005
   Unknown value 0x9d
   Unknown value 0x3d
   TLS_RSA_WITH_AES_256_CBC_SHA
   Unknown value 0x84
   Unknown value 0xc02f
   Unknown value 0xc02b
   Unknown value 0xc027
   Unknown value 0xc023
   Unknown value 0xc013
   Unknown value 0xc009
   Unknown value 0xa4
   Unknown value 0xa2
   Unknown value 0xa0
   Unknown value 0x9e
   TLS_DHE_DSS_WITH_NULL_SHA
   Unknown value 0x40
   Unknown value 0x3f
   Unknown value 0x3e
   TLS_DHE_RSA_WITH_AES_128_CBC_SHA
   TLS_DHE_DSS_WITH_AES_128_CBC_SHA
   TLS_DH_RSA_WITH_AES_128_CBC_SHA
   TLS_DH_DSS_WITH_AES_128_CBC_SHA
   Unknown value 0x9a
   Unknown value 0x99
   Unknown value 0x98
   Unknown value 0x97
   Unknown value 0x45
   Unknown value 0x44
   Unknown value 0x43
   Unknown value 0x42
   Unknown value 0xc031
   Unknown value 0xc02d
   Unknown value 0xc029
   Unknown value 0xc025
   Unknown value 0xc00e
   Unknown value 0xc004
   Unknown value 0x9c
   Unknown value 0x3c
   TLS_RSA_WITH_AES_128_CBC_SHA
   Unknown value 0x96
   Unknown value 0x41
   Unknown value 0xc011
   Unknown value 0xc007
   Unknown value 0xc00c
   Unknown value 0xc002
   TLS_RSA_WITH_RC4_128_SHA
   TLS_RSA_WITH_RC4_128_MD5
   Unknown value 0xc012
   Unknown value 0xc008
   TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
   TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
   TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA
   TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA
   Unknown value 0xc00d
   Unknown value 0xc003
   TLS_RSA_WITH_3DES_EDE_CBC_SHA
   Unknown value 0xff
   compression methods
 NULL
42 2  0.0056 (0.0017)  S>CV3.3(62)  Handshake
 ServerHello
   Version 3.3 
   random[32]=
 f9 4d fa 63 ee d5 65 6d ba dd 58 de 51 00 8e ac 
 9f 45 24 43 e2 17 88 07 41 9a 8d aa 7f 95 2a 13 
   session_id[0]=

   cipherSuite Unknown value 0xc030
   compressionMethod   NULL
42 3  0.0056 (0.)  S>CV3.3(3345)  Handshake
 Certificate
   certificate[1329]=[snip]
   certificate[1010]=[snip]
   certificate[990]=[snip]
42 4  0.0056 (0.)  S>CV3.3(333)  Handshake
 ServerKeyExchange
42 5  0.0056 (0.)  S>CV3.3(179)  Handshake
 CertificateRequest
   certificate_types   rsa_sign
   certificate_types   dss_sign
   certificate_types unknown value
Not enough data. Found 163 bytes (expecting 32767)
 ServerHelloDone
42 6  0.0061 (0.0004)  C>SV3.3(2)  Alert
   level   fatal
   value   unknown_ca
420.0062 (0.0001)  C>S  TCP RST

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1612711

Title:
  TLS negation fails

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1612711/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1612711] Re: TLS negation fails

2017-11-08 Thread Graham Leggett
I am seeing the exact same bug, only with the server being postgresql
instead of openldap.

The same setup and certificates works fine on Trusty, but have regressed
on Xenial.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1612711

Title:
  TLS negation fails

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1612711/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1612711] Re: TLS negation fails

2017-11-08 Thread Launchpad Bug Tracker
Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: openssl (Ubuntu)
   Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1612711

Title:
  TLS negation fails

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1612711/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1612711] Re: TLS negation fails

2016-08-12 Thread treaves
The full output is:

CONNECTED(0003)
140668035487384:error:140790E5:SSL routines:ssl23_write:ssl handshake 
failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 305 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol  : TLSv1.2
Cipher: 
Session-ID:
Session-ID-ctx:
Master-Key:
Key-Arg   : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1471016462
Timeout   : 300 (sec)
Verify return code: 0 (ok)
---

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1612711

Title:
  TLS negation fails

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssl/+bug/1612711/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs