@@ -34,7 +34,6 @@ import (
3434 "context"
3535 "crypto/rand"
3636 "crypto/rsa"
37- "crypto/tls"
3837 "crypto/x509"
3938 "crypto/x509/pkix"
4039 "fmt"
@@ -43,6 +42,9 @@ import (
4342 "sync"
4443 "time"
4544
45+ "github.com/honeytrap/honeytrap/event"
46+ tls "github.com/honeytrap/honeytrap/services/jax3/crypto/tls"
47+
4648 "github.com/honeytrap/honeytrap/pushers"
4749)
4850
@@ -143,14 +145,35 @@ func (s *httpsService) getCertificate(hello *tls.ClientHelloInfo) (*tls.Certific
143145}
144146
145147func (s * httpsService ) Handle (ctx context.Context , conn net.Conn ) error {
148+ jax3Digest := ""
149+ serverName := ""
150+
146151 tlsConn := tls .Server (conn , & tls.Config {
147- Certificates : []tls.Certificate {},
148- GetCertificate : s .getCertificate ,
152+ Certificates : []tls.Certificate {},
153+ GetCertificate : func (hello * tls.ClientHelloInfo ) (* tls.Certificate , error ) {
154+ jax3Digest = hello .JAX3Digest ()
155+ serverName = hello .ServerName
156+ return s .getCertificate (hello )
157+ },
149158 })
150159
151160 if err := tlsConn .Handshake (); err != nil {
161+ s .c .Send (event .New (
162+ EventOptions ,
163+ event .Category ("https" ),
164+ event .Type ("handshake-failed" ),
165+ event .SourceAddr (conn .RemoteAddr ()),
166+ event .DestinationAddr (conn .LocalAddr ()),
167+ event .Custom ("https.jax3-digest" , jax3Digest ),
168+ event .Custom ("https.server-name" , serverName ),
169+ ))
170+
152171 return err
153172 }
154173
155- return s .httpService .Handle (ctx , tlsConn )
174+ return s .httpService .Handle (ctx , event .WithConn (
175+ tlsConn ,
176+ event .Custom ("https.jax3-digest" , jax3Digest ),
177+ event .Custom ("https.server-name" , serverName ),
178+ ))
156179}
0 commit comments