assetscanwatcher

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPollInterval     = 15 * time.Second
	DefaultReconcileTimeout = 5 * time.Minute
	DefaultAbortTimeout     = 10 * time.Minute
)
View Source
const (
	DefaultTrivyScanTimeout   = 5 * time.Minute
	DefaultGrypeServerTimeout = 2 * time.Minute
)

Variables

This section is empty.

Functions

func NewFamiliesConfigFrom

func NewFamiliesConfigFrom(config *ScannerConfig, sfc *models.ScanFamiliesConfig) *families.Config

Types

type AssetScanPoller

type AssetScanPoller = common.Poller[AssetScanReconcileEvent]

type AssetScanQueue

type AssetScanQueue = common.Queue[AssetScanReconcileEvent]

type AssetScanReconcileEvent

type AssetScanReconcileEvent struct {
	AssetScanID models.AssetScanID
	ScanID      models.ScanID
	AssetID     models.AssetID
}

func (AssetScanReconcileEvent) Hash

func (AssetScanReconcileEvent) String

func (e AssetScanReconcileEvent) String() string

func (AssetScanReconcileEvent) ToFields

func (e AssetScanReconcileEvent) ToFields() log.Fields

type Config

type Config struct {
	Backend          *backendclient.BackendClient
	Provider         provider.Provider
	PollPeriod       time.Duration       `mapstructure:"poll_period"`
	ReconcileTimeout time.Duration       `mapstructure:"reconcile_timeout"`
	DeleteJobPolicy  DeleteJobPolicyType `mapstructure:"delete_policy"`
	AbortTimeout     time.Duration       `mapstructure:"abort_timeout"`
	ScannerConfig    ScannerConfig       `mapstructure:"scanner"`
}

func (Config) WithBackendClient

func (c Config) WithBackendClient(b *backendclient.BackendClient) Config

func (Config) WithPollPeriod

func (c Config) WithPollPeriod(t time.Duration) Config

func (Config) WithProviderClient

func (c Config) WithProviderClient(p provider.Provider) Config

func (Config) WithReconcileTimeout

func (c Config) WithReconcileTimeout(t time.Duration) Config

func (Config) WithScannerConfig

func (c Config) WithScannerConfig(s ScannerConfig) Config

type DeleteJobPolicyType

type DeleteJobPolicyType string
const (
	DeleteJobPolicyAlways    DeleteJobPolicyType = "Always"
	DeleteJobPolicyNever     DeleteJobPolicyType = "Never"
	DeleteJobPolicyOnSuccess DeleteJobPolicyType = "OnSuccess"
)

func (*DeleteJobPolicyType) UnmarshalText

func (p *DeleteJobPolicyType) UnmarshalText(text []byte) error

type FamiliesConfigOption

type FamiliesConfigOption func(*families.Config)

type ScannerConfig

type ScannerConfig struct {
	// Address that the Scanner should use to talk to the VMClarity backend
	// We use a configuration variable for this instead of discovering it
	// automatically in case VMClarity backend has multiple IPs (internal
	// traffic and external traffic for example) so we need the specific
	// address to use.
	APIServerAddress string `json:"apiserver-address,omitempty" mapstructure:"apiserver_address"`

	ExploitsDBAddress string `mapstructure:"exploitsdb_address"`

	TrivyServerAddress string        `mapstructure:"trivy_server_address"`
	TrivyScanTimeout   time.Duration `mapstructure:"trivy_scan_timeout"`

	GrypeServerAddress string        `mapstructure:"grype_server_address"`
	GrypeServerTimeout time.Duration `mapstructure:"grype_server_timeout"`

	YaraRuleServerAddress string `mapstructure:"yara_rule_server_address"`

	// The container image to use once we've booted the scanner virtual
	// machine, that contains the VMClarity CLI plus all the required
	// tools.
	ScannerImage string `mapstructure:"container_image"`

	// The freshclam mirror url to use if it's enabled
	AlternativeFreshclamMirrorURL string `mapstructure:"freshclam_mirror"`
}

type Watcher

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

func New

func New(c Config) *Watcher

func (*Watcher) GetAssetScans

func (w *Watcher) GetAssetScans(ctx context.Context) ([]AssetScanReconcileEvent, error)

nolint:cyclop

func (*Watcher) Reconcile

func (w *Watcher) Reconcile(ctx context.Context, event AssetScanReconcileEvent) error

nolint:cyclop

func (*Watcher) Start

func (w *Watcher) Start(ctx context.Context)

Jump to

Keyboard shortcuts

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