pkgload_scanner

package
v0.0.0-...-46fbbb1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportPkgloadReports

func ExportPkgloadReports(report PkgLoadReport, pl *v1alpha1.InspectionPolicy)

Types

type Config

type Config struct {
	Server     string `json:"server"`
	StandAlone bool   `json:"standalone"`
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig read configuration from env

func ReadEnvConfig

func ReadEnvConfig() *Config

ReadEnvConfig read configuration from env

type Controller

type Controller interface {
	// Run inspection.
	Run(ctx context.Context, policy *v1alpha1.InspectionPolicy) error
}

Controller controls the inspection flow.

type Lsof

type Lsof struct {
	Command string
	PID     string
	User    string
	FD      string
	Type    string
	Device  string
	Size    string
	Node    string
	Name    string
}

Define a struct to hold the parsed fields

type LsofInfo

type LsofInfo struct {
	// from lsof
	Command string
	PID     string
	UID     string
	User    string
	Name    []string

	// from proc tool
	ContainerID string
}

type PkgLoadController

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

func NewController

func NewController() *PkgLoadController

NewController news a PkgLoadController.

func (*PkgLoadController) CTRL

func (c *PkgLoadController) CTRL() Controller

CTRL returns PkgLoadController interface.

func (*PkgLoadController) Run

func (*PkgLoadController) Scan

func (*PkgLoadController) WithAdapter

func (s *PkgLoadController) WithAdapter(Adapter providers.Adapter) *PkgLoadController

WithAdapter sets adapter.

func (*PkgLoadController) WithK8sClient

func (c *PkgLoadController) WithK8sClient(cli client.Client) *PkgLoadController

WithK8sClient sets k8s client.

func (*PkgLoadController) WithPkgScanner

func (c *PkgLoadController) WithPkgScanner(client pkgclient.PkgInfoClient) *PkgLoadController

func (*PkgLoadController) WithScheme

func (c *PkgLoadController) WithScheme(scheme *runtime.Scheme) *PkgLoadController

WithScheme sets runtime scheme.

type PkgLoadReport

type PkgLoadReport struct {
	VulnLoaded      []VulnLoaded `json:"vulnLoaded"` // vuln loaded
	NodeName        string       `json:"nodeName"`   // node name
	CreateTimestamp int64        `json:"createTime"` // unix timestamp
	DocID           string       `json:"docID"`      // doc id, pkgload-{nodeName}-{createdAt}
}

func (PkgLoadReport) GenDocID

func (p PkgLoadReport) GenDocID() string

type VulnDetail

type VulnDetail struct {
	PkgName           string              `json:"pkgName"`
	Version           string              `json:"version"`
	CVE               string              `json:"cve"`
	Severity          string              `json:"severity"`
	MapInstalledFiles map[string]struct{} `json:"mapInstalledFiles"`
}

type VulnLoaded

type VulnLoaded struct {
	// vuln info
	CVE      string `json:"cve"`
	Severity string `json:"severity"`
	// pkg info
	PkgName string `json:"pkgName"`
	Version string `json:"version"`
	// runtime
	PID  string `json:"pid"`
	User string `json:"user"`
	// k8s info
	ContainerID string `json:"containerID"`
	PodName     string `json:"podName"`
	Namespace   string `json:"namespace"`
	NodeName    string `json:"nodeName"`
	ImageName   string `json:"imageName"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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