Documentation
¶
Overview ¶
Package tls generates the local CA and wildcard certificate (via crypto/x509) and installs/removes trust in the system and NSS stores.
Index ¶
- func CACertLocation() (string, error)
- func CACertPath() (string, error)
- func CAKeyPath() (string, error)
- func CertPath() (string, error)
- func Dir() (string, error)
- func EnsureCA() (certPath, keyPath string, err error)
- func InstallNSSTrust(r platform.Runner) error
- func InstallSystemTrust(r platform.Runner) error
- func IssueHostCert(caCert *x509.Certificate, caKey *ecdsa.PrivateKey, hosts []string) (certPEM, keyPEM []byte, err error)
- func KeyPath() (string, error)
- func LoadCA(certPath, keyPath string) (*x509.Certificate, *ecdsa.PrivateKey, error)
- func Purge() error
- func RemoveNSSTrust(r platform.Runner) error
- func RemoveSystemTrust(r platform.Runner) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CACertLocation ¶ added in v0.4.0
CACertLocation resolves the CA certificate path without creating any directories, so query-only callers (`proximo config ca-path`) leave a host without proximo state untouched. The file may not exist yet (proximo not installed); callers that care must check.
func CACertPath ¶
CACertPath is the path to the local CA certificate (PEM).
func EnsureCA ¶
EnsureCA generates a local CA on first use and reuses an existing one on subsequent runs. It returns the CA certificate and key file paths.
func InstallNSSTrust ¶
InstallNSSTrust adds the local CA to the NSS trust databases used by Firefox and Chrome-on-Linux. When certutil is missing it installs nss-tools first. certutil invocations go through the injected Runner; certutil discovery and bootstrap stay on the package helpers.
func InstallSystemTrust ¶
InstallSystemTrust adds the local CA to the OS system trust store using built-in OS tooling. Privileged operations go through the injected Runner so the install step is testable.
func IssueHostCert ¶
func IssueHostCert(caCert *x509.Certificate, caKey *ecdsa.PrivateKey, hosts []string) (certPEM, keyPEM []byte, err error)
IssueHostCert generates a leaf certificate covering the exact hosts, signed by the CA, and returns it PEM-encoded. Validity stays under 398 days to satisfy the Apple/Chrome TLS policy (which rejects longer-lived leaf certs, and also rejects TLD-level wildcards like *.test — hence exact SANs, no wildcard).
func LoadCA ¶
func LoadCA(certPath, keyPath string) (*x509.Certificate, *ecdsa.PrivateKey, error)
LoadCA loads the CA certificate and private key from PEM files.
func RemoveNSSTrust ¶
RemoveNSSTrust removes the local CA from all discovered NSS databases.
func RemoveSystemTrust ¶
RemoveSystemTrust removes the local CA from the OS system trust store.
Types ¶
This section is empty.