Documentation
¶
Overview ¶
Package tlsdistrust refuses TLS connections whose verified certificate chain contains a CA key that is known to be compromised, or a root certificate that Mozilla removed from NSS after the October 2026 eMudhra incident (Mozilla bug 2083449).
The private keys of eight eMudhra intermediate CAs are recoverable from their public certificates (each is a P-384 key whose private scalar is below 256). Sectigo cross-signed all eight under "AAA Certificate Services", which Apple and Microsoft still trust. Chrome blocks the intermediates with its CRLSet and Firefox with OneCRL, but Go, curl and most other non-browser clients check neither revocation nor Certificate Transparency, and an operating system trust store keeps a removed root until its vendor ships an update. Matching the SubjectPublicKeyInfo digest catches the eMudhra-issued certificate and the Sectigo cross-signed certificate of the same key, whichever path the verifier built.
pig additive (D191): every outbound TLS client of PiG applies Verify through Harden or HardenTransport; importing this package hardens http.DefaultTransport for every client that leaves its Transport nil.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDistrusted = errors.New("tls: distrusted CA in certificate chain")
ErrDistrusted is matched by errors.Is for every DistrustedError.
Functions ¶
func Check ¶
func Check(serverName string, certificate *x509.Certificate) error
Check returns a DistrustedError when certificate is on the blocklist.
func Harden ¶
Harden returns a copy of config (a new config when it is nil) whose VerifyConnection runs Verify before any hook config already had.
func HardenTransport ¶
HardenTransport applies Harden to transport's TLSClientConfig.
func Verify ¶
func Verify(state tls.ConnectionState) error
Verify is a tls.Config.VerifyConnection hook. It rejects a connection when any certificate of any verified chain, leaf and trust anchor included, is on the blocklist. Rejecting on any chain rather than only when every chain is blocked is deliberate: the verifier may have found a second path for a chain whose forged certificate was signed by a distrusted key, and no legitimate site is issued under these CAs.
A connection made with InsecureSkipVerify has no verified chains and is not checked: that option is the caller's explicit decision to trust the peer without verification.
Types ¶
type DistrustedError ¶
type DistrustedError struct {
// ServerName is the name the client verified the chain for.
ServerName string
// CA is the name of the distrusted certificate's subject.
CA string
// SPKISHA256 is the lower-case hex SHA-256 of the certificate's SubjectPublicKeyInfo.
SPKISHA256 string
// Reason says why the certificate is distrusted.
Reason string
}
DistrustedError reports the first distrusted certificate found in a verified chain.
func (*DistrustedError) Error ¶
func (e *DistrustedError) Error() string
func (*DistrustedError) Unwrap ¶
func (e *DistrustedError) Unwrap() error
Directories
¶
| Path | Synopsis |
|---|---|
|
Package tlsdistrusttest holds the public certificates of the October 2026 eMudhra incident and builds, for tests only, a server certificate signed by a compromised intermediate.
|
Package tlsdistrusttest holds the public certificates of the October 2026 eMudhra incident and builds, for tests only, a server certificate signed by a compromised intermediate. |