Optional kernel TLS with OpenSSL (ssl_ktls)

ssl_ktls asks OpenSSL to hand TLS to the kernel (SSL_OP_ENABLE_KTLS)
on the connections of the services which follow, both to clients and
to servers; ssl_noktls, the default, keeps it in 3proxy. Where the
library, the kernel and the cipher allow it, the kernel then encrypts
and decrypts, and SSL_read/SSL_write go on working over it. What a
service got is logged on its first TLS connection.

Reading ahead is left off where the kernel took receiving, which reads
a record at a time. A build whose library has no kernel TLS (wolfSSL,
OpenSSL before 3.0 or without it) warns and ignores the command.
splice() is not used for TLS services yet.

Tested on AlmaLinux 10 (OpenSSL 3.5.8, tls module): both directions
of both legs of a TLS chain in the kernel, the suite passing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Vladimir DubrovinandClaude Opus 5.5 committed 2026-10-14 17:29:21 +03:00
1 parent 07fd3083fa
commit d0e88a7b88
6 files changed
+153 -6

No files matched your search

+4
View File
@@ -2046,6 +2046,8 @@ int h_no_client_verify(int argc, unsigned char **argv);
int h_server_verify(int argc, unsigned char **argv);
int h_no_server_verify(int argc, unsigned char **argv);
int h_client_mode(int argc, unsigned char **argv);
int h_ktls(int argc, unsigned char **argv);
int h_noktls(int argc, unsigned char **argv);
#endif
#ifdef WITH_HTTPSRV
int h_http_content_type(int argc, unsigned char **argv);
@@ -2183,6 +2185,8 @@ struct commands commandhandlers[]={
{NULL, "ssl_client_sni", h_client_sni, 1, 2},
{NULL, "ssl_client_alpn", h_client_alpn, 1, 0},
{NULL, "ssl_client_mode", h_client_mode, 1, 2},
{NULL, "ssl_ktls", h_ktls, 1, 1},
{NULL, "ssl_noktls", h_noktls, 1, 1},
{NULL, "ssl_certcache", h_certcache, 2, 2},
#endif
#ifdef WITH_TRANSPARENT