Documentation ¶
Index ¶
- func NewDbMap(dbConnect string, maxOpenConns int) (*gorp.DbMap, error)
- func NewDbMapFromConfig(config *mysql.Config, maxOpenConns int) (*gorp.DbMap, error)
- func ReportDbConnCount(dbMap *gorp.DbMap, statter metrics.Scope)
- func Rollback(tx *gorp.Transaction, err error) error
- func SelectCertificate(s dbOneSelector, q string, args ...interface{}) (core.Certificate, error)
- func SelectCertificateStatus(s dbOneSelector, q string, args ...interface{}) (certStatusModel, error)
- func SelectCertificateStatuses(s dbSelector, q string, args ...interface{}) ([]core.CertificateStatus, error)
- func SelectCertificates(s dbSelector, q string, args map[string]interface{}) ([]core.Certificate, error)
- func SetSQLDebug(dbMap *gorp.DbMap, log blog.Logger)
- type BoulderTypeConverter
- type ErrNoReceipt
- type RollbackError
- type SQLLogger
- type SQLStorageAuthority
- func (ssa *SQLStorageAuthority) AddCertificate(ctx context.Context, certDER []byte, regID int64) (string, error)
- func (ssa *SQLStorageAuthority) AddSCTReceipt(ctx context.Context, sct core.SignedCertificateTimestamp) error
- func (ssa *SQLStorageAuthority) CountCertificatesByNames(ctx context.Context, domains []string, earliest, latest time.Time) (map[string]int, error)
- func (ssa *SQLStorageAuthority) CountCertificatesRange(ctx context.Context, start, end time.Time) (int64, error)
- func (ssa *SQLStorageAuthority) CountFQDNSets(ctx context.Context, window time.Duration, names []string) (int64, error)
- func (ssa *SQLStorageAuthority) CountInvalidAuthorizations(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (count *sapb.Count, err error)
- func (ssa *SQLStorageAuthority) CountPendingAuthorizations(ctx context.Context, regID int64) (count int, err error)
- func (ssa *SQLStorageAuthority) CountRegistrationsByIP(ctx context.Context, ip net.IP, earliest time.Time, latest time.Time) (int, error)
- func (ssa *SQLStorageAuthority) DeactivateAuthorization(ctx context.Context, id string) error
- func (ssa *SQLStorageAuthority) DeactivateRegistration(ctx context.Context, id int64) error
- func (ssa *SQLStorageAuthority) FQDNSetExists(ctx context.Context, names []string) (bool, error)
- func (ssa *SQLStorageAuthority) FinalizeAuthorization(ctx context.Context, authz core.Authorization) error
- func (ssa *SQLStorageAuthority) GetAuthorization(ctx context.Context, id string) (authz core.Authorization, err error)
- func (ssa *SQLStorageAuthority) GetCertificate(ctx context.Context, serial string) (core.Certificate, error)
- func (ssa *SQLStorageAuthority) GetCertificateStatus(ctx context.Context, serial string) (core.CertificateStatus, error)
- func (ssa *SQLStorageAuthority) GetRegistration(ctx context.Context, id int64) (core.Registration, error)
- func (ssa *SQLStorageAuthority) GetRegistrationByKey(ctx context.Context, key *jose.JsonWebKey) (core.Registration, error)
- func (ssa *SQLStorageAuthority) GetSCTReceipt(ctx context.Context, serial string, logID string) (core.SignedCertificateTimestamp, error)
- func (ssa *SQLStorageAuthority) GetValidAuthorizations(ctx context.Context, registrationID int64, names []string, now time.Time) (map[string]*core.Authorization, error)
- func (ssa *SQLStorageAuthority) MarkCertificateRevoked(ctx context.Context, serial string, reasonCode revocation.Reason) error
- func (ssa *SQLStorageAuthority) NewPendingAuthorization(ctx context.Context, authz core.Authorization) (core.Authorization, error)
- func (ssa *SQLStorageAuthority) NewRegistration(ctx context.Context, reg core.Registration) (core.Registration, error)
- func (ssa *SQLStorageAuthority) RevokeAuthorizationsByDomain(ctx context.Context, ident core.AcmeIdentifier) (int64, int64, error)
- func (ssa *SQLStorageAuthority) UpdatePendingAuthorization(ctx context.Context, authz core.Authorization) error
- func (ssa *SQLStorageAuthority) UpdateRegistration(ctx context.Context, reg core.Registration) error
- type TooManyCertificatesError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDbMap ¶
NewDbMap creates the root gorp mapping object. Create one of these for each database schema you wish to map. Each DbMap contains a list of mapped tables. It automatically maps the tables for the primary parts of Boulder around the Storage Authority.
func NewDbMapFromConfig ¶
NewDbMapFromConfig functions similarly to NewDbMap, but it takes the decomposed form of the connection string, a *mysql.Config.
func ReportDbConnCount ¶
func Rollback ¶
Rollback rolls back the provided transaction (if err is non-nil) and wraps the error, if any, of the rollback into a RollbackError.
The err parameter must be non-nil.
err = sa.Rollback(tx, err)
func SelectCertificate ¶
func SelectCertificate(s dbOneSelector, q string, args ...interface{}) (core.Certificate, error)
SelectCertificate selects all fields of one certificate object
func SelectCertificateStatus ¶
func SelectCertificateStatus(s dbOneSelector, q string, args ...interface{}) (certStatusModel, error)
SelectCertificateStatus selects all fields of one certificate status model
func SelectCertificateStatuses ¶
func SelectCertificateStatuses(s dbSelector, q string, args ...interface{}) ([]core.CertificateStatus, error)
SelectCertificateStatuses selects all fields of multiple certificate status objects
func SelectCertificates ¶
func SelectCertificates(s dbSelector, q string, args map[string]interface{}) ([]core.Certificate, error)
SelectCertificates selects all fields of multiple certificate objects
func SetSQLDebug ¶
SetSQLDebug enables GORP SQL-level Debugging
Types ¶
type BoulderTypeConverter ¶
type BoulderTypeConverter struct{}
BoulderTypeConverter is used by Gorp for storing objects in DB.
func (BoulderTypeConverter) FromDb ¶
func (tc BoulderTypeConverter) FromDb(target interface{}) (gorp.CustomScanner, bool)
FromDb converts a DB representation back into a Boulder object.
func (BoulderTypeConverter) ToDb ¶
func (tc BoulderTypeConverter) ToDb(val interface{}) (interface{}, error)
ToDb converts a Boulder object to one suitable for the DB representation.
type ErrNoReceipt ¶
type ErrNoReceipt string
ErrNoReceipt is an error type for non-existent SCT receipt
func (ErrNoReceipt) Error ¶
func (e ErrNoReceipt) Error() string
type RollbackError ¶
RollbackError is a combination of a database error and the error, if any, encountered while trying to rollback the transaction.
func (*RollbackError) Error ¶
func (re *RollbackError) Error() string
Error implements the error interface
type SQLStorageAuthority ¶
type SQLStorageAuthority struct {
// contains filtered or unexported fields
}
SQLStorageAuthority defines a Storage Authority
func NewSQLStorageAuthority ¶
func NewSQLStorageAuthority(dbMap *gorp.DbMap, clk clock.Clock, logger blog.Logger) (*SQLStorageAuthority, error)
NewSQLStorageAuthority provides persistence using a SQL backend for Boulder. It will modify the given gorp.DbMap by adding relevant tables.
func (*SQLStorageAuthority) AddCertificate ¶
func (ssa *SQLStorageAuthority) AddCertificate(ctx context.Context, certDER []byte, regID int64) (string, error)
AddCertificate stores an issued certificate and returns the digest as a string, or an error if any occurred.
func (*SQLStorageAuthority) AddSCTReceipt ¶
func (ssa *SQLStorageAuthority) AddSCTReceipt(ctx context.Context, sct core.SignedCertificateTimestamp) error
AddSCTReceipt adds a new SCT receipt to the (append-only) sctReceipts table
func (*SQLStorageAuthority) CountCertificatesByNames ¶
func (ssa *SQLStorageAuthority) CountCertificatesByNames(ctx context.Context, domains []string, earliest, latest time.Time) (map[string]int, error)
CountCertificatesByNames counts, for each input domain, the number of certificates issued in the given time range for that domain and its subdomains. It returns a map from domains to counts, which is guaranteed to contain an entry for each input domain, so long as err is nil. The highest count this function can return is 10,000. If there are more certificates than that matching one of the provided domain names, it will return TooManyCertificatesError.
func (*SQLStorageAuthority) CountCertificatesRange ¶
func (ssa *SQLStorageAuthority) CountCertificatesRange(ctx context.Context, start, end time.Time) (int64, error)
CountCertificatesRange returns the number of certificates issued in a specific date range
func (*SQLStorageAuthority) CountFQDNSets ¶
func (ssa *SQLStorageAuthority) CountFQDNSets(ctx context.Context, window time.Duration, names []string) (int64, error)
CountFQDNSets returns the number of sets with hash |setHash| within the window |window|
func (*SQLStorageAuthority) CountInvalidAuthorizations ¶
func (ssa *SQLStorageAuthority) CountInvalidAuthorizations( ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest, ) (count *sapb.Count, err error)
CountInvalidAuthorizations counts invalid authorizations for a user expiring in a given time range. authorizations for the give registration.
func (*SQLStorageAuthority) CountPendingAuthorizations ¶
func (ssa *SQLStorageAuthority) CountPendingAuthorizations(ctx context.Context, regID int64) (count int, err error)
CountPendingAuthorizations returns the number of pending, unexpired authorizations for the give registration.
func (*SQLStorageAuthority) CountRegistrationsByIP ¶
func (ssa *SQLStorageAuthority) CountRegistrationsByIP(ctx context.Context, ip net.IP, earliest time.Time, latest time.Time) (int, error)
CountRegistrationsByIP returns the number of registrations created in the time range in an IP range. For IPv4 addresses, that range is limited to the single IP. For IPv6 addresses, that range is a /48, since it's not uncommon for one person to have a /48 to themselves.
func (*SQLStorageAuthority) DeactivateAuthorization ¶
func (ssa *SQLStorageAuthority) DeactivateAuthorization(ctx context.Context, id string) error
DeactivateAuthorization deactivates a currently valid or pending authorization
func (*SQLStorageAuthority) DeactivateRegistration ¶
func (ssa *SQLStorageAuthority) DeactivateRegistration(ctx context.Context, id int64) error
DeactivateRegistration deactivates a currently valid registration
func (*SQLStorageAuthority) FQDNSetExists ¶
FQDNSetExists returns a bool indicating if one or more FQDN sets |names| exists in the database
func (*SQLStorageAuthority) FinalizeAuthorization ¶
func (ssa *SQLStorageAuthority) FinalizeAuthorization(ctx context.Context, authz core.Authorization) error
FinalizeAuthorization converts a Pending Authorization to a final one
func (*SQLStorageAuthority) GetAuthorization ¶
func (ssa *SQLStorageAuthority) GetAuthorization(ctx context.Context, id string) (authz core.Authorization, err error)
GetAuthorization obtains an Authorization by ID
func (*SQLStorageAuthority) GetCertificate ¶
func (ssa *SQLStorageAuthority) GetCertificate(ctx context.Context, serial string) (core.Certificate, error)
GetCertificate takes a serial number and returns the corresponding certificate, or error if it does not exist.
func (*SQLStorageAuthority) GetCertificateStatus ¶
func (ssa *SQLStorageAuthority) GetCertificateStatus(ctx context.Context, serial string) (core.CertificateStatus, error)
GetCertificateStatus takes a hexadecimal string representing the full 128-bit serial number of a certificate and returns data about that certificate's current validity.
func (*SQLStorageAuthority) GetRegistration ¶
func (ssa *SQLStorageAuthority) GetRegistration(ctx context.Context, id int64) (core.Registration, error)
GetRegistration obtains a Registration by ID
func (*SQLStorageAuthority) GetRegistrationByKey ¶
func (ssa *SQLStorageAuthority) GetRegistrationByKey(ctx context.Context, key *jose.JsonWebKey) (core.Registration, error)
GetRegistrationByKey obtains a Registration by JWK
func (*SQLStorageAuthority) GetSCTReceipt ¶
func (ssa *SQLStorageAuthority) GetSCTReceipt(ctx context.Context, serial string, logID string) (core.SignedCertificateTimestamp, error)
GetSCTReceipt gets a specific SCT receipt for a given certificate serial and CT log ID
func (*SQLStorageAuthority) GetValidAuthorizations ¶
func (ssa *SQLStorageAuthority) GetValidAuthorizations(ctx context.Context, registrationID int64, names []string, now time.Time) (map[string]*core.Authorization, error)
GetValidAuthorizations returns the latest authorization object for all domain names from the parameters that the account has authorizations for.
func (*SQLStorageAuthority) MarkCertificateRevoked ¶
func (ssa *SQLStorageAuthority) MarkCertificateRevoked(ctx context.Context, serial string, reasonCode revocation.Reason) error
MarkCertificateRevoked stores the fact that a certificate is revoked, along with a timestamp and a reason.
func (*SQLStorageAuthority) NewPendingAuthorization ¶
func (ssa *SQLStorageAuthority) NewPendingAuthorization(ctx context.Context, authz core.Authorization) (core.Authorization, error)
NewPendingAuthorization stores a new Pending Authorization
func (*SQLStorageAuthority) NewRegistration ¶
func (ssa *SQLStorageAuthority) NewRegistration(ctx context.Context, reg core.Registration) (core.Registration, error)
NewRegistration stores a new Registration
func (*SQLStorageAuthority) RevokeAuthorizationsByDomain ¶
func (ssa *SQLStorageAuthority) RevokeAuthorizationsByDomain(ctx context.Context, ident core.AcmeIdentifier) (int64, int64, error)
RevokeAuthorizationsByDomain invalidates all pending or finalized authorizations for a specific domain
func (*SQLStorageAuthority) UpdatePendingAuthorization ¶
func (ssa *SQLStorageAuthority) UpdatePendingAuthorization(ctx context.Context, authz core.Authorization) error
UpdatePendingAuthorization updates a Pending Authorization
func (*SQLStorageAuthority) UpdateRegistration ¶
func (ssa *SQLStorageAuthority) UpdateRegistration(ctx context.Context, reg core.Registration) error
UpdateRegistration stores an updated Registration
type TooManyCertificatesError ¶
type TooManyCertificatesError string
TooManyCertificatesError indicates that the number of certificates returned by CountCertificates exceeded the hard-coded limit of 10,000 certificates.
func (TooManyCertificatesError) Error ¶
func (t TooManyCertificatesError) Error() string