Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ClientHelloDecoder = &decoder.AbstractDecoder{Name: "TLSClientHello", Type: types.Type_NC_TLSClientHello, Description: "Reassembled TLS client hellos"}
var Decoder = &decoder.StreamDecoder{ Type: types.Type_NC_TLSCertificate, Name: serviceTLS, Description: "Transport Layer Security certificates extracted from TLS handshakes", PostInit: func(d *decoder.StreamDecoder) error { var err error tlsLog, _, err = logging.InitZapLogger( decoderconfig.Instance.Out, "tls", decoderconfig.Instance.Debug, ) return err }, Specificity: core.SpecificityStructural, CanDecode: func(client, server []byte) bool { for _, data := range [][]byte{client, server} { if len(data) >= 6 && data[0] == 22 && data[1] == 3 && data[2] <= 3 && (data[5] == 1 || data[5] == 2) { return true } } if RecordDecoder.Writer != nil { for _, data := range [][]byte{client, server} { if len(data) >= 3 && data[0] >= 20 && data[0] <= 24 && data[1] == 3 && data[2] <= 3 { return true } } } if len(client) >= 6 { if client[0] == recordTypeHandshake && (client[1] == 0x03 && client[2] <= 0x04) { if len(client) >= 6 && client[5] == handshakeTypeClientHello { tlsLog.Info("TLS traffic detected - CanDecode matched (ClientHello)", zap.Int("clientLen", len(client)), zap.Int("serverLen", len(server)), ) return true } } } if len(server) >= 6 { if server[0] == recordTypeHandshake && (server[1] == 0x03 && server[2] <= 0x04) { if len(server) >= 6 && server[5] == handshakeTypeServerHello { tlsLog.Info("TLS traffic detected - CanDecode matched (ServerHello)", zap.Int("clientLen", len(client)), zap.Int("serverLen", len(server)), ) return true } } } tlsLog.Debug("TLS CanDecode check failed", zap.Int("clientLen", len(client)), zap.Int("serverLen", len(server)), ) return false }, DeInit: func(sd *decoder.StreamDecoder) error { flushCertificates(sd) return tlsLog.Sync() }, Factory: &tlsReader{}, Typ: core.TCP, }
Decoder for protocol analysis and writing audit records to disk.
var RecordDecoder = &decoder.AbstractDecoder{ Name: "TLSRecord", Type: types.Type_NC_TLSRecord, Description: "Stream-framed TLS record headers and known-plaintext alerts (no record payloads)", }
A writer-only decoder: TLS retains its single stream reader and certificate path.
var ServerHelloDecoder = &decoder.AbstractDecoder{Name: "TLSServerHello", Type: types.Type_NC_TLSServerHello, Description: "Reassembled TLS server hellos"}
Functions ¶
func AddOrUpdateCertificate ¶
func AddOrUpdateCertificate(cert *types.TLSCertificate) bool
AddOrUpdateCertificate adds a new certificate or updates an existing one Returns true if this is a new certificate, false if it was updated Exported for testing
func GetCertificate ¶
func GetCertificate(fingerprint string) *types.TLSCertificate
GetCertificate returns a certificate by its SHA256 fingerprint Exported for testing
func GetCertificateCount ¶
func GetCertificateCount() int
GetCertificateCount returns the number of certificates in the cache Exported for testing
func ObserveUpgrade ¶
func ObserveUpgrade(c *core.ConversationInfo, primary string)
ObserveUpgrade shares the TLS framer with validated cleartext protocol hand-offs.
func ResetCertificates ¶
func ResetCertificates()
ResetCertificates clears all certificates from memory This should be called when resetting state between processing different files
Types ¶
This section is empty.