Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handshake failure while trying to send mail using openssl

I am trying to send mail from terminal using openssl by connecting to gmail's server using ssl on the port 465. Things are fine until i enter from address and authenticate. But when i enter RCPT TO, i get the following error.

RCPT TO: <[email protected]>
RENEGOTIATING
139815845389984:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshakefailure:s3_pkt.c:59

I can guess out that the problem might be due to missing security certificates. Can someone please help me solve the problem?

like image 448
Aarish Ramesh Avatar asked Mar 18 '23 03:03

Aarish Ramesh


2 Answers

I stumbled upon the same issue and finally found an answer here. Quoting it in SO in case people won't find the original answer:

The "renegotiating" happens as you are typing RCPT TO with "R" in Caps. That is how s_client is behaving. You may try entering "rcpt to" instead of "RCPT TO".

I tried with "rcpt to" and it worked like charm.

like image 158
wexlerrr Avatar answered Mar 22 '23 06:03

wexlerrr


When openssl s_client is executed without -quiet or -ign_eof:

At beginning of a line:

  • R → renegotiate session
  • Q → quit session

per s_client:

CONNECTED COMMANDS
    If a connection is established with an SSL server then any data
    received from the server is displayed and any key presses will be sent
    to the server. When used interactively (which means neither -quiet nor
    -ign_eof have been given), the session will be renegotiated if the line
    begins with an R, and if the line begins with a Q or if end of file is
    reached, the connection will be closed down.
like image 36
Andrew Siplas Avatar answered Mar 22 '23 06:03

Andrew Siplas