agent

package
v0.0.0-...-b8c49a7 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2020 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDirectoryURL = "https://acme-staging-v02.api.letsencrypt.org/directory"
View Source
var (
	// ErrFileNotFound is the error returned by Filer interface when file is not found.
	ErrFileNotFound = errors.New("aaa: file not found")
)
View Source
var StorePrefix = "aaa-data/v2"

Functions

func CreateCertificateRequest

func CreateCertificateRequest(certPrivkey *rsa.PrivateKey, commonName string, domain ...string) (string, error)

CreateCertificateRequest creates CSR in DER encoded in base64.

func Debug

func Debug(v ...interface{})

func DirectoryURL

func DirectoryURL() string

func NewLegoClient

func NewLegoClient(ri *RegistrationInfo) (*lego.Client, error)

NewClient2 initializes the lego ACME client and returns the client. If it fails to initialize the client, it will return an error.

Types

type Filer

type Filer interface {
	WriteFile(string, []byte) error
	ReadFile(string) ([]byte, error)
	Join(elem ...string) string
	Split(elem string) []string
	ListDir(string) ([]string, error)
}

Filer interface represents a file storage layer for AAA.

type OSFiler

type OSFiler struct {
	// BaseDir is prepended into given filename.
	BaseDir string
}

OSFiler implements Filer interface backed by *os.File.

func (*OSFiler) Join

func (s *OSFiler) Join(elem ...string) string

func (*OSFiler) ListDir

func (f *OSFiler) ListDir(prefix string) ([]string, error)

ListDir returns directories that has the given prefix. See https://golang.org/pkg/os/#File.Readdirnames (n <= 0)

func (*OSFiler) ReadFile

func (f *OSFiler) ReadFile(filename string) ([]byte, error)

func (*OSFiler) Split

func (s *OSFiler) Split(path string) []string

func (*OSFiler) WriteFile

func (f *OSFiler) WriteFile(filename string, data []byte) error

WriteFile writes data to filename. WriteFile also creates any directories by using os.MkdirAll.

type RegistrationInfo

type RegistrationInfo struct {
	Email        string                 `json:"email"`
	Registration *registration.Resource `json:"registration"`
	Key          *jose.JSONWebKey       `json:"key"`
}

RegistrationInfo is a data persisted on the storage. A private key for this will be persisted in JWK.

func (*RegistrationInfo) GetEmail

func (ri *RegistrationInfo) GetEmail() string

func (*RegistrationInfo) GetPrivateKey

func (ri *RegistrationInfo) GetPrivateKey() crypto.PrivateKey

func (*RegistrationInfo) GetRegistration

func (ri *RegistrationInfo) GetRegistration() *registration.Resource

type S3Filer

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

func NewS3Filer

func NewS3Filer(bucket *bucket.Bucket, keyId string) *S3Filer

func (*S3Filer) Join

func (s *S3Filer) Join(elem ...string) string

func (*S3Filer) ListDir

func (s *S3Filer) ListDir(prefix string) ([]string, error)

func (*S3Filer) ReadFile

func (s *S3Filer) ReadFile(key string) ([]byte, error)

func (*S3Filer) Split

func (s *S3Filer) Split(prefix string) []string

func (*S3Filer) WriteFile

func (f *S3Filer) WriteFile(key string, data []byte) error

type Store

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

func NewStore

func NewStore(email string, filer Filer) (*Store, error)

func (*Store) ListDomains

func (s *Store) ListDomains() ([]string, error)

func (*Store) LoadCert

func (s *Store) LoadCert(domain string) (*x509.Certificate, error)

func (*Store) LoadCertKey

func (s *Store) LoadCertKey(domain string) (crypto.PrivateKey, error)

func (*Store) LoadRegistration

func (s *Store) LoadRegistration() (*RegistrationInfo, error)

LoadRegistration returns the existing registration.

func (*Store) SaveCert

func (s *Store) SaveCert(domain string, cert []byte) error

func (*Store) SaveCertKey

func (s *Store) SaveCertKey(domain string, privKey crypto.PrivateKey) error

func (*Store) SaveRegistration

func (s *Store) SaveRegistration(ri *RegistrationInfo) error

Jump to

Keyboard shortcuts

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