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:
George Joseph
2024-04-23 14:15:20 -06:00
parent 3d2def92e2
commit f9a1e3095c
3 changed files with 39 additions and 5 deletions

View File

@@ -106,6 +106,17 @@ void ast_iostream_set_timeout_sequence(struct ast_iostream *stream, struct timev
*/
void ast_iostream_set_exclusive_input(struct ast_iostream *stream, int exclusive_input);
/*!
* \brief Set the iostream's SNI hostname for TLS client connections
*
* \param stream A pointer to an iostream
* \param sni_hostname The hostname to use for SNI when in client mode
*
* \retval 0 if the hostname was set successfully.
* \retval -1 if memory could not be allocated for the hostname.
*/
int ast_iostream_set_sni_hostname(struct ast_iostream *stream, const char *sni_hostname);
/*!
* \brief Get an iostream's file descriptor.
*