[openssl-users] Query regarding DTLS handshake

mahesh gs mahesh116 at gmail.com
Mon Apr 17 10:44:08 UTC 2017


Hi All,

Adding to this, When we changed the path MTU of the source and destination
VM's we could see the SSL connection is successful and application data
getting exchanged which confirms that there is issue in segmentation and
reassembly of packets.


Do we have some system configuration that need to be enabled for DTLS ? as
i mentioned in my previous mails, TLS negotiation is successful without
changing path MTU but not DTLS.


Thanks,
Mahesh G S

On Mon, Apr 17, 2017 at 12:36 PM, mahesh gs <mahesh116 at gmail.com> wrote:

> Hi All,
>
> Sorry for delayed response, thank you all for responding to my query.
>
> 1) We are using non-blocking sockets on RHEL 7.0 machine with the kernel
> version 3.10.
>
> 2) When we run client and server in the same machine it works fine. Client
> and server able to exchange the data without any issues. But if we run
> client and server in different machines, we face this problem.
>
> Server side logs when we run the server and client in same machine
>
> [image: Inline image 1]
>
> Client side log when we run the server and client in the same machine.
>
> [image: Inline image 2]
>
>
> 3) as suggested by Matt i disable the client auth when client-server run
> in different machines and surprisingly the TLS negotiation is successful.
> That leads me to suspect on segmentation and reassembly.
>
> Server side logs when the client auth is disabled
>
> [image: Inline image 3]
>
>
> Client side logs when the client auth is disabled.
>
> [image: Inline image 4]
>
>
> I took a wireshark trace and found that the server is able to receive the
> client certificate in 3 fragments and responding with the proper sack with
> right TSN. But server do not respond with its own certificate after that. I
> have attached the wireshark trace for the same. Path MTU in both the
> systems set to 1500.
>
>
> I took the strace of the calls between server and client but i could not
> figure out anything with the strace. I have attached the same in the mail.
> strace summary table is as below.
>
> ^C% time     seconds  usecs/call     calls    errors syscall
> ------ ----------- ----------- --------- --------- ----------------
>  33.71    0.000326           3        99        76 open
>  18.10    0.000175           3        54           mmap
>  15.10    0.000146           4        37           mprotect
>   9.72    0.000094          13         7           recvmsg
>   5.07    0.000049           2        26           read
>   4.03    0.000039           2        24           close
>   3.93    0.000038           2        17           fstat
>   3.83    0.000037          19         2           sendto
>   1.24    0.000012           3         4         3 stat
>   0.93    0.000009           2         5           brk
>   0.62    0.000006           6         1           munmap
>   0.52    0.000005           3         2           futex
>   0.41    0.000004           1         3           rt_sigaction
>   0.41    0.000004           4         1         1 access
>   0.41    0.000004           1         3           socket
>   0.41    0.000004           4         1           execve
>   0.31    0.000003           3         1           set_tid_address
>   0.21    0.000002           1         3           rt_sigprocmask
>   0.21    0.000002           1         2           bind
>   0.21    0.000002           1         3           getsockname
>   0.21    0.000002           2         1           getrlimit
>   0.21    0.000002           2         1           arch_prctl
>   0.21    0.000002           2         1           set_robust_list
>   0.00    0.000000           0        25           write
>   0.00    0.000000           0         1           ioctl
>   0.00    0.000000           0         1           listen
>   0.00    0.000000           0         6           clone
>   0.00    0.000000           0         4           epoll_ctl
>   0.00    0.000000           0         1           timerfd_create
>   0.00    0.000000           0         1           eventfd2
>   0.00    0.000000           0         1           epoll_create1
> ------ ----------- ----------- --------- --------- ----------------
> 100.00    0.000967                   338        80 total
>
>
> I am new to openssl code could not figure out how to debug the issue at
> socket layer. Can some one help me to understand how to go forward to
> resolve this issue ?
>
>
> Thanks and Regards,
> Mahesh G S
>
> On Fri, Apr 14, 2017 at 3:32 AM, Matt Caswell <matt at openssl.org> wrote:
>
>>
>>
>> On 13/04/17 18:26, Martin Brejcha wrote:
>> >
>> >
>> > Matt Caswell wrote on 04/13/2017 03:45 PM:
>> >>
>> >>
>> >> On 13/04/17 10:11, mahesh gs wrote:
>> >>> Hi,
>> >>>
>> >>> We are running SCTP connections with DTLS enabled in our application.
>> We
>> >>> have adapted openssl version (openssl-1.1.0e) to achieve the same.
>> >>>
>> >>> We have generated the self signed root and node certificates for
>> >>> testing. We have a strange problem with the incomplete DTLS handshake
>> if
>> >>> we run the DTLS client and DTLS server is different systems.If we run
>> >>> the DTLS client and server in same system handshake is successful,
>> >>> handshake is not successful if run client and server in different
>> VM's.
>> >>>
>> >>> This strange problem happens only for SCTP/DTLS connection. With the
>> >>> same set of certificates TCP/TLS connection is successful and we are
>> >>> able to exchange the application data.
>> >>>
>> >>> I am attaching the code bits for SSL_accept and SSL_connect and also
>> the
>> >>> wireshark trace of unsuccessful handshake. Please assist me to debug
>> >>> this problem.
>> >>>
>> >>> SSL_accept returns  SSL_ERROR_WANT_READ(2) infinite times but
>> >>> SSL_connect is called 4 or 5 times and select system call timeout.
>> >>
>> >> Your trace shows the following interactions occurring:
>> >>
>> >> Client                         Server
>> >> ------                         ------
>> >>
>> >> ClientHello          -------->
>> >>                      <-------- ServerHello
>> >>                      <-------- Certificate
>> >>                      <-------- CertificateRequest
>> >>                      <-------- ServerDone
>> >> Certificate          --------->
>> >> ClientKeyExchange    --------->
>> >> CertificateVerify    --------->
>> >> CCS                  --------->
>> >> [Encrypted Finished]
>> >>
>> >> We would expect the server to continue with its own CCS and Encrypted
>> >> Finished to complete the handshake. It seems that, for some reason, the
>> >> server is not receiving (or acting upon) the client's second flight of
>> >> messages.
>> >>
>> >> Normally in DTLS this sort of thing can happen due to lost messages etc
>> >> but, obviously, with SCTP, this is not the case. Something else must be
>> >> happening.
>> >>
>> >
>> > There are some SCTP segmented messages during handshake.
>> > May be some issue in reassembling could lead to strange behavior.
>> > Can be observed these segmented messages also when the handshake is
>> successful?
>>
>> That's an interesting question. The segmented messages are for the
>> Certificate messages. Obviously the client is able to read them just
>> fine (because it responds with its own Certificate message), but there
>> could plausibly be an issue on the server side. It would be interesting
>> to see what happens if you temporarily disable client auth so that the
>> client does not send this large Certficate message.
>>
>> Matt
>>
>>
>> --
>> openssl-users mailing list
>> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20170417/6dcdd2e7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 29077 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20170417/6dcdd2e7/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 59794 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20170417/6dcdd2e7/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 37346 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20170417/6dcdd2e7/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 53906 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20170417/6dcdd2e7/attachment-0007.png>


More information about the openssl-users mailing list