bigdata

package
v0.0.0-...-72c2bb7 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoCTRecords     = errors.New("no ct records found")
	ErrETLDInvalid     = errors.New("etld was empty or did not match")
	ErrCopyCount       = errors.New("count of records copied did not match expected")
	ErrEmptyCommonName = errors.New("common name was empty")
)
View Source
var (
	// Subdomain table data
	AddCTSubDomainTempTableKey     = "cert_subdomain_temp"
	AddCTSubDomainTempTableColumns = []string{"inserted_timestamp", "etld_id", "common_name"}
	AddCTSubDomainTempTable        = `` /* 142-byte string literal not displayed */

	AddTempSubDomainToCTSubDomain = `` /* 233-byte string literal not displayed */

	// Full CT data
	AddCTTempTableKey     = "cert_add_temp"
	AddCTTempTableColumns = []string{"inserted_timestamp", "server_name", "server_index", "etld", "cert_hash", "serial_number",
		"not_before", "not_after", "country", "organization", "organizational_unit", "common_name",
		"verified_dns_names", "unverified_dns_names", "ip_addresses", "email_addresses"}

	AddCTTempTable = `` /* 514-byte string literal not displayed */

	AddTempToCT = fmt.Sprintf(`insert into am.certificates as cert (
			%s
		)
		select
			temp.inserted_timestamp,
			temp.server_name,
			temp.server_index,
			temp.etld,
			temp.cert_hash,
			temp.serial_number,
			temp.not_before,
			temp.not_after,
			temp.country,
			temp.organization,
			temp.organizational_unit,
			temp.common_name,
			temp.verified_dns_names,
			temp.unverified_dns_names,
			temp.ip_addresses, 
			temp.email_addresses
		from cert_add_temp as temp on conflict do nothing`, commonColumns)
)

Functions

This section is empty.

Types

type Service

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

Service for interfacing with postgresql/rds

func New

func New(authorizer auth.Authorizer) *Service

New returns an empty Service

func (*Service) AddCT

func (s *Service) AddCT(ctx context.Context, userContext am.UserContext, etld string, queryTime time.Time, ctRecords map[string]*am.CTRecord) error

AddCT adds certificate transparency records

func (*Service) AddCTSubdomains

func (s *Service) AddCTSubdomains(ctx context.Context, userContext am.UserContext, etld string, queryTime time.Time, subdomains map[string]*am.CTSubdomain) error

AddCTSubdomains adds cert transparency subdomains to our database for the specified etld. Also creates an entry for the queryTime of this particular ETLD so we don't have to scan the entire cert transparency db every time.

func (*Service) DeleteCT

func (s *Service) DeleteCT(ctx context.Context, userContext am.UserContext, etld string) error

func (*Service) DeleteCTSubdomains

func (s *Service) DeleteCTSubdomains(ctx context.Context, userContext am.UserContext, etld string) error

DeleteCTSubdomains (only really used in tests)

func (*Service) GetCT

func (s *Service) GetCT(ctx context.Context, userContext am.UserContext, etld string) (time.Time, map[string]*am.CTRecord, error)

GetCT returns locally cached certificate transparency records that match the etld.

func (*Service) GetCTSubdomains

func (s *Service) GetCTSubdomains(ctx context.Context, userContext am.UserContext, etld string) (time.Time, map[string]*am.CTSubdomain, error)

GetCTSubdomains returns subdomains extracted from certificate transparency's common name field of certificates for the specified etld.

func (*Service) GetETLDs

func (s *Service) GetETLDs(ctx context.Context, userContext am.UserContext) ([]*am.CTETLD, error)

func (*Service) Init

func (s *Service) Init(config []byte) error

Init by parsing the config and initializing the database pool

func (*Service) IsAuthorized

func (s *Service) IsAuthorized(ctx context.Context, userContext am.UserContext, resource, action string) bool

IsAuthorized checks if an action is allowed by a particular user

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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