tlsconfig

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogBundleUsage

func LogBundleUsage(logger *slog.Logger, bundle *Bundle)

LogBundleUsage logs that a custom CA bundle is in use. It logs at most once.

func LogTrustReport

func LogTrustReport(logger *slog.Logger, bundle *Bundle)

LogTrustReport logs a structured TLS trust report once.

Types

type Bundle

type Bundle struct {
	Path        string
	RootCAs     *x509.CertPool
	SystemTrust SystemTrustSummary
	ExtraBundle *ExtraBundleSummary
}

Bundle contains a loaded PEM CA bundle and the derived RootCAs pool.

func LoadBundle

func LoadBundle(path string) (*Bundle, error)

LoadBundle reads the provided PEM file and returns a certificate pool that extends the system trust roots with the provided certificates.

type CertMetadata

type CertMetadata struct {
	CertID      string `json:"cert_id"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	SubjectCN   string `json:"subject_cn,omitempty"`
	IssuerCN    string `json:"issuer_cn,omitempty"`
	NotBefore   string `json:"not_before,omitempty"`
	NotAfter    string `json:"not_after,omitempty"`
	Source      string `json:"source,omitempty"`
	ParseStatus string `json:"parse_status"`
}

CertMetadata captures metadata for a certificate.

type ClientCertificate

type ClientCertificate struct {
	CertPath    string
	KeyPath     string
	Certificate tls.Certificate
}

ClientCertificate contains a loaded client certificate/key pair used for outbound mTLS.

func LoadClientCertificate

func LoadClientCertificate(certPath, keyPath string) (*ClientCertificate, error)

LoadClientCertificate loads and validates an mTLS client certificate/key pair. Both paths are required when either is set.

type ExtraBundleSummary

type ExtraBundleSummary struct {
	Path         string         `json:"path,omitempty"`
	CertCount    int            `json:"cert_count"`
	ParseErrors  int            `json:"parse_errors"`
	Certificates []CertMetadata `json:"certificates,omitempty"`
}

ExtraBundleSummary describes the extra CA bundle.

type SystemTrustSummary

type SystemTrustSummary struct {
	Enabled      bool     `json:"enabled"`
	Source       string   `json:"source"`
	SourcePaths  []string `json:"source_paths,omitempty"`
	FallbackNote string   `json:"fallback_note,omitempty"`
}

SystemTrustSummary describes system trust root usage.

type TrustReport

type TrustReport struct {
	SystemTrust SystemTrustSummary  `json:"system_trust"`
	ExtraBundle *ExtraBundleSummary `json:"extra_bundle,omitempty"`
}

TrustReport describes outbound TLS trust configuration.

func BuildTrustReport

func BuildTrustReport(bundle *Bundle) TrustReport

BuildTrustReport returns trust metadata for logging and APIs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL