Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commit 4bac945fc78121277d3735ffb22ba83a64b91c16 to fix issue #57 is wrong #59

Closed
e9hack opened this issue Dec 3, 2022 · 1 comment
Closed

Comments

@e9hack
Copy link

e9hack commented Dec 3, 2022

commit 4bac945 to fix #57 is wrong and proxytunnel is broken since this commit. SSL_set_tlsext_host_name() returns 1 on success or 0 in case of an error. Error codes like SSL_TLSEXT_ERR_OK, SSL_TLSEXT_ERR_ALERT_FATAL, SSL_TLSEXT_ERR_ALERT_WARNING and SSL_TLSEXT_ERR_NOACK are returned by the underlaying function SSL_CTX_set_tlsext_servername_callback() but not from SSL_set_tlsext_host_name() itself. My proposal to fix the issue is:

diff --git a/ptstream.c b/ptstream.c
index 7146862..101b2c8 100644
--- a/ptstream.c
+++ b/ptstream.c
@@ -341,13 +341,11 @@ int stream_enable_ssl(PTSTREAM *pts, const char *proxy_arg) {
 		message( "Set SNI hostname to %s\n", peer_host);
 	}
 	res = SSL_set_tlsext_host_name(ssl, peer_host);
-	if (res != SSL_TLSEXT_ERR_OK) {
-		unsigned long ssl_err = (res == SSL_TLSEXT_ERR_ALERT_WARNING ? SSL_TLSEXT_ERR_ALERT_WARNING : ERR_get_error());
-		message( "SSL_set_tlsext_host_name returned: %lu (0x%lx). "
-		         "TLS SNI error, giving up\n", ssl_err, ssl_err );
-		exit( 1 );
+	if (res != 1) {
+		message( "SSL_set_tlsext_host_name failed\n" );
+		goto fail;
 	}
-	
+
 	if ( SSL_connect (ssl) <= 0) {
         message( "SSL_connect failed\n");
         goto fail;
@68420948
Copy link
Member

Fix released with proxytunnel v1.11.1

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants