Skip to content
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.

Commit

Permalink
[ssl] added warning for proxenet->client ssl handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Jun 11, 2015
1 parent d65f0d0 commit a3ca2f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
14 changes: 9 additions & 5 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,9 @@ int create_http_socket(request_t* req, sock_t* server_sock, sock_t* client_sock,

retcode = proxenet_ssl_handshake(&(ssl_ctx->client.context));
if (retcode < 0) {
xlog(LOG_ERROR, "%s->'%s:%d': SSL handshake failed [code: %#x]\n",
PROGNAME, http_infos->hostname, http_infos->port, retcode);

xlog(LOG_ERROR, "handshake %s->server failed [code: %#x]\n", PROGNAME, retcode);
xlog(LOG_ERROR, "Client SSL handshake failed for '%s:%d'.\n",
http_infos->hostname, http_infos->port, retcode);
return -1;
}

Expand All @@ -601,8 +601,12 @@ int create_http_socket(request_t* req, sock_t* server_sock, sock_t* client_sock,
}

proxenet_ssl_wrap_socket(&(ssl_ctx->server.context), server_sock);
if (proxenet_ssl_handshake(&(ssl_ctx->server.context)) < 0) {
xlog(LOG_ERROR, "handshake %s->client failed\n", PROGNAME);

retcode = proxenet_ssl_handshake(&(ssl_ctx->server.context));
if (retcode < 0) {
xlog(LOG_ERROR, "handshake %s->client failed [code: %#x]\n", PROGNAME, retcode);
xlog(LOG_ERROR, "Server SSL handshake failed for '%s:%d'.\n",
http_infos->hostname, http_infos->port, retcode);
return -1;
}

Expand Down
10 changes: 9 additions & 1 deletion ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,15 @@ int proxenet_ssl_handshake(proxenet_ssl_context_t* ctx)

if(retcode!=POLARSSL_ERR_NET_WANT_READ && \
retcode!=POLARSSL_ERR_NET_WANT_WRITE) {
xlog(LOG_ERROR, "SSL handshake failed (returns %#x)\n", -retcode);

if (retcode == POLARSSL_ERR_NET_CONN_RESET)
xlog(LOG_WARNING,
"Peer has reset the SSL connection during handshake (error "
"%#x).To remove this warning, make sure to add proxenet "
"CA certificate as a Trusted CA for websites.\n",
-retcode);
else
xlog(LOG_ERROR, "SSL handshake failed (returns %#x)\n", -retcode);
break;
}

Expand Down

0 comments on commit a3ca2f7

Please sign in to comment.