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

Question: How to read tlsHello message #333

Open
kalcao opened this issue Dec 12, 2024 · 2 comments
Open

Question: How to read tlsHello message #333

kalcao opened this issue Dec 12, 2024 · 2 comments

Comments

@kalcao
Copy link

kalcao commented Dec 12, 2024

Hello! I'm having trouble on logging tlsHello message.

func PeekTLSHello(conn net.Conn) (*tls.ClientHelloInfo, *TeeConn, error) {
	var tlsHello *tls.ClientHelloInfo

	tlsConfig := &tls.Config{
		GetConfigForClient: func(hello *tls.ClientHelloInfo) (*tls.Config, error) {
			tlsHello = hello
			return nil, nil
		},
	}
	log.Printf("TLS Config: %+v\n", tlsConfig)
	teeConn := NewTeeConn(conn)
	header, err := teeConn.Buffer.Peek(5)
	if err != nil {
		return tlsHello, teeConn, err
	}
	if header[0] != 0x16 {
		return tlsHello, teeConn, err
	}
	helloBytes, err := teeConn.Buffer.Peek(len(header) + (int(header[3])<<8 | int(header[4])))
	if err != nil {
		return tlsHello, teeConn, err
	}
	err = tls.Server(bufConn{reader: bytes.NewReader(helloBytes)}, tlsConfig).Handshake()
	teeConn.Unbuffer = true
	return tlsHello, teeConn, err
}

I've refactored all the imports and name on go.mod, and replaced from github.com/antoniomika/sish to sish.
I don't get any error or any prints about it.

How can I access to the tlsHello message? Of course I visited the site through https.

This is a log I've got: https://pastebin.com/CBDr1Qtx

@kalcao
Copy link
Author

kalcao commented Dec 13, 2024

It seems https.go is not called

@antoniomika
Copy link
Owner

Hi @kalcao,

What exactly are you trying to do? sish manages all of the SNI checking for the user, so there should be no changes needed.

Best,

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