Documentation
¶
Index ¶
- Constants
- func DeleteCommandsByDays(days int) error
- func InsertCommand(command Command) error
- func IsCommandAcceptable(command string, excludeRegex string) bool
- func MapCommandToProto(command Command) *gen.Command
- func ParseCommand(command string) string
- type AuthConfig
- type Collector
- type Command
- type IntervalConfig
Constants ¶
const SocketPath = "/tmp/lda.socket"
TODO move this to /var/run or other appropriate location based on OS, TODO /var/run has issues with permisisons os have to explore a bit more.
Variables ¶
This section is empty.
Functions ¶
func DeleteCommandsByDays ¶
DeleteCommandsByDays deletes records older than n days
func InsertCommand ¶
InsertCommand inserts a command into the database
func IsCommandAcceptable ¶
IsCommandAcceptable checks if a command string matches a configured regex pattern. Commands that match the regex are considered unacceptable, and it returns false. If the regex is empty or the command does not match, it returns true.
func MapCommandToProto ¶
func ParseCommand ¶
ParseCommand extracts the command name from a command string.
Types ¶
type AuthConfig ¶
AuthConfig contains the configuration for the command processing and authentication
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector collects command and system information
func NewCollector ¶
func NewCollector(socketPath string, client *client.Client, logger zerolog.Logger, config IntervalConfig, auth AuthConfig, excludeRegex string, process process.SystemProcess) *Collector
NewCollector creates a new collector instance
type Command ¶
type Command struct {
Id int64 `json:"id" db:"id"`
Category string `json:"category" db:"category"`
Command string `json:"command" db:"command"`
User string `json:"user" db:"user"`
Directory string `json:"directory" db:"directory"`
ExecutionTime int64 `json:"execution_time" db:"execution_time"`
StartTime int64 `json:"start_time" db:"start_time"`
EndTime int64 `json:"end_time" db:"end_time"`
Status string `json:"status" db:"status"`
Result string `json:"result" db:"result"`
Repository string `json:"repository" db:"repository"`
}
Command is the model for command
func GetAllCommandsForCategoryForPeriod ¶
GetAllCommandsForCategoryForPeriod fetches all commands for a given category and period
func GetAllCommandsForPeriod ¶
GetAllCommandsForPeriod fetches all commands for a given period
func GetCommandById ¶
GetCommandById fetches a command by its ID