securityhardenedk8s

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RulesetID is a constant containing the id of the Security Hardened Kubernetes Cluster Ruleset.
	RulesetID = "security-hardened-k8s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOption

type CreateOption func(*Ruleset)

CreateOption is a function that acts on a Ruleset and is used to construct such objects.

func WithConfig

func WithConfig(config *rest.Config) CreateOption

WithConfig sets the Config of a Ruleset.

func WithLogger

func WithLogger(logger *slog.Logger) CreateOption

WithLogger the logger of a Ruleset.

func WithNumberOfWorkers

func WithNumberOfWorkers(numWorkers int) CreateOption

WithNumberOfWorkers sets the max number of Workers of a Ruleset.

func WithVersion

func WithVersion(version string) CreateOption

WithVersion sets the version of a Ruleset.

type Ruleset

type Ruleset struct {
	Config *rest.Config
	// contains filtered or unexported fields
}

Ruleset implements Security Hardened Kubernetes Cluster.

func FromGenericConfig

func FromGenericConfig(rulesetConfig config.RulesetConfig, managedConfig *rest.Config) (*Ruleset, error)

FromGenericConfig creates a Ruleset from a RulesetConfig

func New

func New(options ...CreateOption) (*Ruleset, error)

New creates a new Ruleset.

func (*Ruleset) AddRules

func (r *Ruleset) AddRules(rules ...rule.Rule) error

AddRules adds Rules to the Ruleset.

func (*Ruleset) ID

func (r *Ruleset) ID() string

ID returns the id of the Ruleset.

func (*Ruleset) Logger

func (r *Ruleset) Logger() *slog.Logger

Logger returns the Ruleset's logger. If not set it set it to slog.Default().With("ruleset", r.ID(), "version", r.Version() then return it.

func (*Ruleset) Name

func (r *Ruleset) Name() string

Name returns the name of the Ruleset.

func (*Ruleset) Run

Run executes all known Rules of the Ruleset.

func (*Ruleset) RunRule

func (r *Ruleset) RunRule(ctx context.Context, id string) (rule.RuleResult, error)

RunRule executes specific known Rule of the Ruleset.

func (*Ruleset) Version

func (r *Ruleset) Version() string

Version returns the version of the Ruleset.

Directories

Path Synopsis
Package rules implements rules that correspond to the latest supported ruleset version.
Package rules implements rules that correspond to the latest supported ruleset version.

Jump to

Keyboard shortcuts

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