hostca

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: AGPL-3.0 Imports: 17 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 hostca is the private certificate authority that the host uses to authenticate a gateway. The host is the only signer. A gateway holds one client certificate, and the host refuses a connection that carries none.

Index

Constants

View Source
const Dir = "ca"

Dir is the CA directory inside the Kiln root.

Variables

This section is empty.

Functions

func IssueLeaf added in v0.12.0

func IssueLeaf(sealKey []byte, ca store.TenantCA, host string) (certPEM, keyPEM string, err error)

IssueLeaf makes the certificate of one bound host. Its validity starts with the CA, because a guest clock can lag behind the host right after a restore.

func TenantCA added in v0.12.0

func TenantCA(ctx context.Context, st store.Store, sealKey []byte, tenant string) (store.TenantCA, error)

TenantCA returns the CA of one tenant, and makes it on first use. Its key stays sealed in the database, and two tenants never share a CA.

Types

type CA

type CA struct {
	// contains filtered or unexported fields
}

CA reads and writes the files of one certificate authority.

func New

func New(root string) *CA

New names the CA directory inside a Kiln root.

func (*CA) Ensure

func (c *CA) Ensure() error

Ensure creates the CA when the root has none. It is idempotent, so a second kilnd init keeps the certificates a gateway already holds.

func (*CA) Issue

func (c *CA) Issue(name string, days int) (caPEM, certPEM, keyPEM, serial string, err error)

Issue signs one client certificate and returns the CA certificate, the client certificate, the client key and the serial. The key exists once, in this result.

func (*CA) Revoke

func (c *CA) Revoke(serial string) error

Revoke adds one serial to the revoked list. A revoked certificate cannot connect, and the CA keeps signing for every other gateway.

func (*CA) Revoked

func (c *CA) Revoked() (map[string]bool, error)

Revoked returns the revoked serials.

func (*CA) ServerTLS

func (c *CA) ServerTLS(hostnames ...string) (*tls.Config, error)

ServerTLS returns the TLS config of the host's gateway listener. The certificate names every address a gateway dials, so the gateway verifies the host. The listener demands a client certificate from the same CA and refuses a revoked serial.

Jump to

Keyboard shortcuts

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