audit

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventFileRead     = "file.read"
	EventFileWrite    = "file.write"
	EventFileDelete   = "file.delete"
	EventFileRename   = "file.rename"
	EventFileCopy     = "file.copy"
	EventFileChmod    = "file.chmod"
	EventFileChown    = "file.chown"
	EventFileMkdir    = "file.mkdir"
	EventFileUpload   = "file.upload"
	EventFileDownload = "file.download"
	EventFileListDir  = "file.listdir"
	EventFileDirStats = "file.dirstats"
)
View Source
const (
	EventStackList          = "stack.list"
	EventStackCreate        = "stack.create"
	EventStackGetDetails    = "stack.get_details"
	EventStackGetSummary    = "stack.get_summary"
	EventStackGetEnvVars    = "stack.get_env_vars"
	EventStackGetNetworks   = "stack.get_networks"
	EventStackGetVolumes    = "stack.get_volumes"
	EventStackGetImages     = "stack.get_images"
	EventStackGetCompose    = "stack.get_compose"
	EventStackUpdateCompose = "stack.update_compose"
)
View Source
const (
	EventOperationStarted   = "operation.started"
	EventOperationCompleted = "operation.completed"
	EventOperationFailed    = "operation.failed"
	EventOperationStreamed  = "operation.streamed"
)
View Source
const (
	EventMaintenanceGetInfo        = "maintenance.get_info"
	EventMaintenancePrune          = "maintenance.prune"
	EventMaintenanceDeleteResource = "maintenance.delete_resource"
)
View Source
const (
	EventContainerLogs     = "container.logs"
	EventContainerStats    = "container.stats"
	EventImageCheckUpdates = "image.check_updates"
)
View Source
const (
	EventVulnscanStarted   = "vulnscan.started"
	EventVulnscanCompleted = "vulnscan.completed"
	EventVulnscanRetrieved = "vulnscan.retrieved"
	EventVulnscanStatus    = "vulnscan.status"
)
View Source
const (
	EventTerminalConnected    = "terminal.connected"
	EventTerminalDisconnected = "terminal.disconnected"
)
View Source
const (
	EventAuthSuccess = "auth.success"
	EventAuthFailure = "auth.failure"
)

Variables

Functions

func GetEventCategory

func GetEventCategory(eventType string) string

func GetEventSeverity

func GetEventSeverity(eventType string) string

func RegisterShutdown

func RegisterShutdown(lc fx.Lifecycle, service *Service)

Types

type AuditEvent

type AuditEvent struct {
	Timestamp     time.Time      `json:"timestamp"`
	EventType     string         `json:"event_type"`
	EventCategory string         `json:"event_category"`
	Severity      string         `json:"severity"`
	Success       bool           `json:"success"`
	ClientIP      string         `json:"client_ip,omitempty"`
	StackName     string         `json:"stack_name,omitempty"`
	TargetPath    string         `json:"target_path,omitempty"`
	OperationID   string         `json:"operation_id,omitempty"`
	Command       string         `json:"command,omitempty"`
	FailureReason string         `json:"failure_reason,omitempty"`
	DurationMs    int64          `json:"duration_ms,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
}

type Service

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

func NewService

func NewService(enabled bool, logFilePath string, maxSizeBytes int64) (*Service, error)

func NewServiceFromConfig

func NewServiceFromConfig(cfg *config.Config) (*Service, error)

func (*Service) Close

func (s *Service) Close() error

func (*Service) IsEnabled

func (s *Service) IsEnabled() bool

func (*Service) Log

func (s *Service) Log(event AuditEvent)

func (*Service) LogAuthEvent

func (s *Service) LogAuthEvent(eventType string, clientIP string, success bool, failureReason string)

func (*Service) LogFileEvent

func (s *Service) LogFileEvent(eventType string, clientIP string, stackName string, targetPath string, success bool, failureReason string, metadata map[string]any)

func (*Service) LogMaintenanceEvent

func (s *Service) LogMaintenanceEvent(eventType string, clientIP string, success bool, failureReason string, metadata map[string]any)

func (*Service) LogOperationEvent

func (s *Service) LogOperationEvent(eventType string, clientIP string, stackName string, operationID string, command string, success bool, failureReason string, durationMs int64, metadata map[string]any)

func (*Service) LogStackEvent

func (s *Service) LogStackEvent(eventType string, clientIP string, stackName string, success bool, failureReason string, metadata map[string]any)

func (*Service) LogTerminalEvent

func (s *Service) LogTerminalEvent(eventType string, clientIP string, stackName string, containerName string, metadata map[string]any)

func (*Service) LogVulnscanEvent

func (s *Service) LogVulnscanEvent(eventType string, clientIP string, stackName string, success bool, failureReason string, metadata map[string]any)

Jump to

Keyboard shortcuts

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