leclient

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StagingLetsEncryptCertIssuingAuthority = "Fake LE Intermediate X1"
	LetsEncryptCertIssuingAuthority        = "Let's Encrypt Authority X3"
)

Variables

This section is empty.

Functions

func GetLetsEncryptDirctoryURL

func GetLetsEncryptDirctoryURL(kubeClient client.Client) (durl string, err error)

func GetSecret

func GetSecret(kubeClient client.Client, secretName, namespace string) (*corev1.Secret, error)

Types

type ACMEClient

type ACMEClient struct {
	Client        acme.Client
	Account       acme.Account
	Order         acme.Order
	Authorization acme.Authorization
	Challenge     acme.Challenge
}

func GetLetsEncryptClient

func GetLetsEncryptClient(directoryUrl string) (Client ACMEClient, err error)

GetLetsEncryptClient accepts a string as directoryUrl and calls the acme NewClient func. A Client is returned, along with any error that occurs.

func (*ACMEClient) CreateOrder

func (c *ACMEClient) CreateOrder(domains []string) (err error)

CreateOrder accepts and appends domain names to the acme.Identifier. It then calls acme.Client.NewOrder and returns nil if successfull and an error if an error occurs.

func (*ACMEClient) FetchAuthorization

func (c *ACMEClient) FetchAuthorization(authURL string) (err error)

FetchAuthorization accepts an authURL and then calls acme.FetchAuthorization with both the authURL and c.Account from the ACME struct. If an error occurs it is returned.

func (*ACMEClient) FetchCertificates

func (c *ACMEClient) FetchCertificates() (certbundle []*x509.Certificate, err error)

FetchCertificates calls the acme FetchCertificates Client method with the Account from the local ACME struct and Certificate from the acme Order struct. A slice of x509.Certificate's is returned along with an error if one occurrs.

func (*ACMEClient) FinalizeOrder

func (c *ACMEClient) FinalizeOrder(csr *x509.CertificateRequest) (err error)

FinalizeOrder accepts an x509.CertificateRequest as csr and calls acme FinalizeOrder by passing the csr along with the local ACME structs Account and Order. If an error occurs, it is returned.

func (*ACMEClient) GetAccount

func (c *ACMEClient) GetAccount(kubeClient client.Client, namespace string) (err error)

GetAccount accepts a kubeClient and namespace and then derives a letsEncrypt endpoint (prod or staging) from URL after retrieving it with the kubeClient. It then retrieves the associated accounts privateKey. If an error occurs it is returned otherwise nil.

func (*ACMEClient) GetAuthorizationIndentifier

func (c *ACMEClient) GetAuthorizationIndentifier() (AuthID string, err error)

GetAuthorizationIndentifier returns the Authorization.Identifier.Value field from an ACME nested struct. An error is also returned if this field (.Value)is empty.

func (*ACMEClient) GetAuthorizationURL

func (c *ACMEClient) GetAuthorizationURL() string

GetAuthorizationURL returns the URL from from the ACME Authorization struct.

func (*ACMEClient) GetChallengeURL

func (c *ACMEClient) GetChallengeURL() string

GetChallengeURL returns the URL from the acme Challenge struct.

func (*ACMEClient) GetDNS01KeyAuthorization

func (c *ACMEClient) GetDNS01KeyAuthorization() (keyAuth string, err error)

GetDNS01KeyAuthorization passes the KeyAuthorization string from the acme Challenge struct to the acme EncodeDNS01KeyAuthorization func. It returns this var as keyAuth. If this field is not set, an error is returned.

func (*ACMEClient) GetOrderEndpoint

func (c *ACMEClient) GetOrderEndpoint() string

GetOrderEndpoint returns the Certificate string from the acme Order struct.

func (*ACMEClient) GetOrderURL

func (c *ACMEClient) GetOrderURL() (URL string, err error)

GetOrderURL returns the URL field from the ACME Order struct.

func (*ACMEClient) OrderAuthorization

func (c *ACMEClient) OrderAuthorization() []string

OrderAuthorization returns the Authorizations field from the ACME Order struct.

func (*ACMEClient) RevokeCertificate

func (c *ACMEClient) RevokeCertificate(certificate *x509.Certificate) (err error)

RevokeCertificate accepts x509.Certificate as certificate and calls the acme RevokeCertificate Client method along with local ACME structs Account and PrivateKey from the acme Account struct. If an error occurs, it is returned.

func (*ACMEClient) SetChallengeType

func (c *ACMEClient) SetChallengeType() (err error)

SetChallengeType sets the local ACME structs challenge via the acme pkgs ChallengeMap. If an error occurs, it is returned.

func (*ACMEClient) UpdateAccount

func (c *ACMEClient) UpdateAccount(email string) (err error)

UpdateAccount updates the ACME clients account by accepting email address/'s as a string. If an error occurs, it is returned.

func (*ACMEClient) UpdateChallenge

func (c *ACMEClient) UpdateChallenge() (err error)

UpdateChallenge calls the acme UpdateChallenge func with the local ACME structs Account and Challenge. If an error occurs, it is returned.

type Client

type Client interface {
	GetAccount(client.Client, bool, string) (acme.Account, error)
	UpdateAccount([]string)
	CreateOrder([]string)
	GetOrderURL()
	OrderAuthorization()
	FetchAuthorization(string)
	GetAuthorizationURL()
	GetAuthorizationIndentifier()
	SetChallengeType()
	GetChallengeURL()
	GetDNS01KeyAuthorization()
	UpdateChallenge()
	FinalizeOrder()
	GetOrderEndpoint()
	FetchCertificates()
	RevokeCertificate()
}

Required collection of methods to meet the type Client interface.

Jump to

Keyboard shortcuts

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