certs

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLegoYAML    = "/var/lib/lego/.lego.yaml"
	DefaultEnvFile     = "/var/lib/lego/.env"
	DefaultLegoBin     = "lego"
	DefaultLegoStorage = "/var/lib/lego/storage"
	DefaultKeyType     = "EC256"
)

Lab/production layout used when Destinations → Certificates paths are blank. Matches the dns container bind-mount (dev/data/lego → /var/lib/lego).

Variables

This section is empty.

Functions

func ApplyConfigDefaults

func ApplyConfigDefaults(cfg *Config)

func ApplySettingsDefaults

func ApplySettingsDefaults(s *models.Settings)

func BuildEnv

func BuildEnv(challenges []Challenge) string

func BuildLegoYAML

func BuildLegoYAML(cfg *Config, envFile string) ([]byte, error)

func Enabled

func Enabled(db *gorm.DB) bool

func WriteFiles

func WriteFiles(cfg *Config) (yamlPath, envPath string, err error)

Types

type Account

type Account struct {
	Name                  string `json:"name"`
	Email                 string `json:"email"`
	Server                string `json:"server"`
	KeyType               string `json:"key_type"`
	AcceptsTermsOfService bool   `json:"accepts_terms_of_service"`
	EABKID                string `json:"eab_kid"`
	EABHMACKey            string `json:"eab_hmac_key"`
}

type Cert

type Cert struct {
	Name             string   `json:"name"`
	Account          string   `json:"account"`
	Challenge        string   `json:"challenge"`
	KeyType          string   `json:"key_type"`
	EnableCommonName *bool    `json:"enable_common_name"`
	Host             string   `json:"host"`
	Domains          []string `json:"domains"`
}

type Challenge

type Challenge struct {
	Name                string   `json:"name"`
	Kind                string   `json:"kind"`
	Provider            string   `json:"provider"`
	DNSTimeout          int      `json:"dns_timeout"`
	Resolvers           []string `json:"resolvers"`
	DisableAuthNS       bool     `json:"disable_authoritative_nameservers"`
	DisableRecursiveNS  bool     `json:"disable_recursive_nameservers"`
	PropagationWait     string   `json:"propagation_wait"`
	RFC2136Nameserver   string   `json:"rfc2136_nameserver"`
	RFC2136TSIGAlgo     string   `json:"rfc2136_tsig_algorithm"`
	RFC2136TSIGKey      string   `json:"rfc2136_tsig_key"`
	RFC2136TSIGSecret   string   `json:"rfc2136_tsig_secret"`
	RFC2136TSIGFile     string   `json:"rfc2136_tsig_file"`
	RFC2136TTL          int      `json:"rfc2136_ttl"`
	RFC2136PropTimeout  string   `json:"rfc2136_propagation_timeout"`
	RFC2136PollInterval string   `json:"rfc2136_polling_interval"`
	ExtraEnv            string   `json:"extra_env"`
}

type Client

type Client struct {
	Config *util.ConfigAgentRoot
	Certs  *Config
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *util.ConfigAgentRoot) (*Client, error)

func (*Client) Sync

func (c *Client) Sync(reporter jobevent.Reporter) error

type Config

type Config struct {
	util.CommonConfig
	LegoYaml                string      `json:"lego_yaml"`
	EnvFile                 string      `json:"env_file"`
	LegoBin                 string      `json:"lego_bin"`
	LegoStorage             string      `json:"lego_storage"`
	DefaultKeyType          string      `json:"default_key_type"`
	DefaultEnableCommonName bool        `json:"default_enable_common_name"`
	Accounts                []Account   `json:"accounts"`
	Challenges              []Challenge `json:"challenges"`
	Certificates            []Cert      `json:"certificates"`
}

Config is what factum2-certs fetches from the primary and writes as .lego.yaml plus dotenv, then runs lego.

func FetchRemoteConfig

func FetchRemoteConfig(factumConfig *util.ConfigFactum) (*Config, error)

type Imported added in v1.5.0

type Imported struct {
	Accounts     []Account
	Challenges   []Challenge
	Certificates []Cert
	Skipped      []string
	EnvApplied   bool
}

Imported is a .lego.yaml (and optional dotenv) turned into factum rows. EnvApplied is true when dotenv text was supplied, including an empty file the caller still wants treated as the credential source.

func ParseLegoFile added in v1.5.0

func ParseLegoFile(yamlText, envText string) (Imported, error)

ParseLegoFile reads a lego configuration file. Only RFC2136 DNS-01 challenges are imported. envText, when non-empty after trimming, supplies RFC2136_* credentials for every imported challenge. Other env lines are kept as extra env. Rows that already exist are the caller's concern; this function only parses.

Jump to

Keyboard shortcuts

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