tlsconfig

package
v1.22.10 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tlsconfig builds the client tls.Config values TMI uses for its in-cluster Redis and NATS connections (PR 6, threats T356/T388).

Trust is pinned to one CA file (never the system pool), TLS 1.2 is the floor, and a client certificate is re-read from disk on every handshake so a cert-manager renewal (which rewrites the mounted Secret) takes effect on the next reconnect without a restart.

Index

Constants

View Source
const (
	EnvNATSCAFile   = "TMI_NATS_TLS_CA_FILE"
	EnvNATSCertFile = "TMI_NATS_TLS_CERT_FILE"
	EnvNATSKeyFile  = "TMI_NATS_TLS_KEY_FILE"
	// EnvNATSServerName overrides the hostname verified against the server
	// certificate. Needed when TMI_NATS_URL carries an IP address (the
	// extractor dials the ClusterIP because its sandbox has no DNS).
	EnvNATSServerName = "TMI_NATS_TLS_SERVER_NAME"
)

Environment variables for the NATS client TLS files. The endpoint itself is TMI_NATS_URL (see internal/worker). All are optional; TLS is off when EnvNATSCAFile is unset.

Variables

This section is empty.

Functions

func Load

func Load(caFile, certFile, keyFile string) (*tls.Config, error)

Load builds a client TLS config that trusts only caFile. When certFile and keyFile are both set the config presents that client certificate, re-reading the pair on every handshake.

func NATSFromEnv

func NATSFromEnv() (*tls.Config, error)

NATSFromEnv returns the NATS client TLS config described by the environment variables above, or (nil, nil) when EnvNATSCAFile is unset (plaintext, the code default). Callers pass a non-nil result to nats.Secure.

Types

This section is empty.

Directories

Path Synopsis
Package testpki writes a throwaway certificate authority and leaf certificates for unit tests and the integration harness.
Package testpki writes a throwaway certificate authority and leaf certificates for unit tests and the integration harness.

Jump to

Keyboard shortcuts

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