SNI in tlsproxy

Christian Grothoff <[email protected]>
Newsgroups gmane.network.gnutls.general
Message-ID <[email protected]>
Hi!

The attached patch fixes the tlsproxy example to enable SNI.  This
explains _part_ of the problem I was seeing with certificate
verification, the remaining question is why curl sometimes doesn't do it
as it should, but that's not a GnuTLS issue.

Happy hacking!

Christian

_______________________________________________
Gnutls-help mailing list
[email protected]
http://lists.gnupg.org/mailman/listinfo/gnutls-help
0001-support-SNI-in-tlsproxy.patch (text/x-patch, 713 B)
From 91036d8be3b071c51f22da755bc25aa97d7c133f Mon Sep 17 00:00:00 2001
From: Christian Grothoff <[email protected]>
Date: Wed, 13 Jun 2018 18:39:29 +0200
Subject: [PATCH] support SNI in tlsproxy

---
 crypto-gnutls.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crypto-gnutls.c b/crypto-gnutls.c
index d885250..9519b59 100644
--- a/crypto-gnutls.c
+++ b/crypto-gnutls.c
@@ -293,6 +293,9 @@ tlssession_new (int isserver,
     }
 
   gnutls_session_set_ptr (s->session, (void *) s);
+  if (s->hostname && *s->hostname)
+	  gnutls_server_name_set (s->session, GNUTLS_NAME_DNS, s->hostname,
+				  strlen (s->hostname));
 
   ret = gnutls_set_default_priority (s->session);
   if (ret < 0)
-- 
2.17.1
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE2EI7yzJseQcDOSnHk55r4eKfw8wFAlshSX8ACgkQk55r4eKf
w8wU1Q//SSB5enllTrMWsyX8OcCzKyiFbheaHHGGBzPRcavrGuvRHheJwIaQV7ff
2LQF+g5IisE3P8uy8qbR/7zCpnDk0U/uxg98Bs1NtFx64z5tT8KFPGWKy5cDpnlq
zoO/miQMFrU423XU2h/ZA2OUToziE7DBRduHnF8UjYCGrSvA9y1B97IF29ZmCEhB
eBH6mFqlaNxwfi3136Pt1NGXbW9M4oJhbXd3bBk9kwljbR0e3LvzaidaW6iKndpe
F4w1Pja8s2T6pchv9epjffqMSNrLC7nJdDBwHew02/FvHjYocTg/YhJYAqZ2iMub
M0mf/rwF2OLSdXQqkZ7GAZNupXtQIdZLa+tyzpJqUfeyvba43VEfATIlGN3fBAiR
CwTmp4gUIpR5BK7/MsisJNMVPOqTkTP92s+nmvrbMQR+GuxsZbhXjVq1FLnnUpq+
bjvzr4GhQhA6cBnEHAhToRUaaLP6M0mQxIQ7WGAKT/goKVLTi4FNqZnpYpC+W0Yq
Ecz7bfKIvawh0Z2iNpk7D9ETEpttTSzs2oZEL92jBl+DgcKFrdVWvTrgEQOwIiol
7YbgukvoXJN+8CJ9/N6MXOg5VFd+P1sRxU6WHvCdyUE+Z2V/poLgCBWKVNer0TFq
swuLb//O8342MW2H3up9ss92klSurqpoUK2Iul7+rvCYNzaTkrk=
=GLmF
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.