http

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

package http solves the ACMEv2 HTTP-01 challenge. The workflow is as follows:

1. client requests a certificate from the remote CA, using the Solver as the HTTP-01 challenge 2. Solver populates the Challenge in the Store and notifies the CA that the challenge is ready 3. remote CA requests the keyauth from the well known path on the server 4. server retrieves the Challenge from the Store, validates the requests and presents the keyauth to the remote CA

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStoreRateLimited = errors.New("We were rate limited, try again later")
	ErrStoreNotFound    = errors.New("Challenge not found in the store")
)

Functions

func NewGinHandlerFunc

func NewGinHandlerFunc(store Store) func(*gin.Context)

NewGinHandlerFunc returns a gin.HandlerFunc that will parse the incoming challenge request from the remote CA, retrieve the challenge data from the Store, and return an appropriate response.

Types

type Challenge

type Challenge struct {
	Domain  string
	Token   string
	KeyAuth string
}

Challenge represents the information required for an ACMEv2 HTTP-01 challenge

func NewChallenge

func NewChallenge(domain, token, keyAuth string) *Challenge

NewChallenge returns a pointer to a Challenge

type DynamoDBStore

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

DynamoDBStore is an implementation of Store using AWS DynamoDB to persist Challenges

func NewDynamoDBStore

func NewDynamoDBStore(c dynamodbiface.DynamoDBAPI, table string) *DynamoDBStore

NewDynamoDBStore returns a pointer to a DynamoDBStore

func (*DynamoDBStore) DeleteChallenge

func (ds *DynamoDBStore) DeleteChallenge(token string) error

DeleteChallenge deletes the relevant row from DynamoDB

func (*DynamoDBStore) GetChallenge

func (ds *DynamoDBStore) GetChallenge(token string) (*Challenge, error)

GetChallenge retrieves the relevant row from DynamoDB and returns it as a pointer to a Challenge

func (*DynamoDBStore) PutChallenge

func (ds *DynamoDBStore) PutChallenge(ch *Challenge) error

PutChallenge serialises a Challenge and puts it in a row in DynamoDB

type Solver

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

Solver implements lego's challenge.Provider

func New

func New(store Store) *Solver

New returns a pointer to a Solver, initialised with a Store of your choice

func (*Solver) CleanUp

func (s *Solver) CleanUp(domain, token, keyAuth string) error

CleanUp removes the challenge information from the Store

func (*Solver) Present

func (s *Solver) Present(domain, token, keyAuth string) error

Present writes the challenge information into the Store so that the server can respond to HTTP queries with the correct value

type Store

type Store interface {
	DeleteChallenge(string) error
	GetChallenge(string) (*Challenge, error)
	PutChallenge(*Challenge) error
}

Store represents a backend storage system that is used to persist challenge information between the client and server

Jump to

Keyboard shortcuts

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