mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-06 01:45:11 +00:00
tcptls/iostream: Add support for setting SNI on client TLS connections
If the hostname field of the ast_tcptls_session_args structure is set (which it is for websocket client connections), that hostname will now automatically be used in an SNI TLS extension in the client hello. Resolves: #713 UserNote: Secure websocket client connections now send SNI in the TLS client hello.
This commit is contained in:
@@ -741,6 +741,13 @@ struct ast_tcptls_session_instance *ast_tcptls_client_create(struct ast_tcptls_s
|
||||
/* Set current info */
|
||||
ast_sockaddr_copy(&desc->old_address, &desc->remote_address);
|
||||
|
||||
if (!ast_strlen_zero(desc->hostname)) {
|
||||
if (ast_iostream_set_sni_hostname(tcptls_session->stream, desc->hostname) != 0) {
|
||||
ast_log(LOG_WARNING, "Unable to set SNI hostname '%s' on connection '%s'\n",
|
||||
desc->hostname, desc->name);
|
||||
}
|
||||
}
|
||||
|
||||
return tcptls_session;
|
||||
|
||||
error:
|
||||
|
||||
Reference in New Issue
Block a user