Ssl – start time in openssl s_client

curlopensslssltime

After running the openssl s_client command to connect to a remote host. The following output was shown on the terminal. Can somebody please help me understand the start time in this log. What does it represent and what format is it in ?

I believe it should be wall clock time and in microseconds. However I have not been able to find documentation related to it.

   ---
SSL handshake has read 3876 bytes and written 319 bytes
---
New, TLSv1/SSLv3, Cipher is DHE-RSA-AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
    Protocol  : TLSv1
    Cipher    : DHE-RSA-AES256-SHA
    Session-ID: 3F4EE3992B46727BE2C7C3E76A9A6A8D64D66EE843CB1BB17A76AE2E030C7161
    Session-ID-ctx:
    Master-Key: 016209E50432EFE2359DB73AB527AF718152BFE6F88215A9CE40604E8FF2E2A3AC97A175F46DF737596866A8BC8E3F7F
    Key-Arg   : None
    Start Time: 1397678467
    Timeout   : 300 (sec)
    Verify return code: 19 (self signed certificate in certificate chain)
---
DONE

Also is there any way to just measure the handshake time and the time to complete a request (record phase of tls) using openssl s_client or s_time.

s_time represents the overall time taken for a handshake and time to get the resource from the server.

Using curl, there may be a way to get time_appconnect which is handshake timing, time_total and then subtract the both to get an approximate timing for the record phase. (ignoring the time taken to do a lookup, requests etc as they are really negligible).

I am trying to measure the time taken to establish a TLS connection with some firewall rules and without some firewall rules.

Best Answer

About the Start Time it's a time stamp you can get it through a date or convert it through it.

#!/bin/bash
NOW=$(date "+%s") #timestamp
starttime="1397678467"
convert=$(date --date="@$starttime" "+%Y-%m-%d %H:%M:%S")
echo $convert

So your time stamp when converted you will get this date 2014-04-16 23:01:07


Also you can use the date command to help you convert and calculate time_appconnect and time_total that came from curl -w output

Try dividing time_appconnect or time_total / 60 = minutes. as the time_total or time_appconnect will be printed in seconds