updater

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package updater updates the vulnerability database periodically using the registered vulnerability fetchers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFetcher

func RegisterFetcher(name string, f Fetcher)

RegisterFetcher makes a Fetcher available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

func RegisterMetadataFetcher added in v1.0.0

func RegisterMetadataFetcher(name string, f MetadataFetcher)

RegisterFetcher makes a Fetcher available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

func Run

func Run(config *config.UpdaterConfig, datastore database.Datastore, st *utils.Stopper)

Run updates the vulnerability database at regular intervals.

func Update

func Update(datastore database.Datastore, firstUpdate bool)

Update fetches all the vulnerabilities from the registered fetchers, upserts them into the database and then sends notifications.

Types

type Fetcher

type Fetcher interface {
	// FetchUpdate gets vulnerability updates.
	FetchUpdate(database.Datastore) (FetcherResponse, error)

	// Clean deletes any allocated resources.
	// It is invoked when Clair stops.
	Clean()
}

Fetcher represents anything that can fetch vulnerabilities.

type FetcherResponse

type FetcherResponse struct {
	FlagName        string
	FlagValue       string
	Notes           []string
	Vulnerabilities []database.Vulnerability
}

FetcherResponse represents the sum of results of an update.

type MetadataFetcher added in v1.0.0

type MetadataFetcher interface {
	// Load runs right before the Updater calls AddMetadata for each vulnerabilities.
	Load(database.Datastore) error

	// AddMetadata adds metadata to the given database.Vulnerability.
	// It is expected that the fetcher uses .Lock.Lock() when manipulating the Metadata map.
	AddMetadata(*VulnerabilityWithLock) error

	// Unload runs right after the Updater finished calling AddMetadata for every vulnerabilities.
	Unload()

	// Clean deletes any allocated resources.
	// It is invoked when Clair stops.
	Clean()
}

MetadataFetcher

type VulnerabilityWithLock added in v1.0.0

type VulnerabilityWithLock struct {
	*database.Vulnerability
	Lock sync.Mutex
}

Directories

Path Synopsis
fetchers
metadata_fetchers
nvd

Jump to

Keyboard shortcuts

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