Documentation
¶
Index ¶
Constants ¶
const ( ErrTLSHandshakeFailed greet.ErrorCode = "tls_handshake_failed" ErrTLSConfigFailed greet.ErrorCode = "tls_config_failed" )
const DefaultTLSPort = 443
DefaultTLSPort is the well-known port for TLS (HTTPS).
const ProtocolName = "tls"
ProtocolName is the registered name for the TLS protocol.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CertChainEntry ¶
type CertChainEntry struct {
Subject string
Issuer string
Serial string
NotBefore string
NotAfter string
Version int
DNSNames []string
IPAddresses []string
IsCA bool
SignatureAlgo string
PublicKeyAlgo string
SHA256Fingerprint string
// Status holds Chrome-style CERT_ checks for this individual certificate.
// ref: https://github.com/chromium/chromium/blob/main/net/cert/cert_status_flags.cc
Status []string
}
CertChainEntry holds the details of a single certificate in the chain.
type TLS ¶
type TLS struct{}
TLS implements a TLS connectivity and certificate probe as an AppLayer. It performs a TLS handshake over an already-dialed net.Conn, with InsecureSkipVerify, and reports Chrome-style CERT_ status checks.
func (*TLS) BaseTransport ¶ added in v1.0.3
func (*TLS) DefaultPort ¶
func (*TLS) Description ¶
func (*TLS) Handshake ¶ added in v1.0.3
func (t *TLS) Handshake(ctx context.Context, start time.Time, conn net.Conn, host string, port int, cfg *greet.GreetConfig) (net.Conn, greet.LayerData, greet.LayerTiming, error)
Handshake upgrades conn to TLS, performs the handshake, and returns the certificate chain with Chrome-style status checks. It returns the *tls.Conn so subsequent layers (e.g. http) can read/write over the encrypted channel.
type TLSConfig ¶ added in v1.0.3
type TLSConfig struct {
// ServerName overrides the SNI hostname sent in the ClientHello.
// When empty, the target host is used.
ServerName string
// CertPEM is the PEM-encoded client certificate for mTLS.
// When non-empty, the certificate is presented to the server
// during the handshake. KeyPEM must also be set.
CertPEM []byte
// KeyPEM is the PEM-encoded private key for the client certificate.
// When empty and CertPEM is non-empty, the key is expected to be
// bundled in the same PEM block as CertPEM.
KeyPEM []byte
// CAPEM is the PEM-encoded CA certificate pool. When non-empty,
// the pool is used as the root of trust (RootCAs) instead of
// skipping verification entirely.
CAPEM []byte
// InsecureSkipVerify controls whether the server's certificate chain
// and hostname are verified. Defaults to true.
InsecureSkipVerify bool
}
TLSConfig holds per-layer configuration for the TLS layer. All PEM fields accept raw bytes (loaded from file, stream, embed, etc.).
func DefaultTLSConfig ¶ added in v1.0.3
func DefaultTLSConfig() *TLSConfig
DefaultTLSConfig returns a TLSConfig with safe defaults.
func (*TLSConfig) LayerConfigName ¶ added in v1.0.3
type TLSResult ¶
type TLSResult struct {
// CertChain contains all presented certificates sorted from leaf to root.
// The leaf certificate is always CertChain[0].
CertChain []CertChainEntry
// Status is the final concluded chain status. It holds the statuses from
// the first certificate (walking leaf→root) that has a non-OK check, or
// ["OK"] if every certificate in the chain passes all checks.
Status []string
}
TLSResult holds the full certificate chain and the concluded chain status from a TLS handshake.