Bruno Wego
Bruno Wego

Reputation: 2430

Connection with google mail using openssl s_client command

The objective is send a email using the command below:

openssl s_client \
  -connect smtp.gmail.com:587 \
  -starttls smtp

For this, after connect I submit necessary commands with username and password in base64:

EHLO smtp.gmail.com
AUTH LOGIN
MAIL FROM: <[email protected]>
RCPT TO: <*****@gmail.com>
DATA
Subject: Sending an email using telnet

Hello,
This is an email sent by using the telnet command.

Your friend,
Me!
.
QUIT

I'm trying understand and search a resolution for the issue below:

RENEGOTIATING
4707790444:error:1400444C:SSL routines:CONNECT_CR_SRVR_HELLO:tlsv1 alert no renegotiation:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-47.11.1/libressl-2.8/ssl/ssl_pkt.c:1200:SSL alert number 100
4707790444:error:140040E5:SSL routines:CONNECT_CR_SRVR_HELLO:ssl handshake failure:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-47.11.1/libressl-2.8/ssl/ssl_pkt.c:585:

Upvotes: 1

Views: 3528

Answers (1)

Matt Caswell
Matt Caswell

Reputation: 9437

openssl s_client is a tool intended for testing SSL/TLS connections. As such it provides you with various "commands" that have special effects on any established SSL/TLS connection. Most text you type will just be sent to the peer. But if it sees a command it will execute it. Commands begin at the start of a line, and one such command is the single letter "R". This has the effect of causing s_client to request a renegotiation with the server. Your line starting with "RCPT TO" is causing this command to execute. The server is configured to not accept renegotiation requests - hence the error that you are seeing.

Try using the "-ign_eof" flag to s_client. This has the effect of disabling these commands.

Upvotes: 5

Related Questions