ssl

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PendingStateFile is where pending certificates are stored
	PendingStateFile = "/data/tako/ssl/pending.json"
	// CheckInterval is how often to check DNS propagation
	CheckInterval = 30 * time.Second
)

Variables

This section is empty.

Functions

func CheckPort53Accessible

func CheckPort53Accessible(serverIP string) error

CheckPort53Accessible checks if port 53 is accessible on the given IP. Note: This only verifies TCP connectivity. UDP "connectivity" cannot be reliably verified without sending actual DNS queries, as UDP is connectionless. A successful TCP check is a good indicator that the DNS server is running.

func GroupWildcards

func GroupWildcards(reqs []DomainRequirement) []string

GroupWildcards returns unique wildcard base domains

func HasWildcards

func HasWildcards(reqs []DomainRequirement) bool

HasWildcards checks if any requirements include wildcards

func IsWildcard

func IsWildcard(domain string) bool

IsWildcard checks if a domain is a wildcard domain

Types

type CertificateStatus

type CertificateStatus struct {
	Domain      string    `json:"domain"`
	Status      string    `json:"status"` // "pending", "dns_verified", "issued", "failed"
	DNSVerified bool      `json:"dns_verified"`
	CNAMETarget string    `json:"cname_target"`
	StartedAt   time.Time `json:"started_at"`
	LastCheck   time.Time `json:"last_check"`
	Attempts    int       `json:"attempts"`
	Error       string    `json:"error,omitempty"`
}

CertificateStatus represents the status of a certificate

type ChallengeType

type ChallengeType string

ChallengeType represents the ACME challenge type

const (
	// ChallengeHTTP01 uses HTTP-01 challenge (standard, no wildcards)
	ChallengeHTTP01 ChallengeType = "http-01"
	// ChallengeDNS01 uses DNS-01 challenge (required for wildcards)
	ChallengeDNS01 ChallengeType = "dns-01"
)

type DNSChecker

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

DNSChecker handles DNS propagation verification

func NewDNSChecker

func NewDNSChecker() *DNSChecker

NewDNSChecker creates a new DNS checker with default resolvers

func (*DNSChecker) CheckCNAME

func (c *DNSChecker) CheckCNAME(domain string, expectedTarget string) (bool, error)

CheckCNAME checks if a CNAME record exists and points to the expected target

func (*DNSChecker) WaitForDNSPropagation

func (c *DNSChecker) WaitForDNSPropagation(ctx context.Context, domain, expectedTarget string, checkInterval time.Duration, onProgress func(attempt int, elapsed time.Duration)) (bool, error)

WaitForDNSPropagation waits for DNS propagation with progress updates

type DNSPropagationResult

type DNSPropagationResult struct {
	Domain   string
	Verified bool
	Attempts int
	Duration time.Duration
	Error    error
}

DNSPropagationResult represents the result of a DNS propagation check

type DomainRequirement

type DomainRequirement struct {
	Domain        string
	IsWildcard    bool
	BaseDomain    string // "example.com" for "*.example.com"
	ChallengeType ChallengeType
	ServiceName   string
}

DomainRequirement represents SSL requirements for a domain

func DetectRequirements

func DetectRequirements(services map[string]config.ServiceConfig) []DomainRequirement

DetectRequirements analyzes all service domains and returns SSL requirements

func FilterByChallenge

func FilterByChallenge(reqs []DomainRequirement, challengeType ChallengeType) []DomainRequirement

FilterByChallenge returns requirements matching the specified challenge type

type Monitor

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

Monitor handles background SSL certificate monitoring

func NewMonitor

func NewMonitor(client *ssh.Client, projectName, environment string, notifier *notification.Notifier, verbose bool) *Monitor

NewMonitor creates a new SSL monitor

func (*Monitor) AddPending

func (m *Monitor) AddPending(pending acmedns.PendingCertificate) error

AddPending adds a pending certificate to the monitoring list

func (*Monitor) CheckPending

func (m *Monitor) CheckPending() (issued []string, stillPending []string, errors []error)

CheckPending checks all pending certificates and issues them if DNS is ready

func (*Monitor) GetStatus

func (m *Monitor) GetStatus() ([]CertificateStatus, error)

GetStatus returns the current status of all pending certificates

func (*Monitor) HasPending

func (m *Monitor) HasPending() bool

HasPending returns true if there are pending certificates

func (*Monitor) LoadState

func (m *Monitor) LoadState() (*PendingState, error)

LoadState loads the pending certificates state

func (*Monitor) RemovePending

func (m *Monitor) RemovePending(domain string) error

RemovePending removes a domain from the pending list

func (*Monitor) SaveState

func (m *Monitor) SaveState(state *PendingState) error

SaveState saves the pending certificates state

type PendingState

type PendingState struct {
	Certificates []acmedns.PendingCertificate `json:"certificates"`
	UpdatedAt    time.Time                    `json:"updated_at"`
}

PendingState represents the state of pending certificates

Jump to

Keyboard shortcuts

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