cronjobs

package
v0.0.0-...-9acc2fa Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConsoleAgentId = "deepfence-console-cron"
)
View Source
const DefaultNotificationErrorBackoff = 15 * time.Minute
View Source
const NOTIFICATION_INTERVAL = 60000 //in milliseconds

Variables

View Source
var BenchmarksAvailableMap = map[string][]string{
	"aws":        {"cis", "nist", "pci", "gdpr", "hipaa", "soc_2"},
	"gcp":        {"cis"},
	"azure":      {"cis", "nist", "pci", "hipaa"},
	"kubernetes": {"nsa-cisa"},
	"linux":      {"hipaa", "nist", "pci", "gdpr"},
}
View Source
var (
	NotificationErrorBackoff time.Duration
)
View Source
var (
	NotificationRecordsCounts = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "notification_records_total",
		Help: "Total number of records sent by notification types",
	}, []string{"resource", "type", "status", "namespace"})
)

Functions

func AddCloudControls

func AddCloudControls(ctx context.Context, task *asynq.Task) error

func AsynqDeleteAllArchivedTasks

func AsynqDeleteAllArchivedTasks(ctx context.Context, task *asynq.Task) error

func CachePostureProviders

func CachePostureProviders(ctx context.Context, task *asynq.Task) error

func CheckAgentUpgrade

func CheckAgentUpgrade(ctx context.Context, task *asynq.Task) error

func CleanUpDB

func CleanUpDB(ctx context.Context, task *asynq.Task) error

func CleanUpDiagnosisLogs

func CleanUpDiagnosisLogs(ctx context.Context, task *asynq.Task) error

func CleanUpPostgresDB

func CleanUpPostgresDB(ctx context.Context, task *asynq.Task) error

CleanUpPostgresDB Delete expired user invites and password reset requests

func CleanUpReports

func CleanUpReports(ctx context.Context, task *asynq.Task) error

func ComputeThreat

func ComputeThreat(ctx context.Context, task *asynq.Task) error

func FetchLicense

func FetchLicense(ctx context.Context) (string, error)

FetchLicense gets license key from database

func FetchThreatIntel

func FetchThreatIntel(ctx context.Context, task *asynq.Task) error

func FetchThreatIntelListing

func FetchThreatIntelListing(ctx context.Context, token string) (threatintel.Listing, error)

func FormatForMessagingApps

func FormatForMessagingApps[T any](results []T, resourceType string) []map[string]interface{}

func LinkCloudResources

func LinkCloudResources(ctx context.Context, task *asynq.Task) error

func LinkNodes

func LinkNodes(ctx context.Context, task *asynq.Task) error

func MaxAllocable

func MaxAllocable(ctx context.Context, max int) int

func PublishLicenseUsageToLicenseServer

func PublishLicenseUsageToLicenseServer(ctx context.Context, task *asynq.Task) error

func RedisRewriteAOF

func RedisRewriteAOF(ctx context.Context, task *asynq.Task) error

func RetryScansDB

func RetryScansDB(ctx context.Context, task *asynq.Task) error

func RetryUpgradeAgent

func RetryUpgradeAgent(ctx context.Context, task *asynq.Task) error

func RunScheduledTasks

func RunScheduledTasks(ctx context.Context, task *asynq.Task) error

func SendNotifications

func SendNotifications(ctx context.Context, task *asynq.Task) error

func SyncRegistry

func SyncRegistry(ctx context.Context, task *asynq.Task) error

func SyncRegistryPostgresNeo4jTask

func SyncRegistryPostgresNeo4jTask(ctx context.Context, task *asynq.Task) error

SyncRegistryPostgresNeo4jTask Synchronize registry between postgres and neo4j

func UpdateLicenseStatus

func UpdateLicenseStatus(ctx context.Context, task *asynq.Task) error

Types

type Benchmark

type Benchmark struct {
	BenchmarkId   string            `json:"benchmark_id"`
	Description   string            `json:"description"`
	Title         string            `json:"title"`
	Tags          map[string]string `json:"tags"`
	Documentation string            `json:"documentation"`
	Children      []string          `json:"children"`
}

type ConsoleController

type ConsoleController struct {
	MaxWorkload int
	TTLCache    *ttlcache.Cache[string, string]
}

func NewConsoleController

func NewConsoleController(max int) ConsoleController

func (ConsoleController) TriggerConsoleControls

func (c ConsoleController) TriggerConsoleControls(ctx context.Context, t *asynq.Task) error

Allocator shared across all workers instances per namespace

type Control

type Control struct {
	CategoryBreadcrumb      string            `json:"category_breadcrumb"`
	CategoryHierarchy       []string          `json:"category_hierarchy"`
	ControlId               string            `json:"control_id"`
	Description             string            `json:"description"`
	Title                   string            `json:"title"`
	Tags                    map[string]string `json:"tags"`
	Documentation           string            `json:"documentation"`
	ParentControlHierarchy  []string          `json:"parent_control_hierarchy"`
	ParentControlBreadcrumb string            `json:"parent_control_breadcrumb"`
	Executable              bool              `json:"executable"`
}

type ListingFormat

type ListingFormat struct {
	Available []struct {
		Built    time.Time `json:"built"`
		Version  string    `json:"version"`
		URL      string    `json:"url"`
		Checksum string    `json:"checksum"`
	} `json:"available"`
}

type ReportLicensePayload

type ReportLicensePayload struct {
	LicenseKey                              string `json:"license_key"`
	DfClusterID                             int64  `json:"df_cluster_id"`
	CurrentNumberOfHosts                    int64  `json:"current_no_of_hosts"`
	CurrentNumberOfCloudAccounts            int64  `json:"current_no_of_cloud_accounts"`
	CurrentNumberOfRegistries               int64  `json:"current_no_of_registries"`
	NotificationThresholdPercentage         int32  `json:"notification_threshold_percentage"`
	NotificationThresholdUpdatedAtTimestamp int64  `json:"notification_threshold_updated_at_timestamp"`
}

Jump to

Keyboard shortcuts

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