caserver

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0, Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c *ca.CA, log *slog.Logger, certLogger CertLogger) *caServer

New creates a new CA Server which needs to then be attached to some http server, a la `http.ListenAndServeTLS(...)`.

Types

type CertEvent added in v0.1.1

type CertEvent struct {
	PolicyID             string
	DirectoryRevision    string
	InventoryRevision    string
	Timestamp            time.Time
	SerialNumber         string
	ID                   string // Resolved inventory ID; empty if the policy server omitted it.
	UserName             string
	Principals           []string
	Connection           policy.Connection
	ValidAfter           time.Time
	ValidBefore          time.Time
	Extensions           map[string]string
	CertFingerprint      string
	PublicKeyFingerprint string
}

CertEvent contains all information about a certificate issuance event.

type CertLogger added in v0.1.1

type CertLogger interface {
	LogCert(ctx context.Context, event *CertEvent) error
}

CertLogger logs certificate issuance events for audit, compliance, and analytics.

type CreateCertRequest

type CreateCertRequest struct {
	PublicKey  sshcert.RawPublicKey `json:"publicKey"`
	Connection policy.Connection    `json:"connection"`
}

CreateCertRequest asks for a signed cert. Both fields are required.

type CreateCertResponse

type CreateCertResponse struct {
	Certificate sshcert.RawCertificate `json:"certificate"`
}

CreateCertResponse is response from a CreateCert request.

type NoopCertLogger added in v0.1.1

type NoopCertLogger struct{}

NoopCertLogger is a logger that does nothing. Used when certificate logging is disabled.

func NewNoopCertLogger added in v0.1.1

func NewNoopCertLogger() *NoopCertLogger

NewNoopCertLogger creates a no-op logger.

func (*NoopCertLogger) LogCert added in v0.1.1

func (n *NoopCertLogger) LogCert(ctx context.Context, event *CertEvent) error

LogCert does nothing and always returns nil.

type SlogCertLogger added in v0.1.1

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

SlogCertLogger logs certificate events using structured logging (slog). Works with any slog handler (text, JSON, CloudWatch, etc.).

func NewSlogCertLogger added in v0.1.1

func NewSlogCertLogger(logger *slog.Logger) *SlogCertLogger

NewSlogCertLogger creates a new certificate logger that emits structured logs.

func (*SlogCertLogger) LogCert added in v0.1.1

func (l *SlogCertLogger) LogCert(ctx context.Context, event *CertEvent) error

LogCert emits a structured log event with all certificate details.

Jump to

Keyboard shortcuts

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