cert

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PackageVersion = "seehuhn.de/go/acme"

PackageVersion gives the acme package name and version (updated in an init function).

Functions

This section is empty.

Types

type Config

type Config struct {
	AccountDir   string
	ContactEmail string `yaml:",omitempty"`

	DefaultSiteKeyFile  string `yaml:",omitempty"`
	DefaultSiteCertFile string `yaml:",omitempty"`
	DefaultWebRoot      string `yaml:",omitempty"`
	Sites               []*ConfigSite
	// contains filtered or unexported fields
}

Config describes the certificate data for a web server, serving one or more domains.

func (*Config) CertDomains added in v0.5.0

func (c *Config) CertDomains() ([][]string, error)

CertDomains returns a list of certificates the Config describes. Each elements of the returned slice is a list of domain names to be used for a single certificate. The first domain name is the one which holds information about the key and certificate file names.

func (*Config) Domains added in v0.5.0

func (c *Config) Domains() []string

Domains returns all domain names in the configuration data.

func (*Config) GetCertFileName

func (c *Config) GetCertFileName(domain string) (string, error)

GetCertFileName returns the file name for the certificate `domain`.

func (*Config) GetKeyFileName

func (c *Config) GetKeyFileName(domain string) (string, error)

GetKeyFileName returns the file name for the private key of `domain`.

func (*Config) GetTLSPort added in v0.5.3

func (c *Config) GetTLSPort(domain string) (int, error)

GetTLSPort returns the TCP port where TLS connections using the site certificate can be made.

func (*Config) GetWebRoot

func (c *Config) GetWebRoot(domain string) (string, error)

GetWebRoot returns the path of directory which corresponds to the root of the file tree served for `domain`. Only paths starting with `/.well-known/acme-challenge/` are required to work.

func (*Config) PublishFile added in v0.5.0

func (c *Config) PublishFile(domain, path string, contents []byte) (string, error)

PublishFile puts a file with the given contents on the web server. Returns the created file name (to be used when later removing the file) and an error, if any.

func (*Config) TestChallenge added in v0.5.0

func (c *Config) TestChallenge(domain string) error

TestChallenge tries to publish and read back a challenge response file for the given domain.

type ConfigSite

type ConfigSite struct {
	Domain   string
	TLSPort  int    `yaml:",omitempty"` // default is 443
	UseKeyOf string `yaml:",omitempty"`
	KeyFile  string `yaml:",omitempty"`
	CertFile string `yaml:",omitempty"`
	WebRoot  string `yaml:",omitempty"`
	// contains filtered or unexported fields
}

ConfigSite describes the certificate data for a single domain.

type DomainError added in v0.3.0

type DomainError struct {
	Domain, Problem string
	Err             error
}

A DomainError indicates an error relating to a domain.

func (*DomainError) Error added in v0.3.0

func (err *DomainError) Error() string

func (*DomainError) Unwrap added in v0.5.0

func (err *DomainError) Unwrap() error

type FileError

type FileError struct {
	FileName, Problem string
}

FileError is used to report error conditions relating to files or directories.

func (*FileError) Error

func (err *FileError) Error() string

type Info

type Info struct {
	Cert      *x509.Certificate
	Chains    [][]*x509.Certificate
	IsValid   bool
	IsMissing bool
	Expiry    time.Time
	Message   string
}

Info contains information about a single certificate installed on the system.

type Manager

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

Manager holds all state required to generate and/or renew certificates via an ACME server.

func NewManager

func NewManager(config *Config, directory string, roots *x509.CertPool) (*Manager, error)

NewManager creates a new certificate manager.

func (*Manager) CheckCert added in v0.5.1

func (m *Manager) CheckCert(now time.Time, chain []*x509.Certificate, domain string) (*Info, error)

CheckCert checks that the given certificate is valid for the given domain. This does not take revocations into account.

func (*Manager) GetCertInfo

func (m *Manager) GetCertInfo(domain string, now time.Time) (*Info, error)

GetCertInfo returns information about a certificate managed by m.

func (*Manager) InstallSelfSigned added in v0.3.0

func (m *Manager) InstallSelfSigned(domain string, notBefore, notAfter time.Time) error

InstallSelfSigned installs a self-signed dummy certificate for a domain.

func (*Manager) RenewCertificate

func (m *Manager) RenewCertificate(domains []string) error

RenewCertificate requests and installs a new certificate for the given set of domains.

Jump to

Keyboard shortcuts

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