legoetcd

package
v0.0.0-...-71972d2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2016 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnknowKeyType is returns when the private key stored in etcd is of an
	// unknown type.
	ErrUnknowKeyType = errors.New("unknown private key type")
	// ErrAccountNotExist is returned if the load did not find an account.
	ErrAccountNotExist = errors.New("account does not exist")
	// ErrKeyAlreadyExists is returned when GenerateKey() is called and the key
	// already exists
	ErrKeyAlreadyExists = errors.New("key already exists")
	// ErrAlreadyRegistered is returned when Register() is called and the account
	// is already registered.
	ErrAlreadyRegistered = errors.New("account already registered")
)
View Source
var (
	// ErrAddressInvalid is returned by New() when the address is not a valid
	// host:port.
	ErrAddressInvalid = errors.New("the address should be host:port")
)
View Source
var (
	// ErrMustAcceptTOS is returned of the TOS was not accepted and `acceptTOS`
	// is false.
	ErrMustAcceptTOS = errors.New("you must accept Let's encrypt terms of service")
)
View Source
var ErrNoPemForCSR = errors.New("unable to save pem without private key; are you using a CSR?")

ErrNoPemForCSR is returned when there is no private key.

Functions

This section is empty.

Types

type Account

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

Account implements acme.Account

func NewAccount

func NewAccount(email string) *Account

NewAccount returns a new user with the email provided

func (*Account) GenerateKey

func (a *Account) GenerateKey() error

GenerateKey generates a new key.

func (*Account) GetEmail

func (a *Account) GetEmail() string

GetEmail returns the email associated with this user.

func (*Account) GetPrivateKey

func (a *Account) GetPrivateKey() crypto.PrivateKey

GetPrivateKey returns the private RSA account key.

func (*Account) GetRegistration

func (a *Account) GetRegistration() *acme.RegistrationResource

GetRegistration returns the server registration

func (*Account) Load

func (a *Account) Load(c client.Client) error

Load loads the key from etcd.

func (*Account) LoadKey

func (a *Account) LoadKey(c client.Client) error

LoadKey loads the key from etcd.

func (*Account) LoadRegistration

func (a *Account) LoadRegistration(c client.Client) error

LoadRegistration loads the registration from etcd.

func (*Account) Register

func (a *Account) Register(c *acme.Client) error

Register registers the account with ACME.

func (*Account) Save

func (a *Account) Save(c client.Client) error

Save saves the key into etcd. The caller is responsible to ensure no race conditions by grabbing a lock before calling Save().

type Cert

type Cert struct {
	Domains []string
	CSR     *x509.CertificateRequest
	Cert    acme.CertificateResource
}

Cert represents a domain certificate

func LoadCert

func LoadCert(ec client.Client, domains []string) (*Cert, error)

LoadCert loads the certificate from ETCD

func (*Cert) CertPath

func (c *Cert) CertPath() string

CertPath returns the path where the CRT of this certificate is store on etcd.

func (*Cert) Expiration

func (c *Cert) Expiration() (time.Time, error)

Expiration returns the certificate's expiration date and time.

func (*Cert) ExpiresIn

func (c *Cert) ExpiresIn() (time.Duration, error)

ExpiresIn returns the duration until the certificate expires.

func (*Cert) KeyPath

func (c *Cert) KeyPath() string

KeyPath returns the path where the PrivateKey of this certificate is store on etcd.

func (*Cert) MetaPath

func (c *Cert) MetaPath() string

MetaPath returns the path where the metadata of this certificate is store on etcd.

func (*Cert) PEM

func (c *Cert) PEM() []byte

PEM returns this certificate PEM-encoded.

func (*Cert) PemPath

func (c *Cert) PemPath() string

PemPath returns the path where the PEM of this certificate is store on etcd.

func (*Cert) Reload

func (c *Cert) Reload(ec client.Client) error

Reload re-reads the certificate from etcd.

func (*Cert) Renew

func (c *Cert) Renew(ac *Client, bundle bool) error

Renew renews the certificate through the ACME client.

func (*Cert) Save

func (c *Cert) Save(ec client.Client, pem bool) error

Save saves the certificate to etcd.

type Client

type Client struct {
	*acme.Client
	Account *Account
}

Client represents the legoetcd Client

func New

func New(ec client.Client, acmeServer, email string, keyType acme.KeyType, dns, webRoot, httpAddr, tlsAddr string) (*Client, error)

New returns a new ACME client configured with the challenge.

func (*Client) NewCert

func (c *Client) NewCert(domains []string, csrFile string, bundle bool) (*Cert, map[string]error)

NewCert obtains a new certificate for the domains or the csr.

func (*Client) RegisterAccount

func (c *Client) RegisterAccount(ec client.Client, acceptTOS bool) error

RegisterAccount registers the account

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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