cert

package
v0.0.0-...-1773970 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = &Config{

	RenewBefore: 30 * 24,

	CheckInterval: 7 * 24 * time.Hour,
	DirectoryURL:  "https://acme-v02.api.letsencrypt.org/directory",
	CacheDirPerm:  0700,
}

Default contains a default configuration

Functions

func CreateConfig

func CreateConfig()

CheckConfig checks if config can be used to obtain a cert

func GenerateCert

func GenerateCert(domains []string, mail string) (err error)

GenerateCert do all the job to obtain a new certicate from letsencrypt

func MaybeRenew

func MaybeRenew(forceRenew bool) (renewdone bool, err error)

func WritePemFile

func WritePemFile(certfile string) (err error)

Types

type CR

type CR struct {
	Domain            string   `json:"domain"`
	Domains           []string `json:domains`
	CertURL           string   `json:"certUrl"`
	CertStableURL     string   `json:"certStableUrl"`
	PrivateKey        []byte   `json:"privateKey"`
	Certificate       []byte   `json:"certificate"`
	IssuerCertificate []byte   `json:"issuerCertificate"`
	CSR               []byte   `json:"csr"`
}

CR represents an Lego Certificate Resource

type Config

type Config struct {

	// renew the certificate X hours before it expires
	// LetsEncrypt Certs are valid for 90 Days
	RenewBefore int

	// Interval for checking if cert is closer to expiration than RenewBefore
	CheckInterval time.Duration

	// ACME Directory URL
	DirectoryURL string

	// UNIX Permission for the CacheDir and all files inside
	CacheDirPerm os.FileMode

	// Path of the CacheDir
	CacheDir string
}

Config allows configuration of simplecert

type SSLUser

type SSLUser struct {
	Email        string
	Registration *registration.Resource
	Key          *rsa.PrivateKey
}

SSLUser implements the ACME User interface

func (SSLUser) GetEmail

func (u SSLUser) GetEmail() string

func (SSLUser) GetPrivateKey

func (u SSLUser) GetPrivateKey() crypto.PrivateKey

func (SSLUser) GetRegistration

func (u SSLUser) GetRegistration() *registration.Resource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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