Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidScriptFile is returned when the script file is not a regular file. ErrInvalidScriptFile = errors.New("invalid script file") // ErrFileIsNotExecutable is returned when the script file is not executable. ErrFileIsNotExecutable = errors.New("file is not executable") )
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor is an implementation of QueueExecutor interface in the eventqueue package. Script executor will execute configured scripts according to the event received from the event queue. Scripts should be in the following naming convention <ScriptDir>/<ScriptPrefix>-<RuleID>.sh . Scripts should be executable. CAUTION: Make sure to vet the script before allowing the sensor to run it, since the sensor does not do any kind of verification. Implemented as a Proof of Concept. Passing on the event to eventsrunner will be more scalable, easier to maintain and secure.
func New ¶
New creates a new instance of script based Executor. ScriptDir and ScriptPrefix are configs are required.
func (*Executor) Execute ¶
func (se *Executor) Execute(event *eventqueue.Event) error
Execute executes the script for the given event. Execute function will construct the script path and execute it. The relevant event information will be passed to the script as an base64 encoded JSON string in the form of an environment variable with the name EVENT. Execute will return errors if the script is not an executable or if the script is invalid. OS STDOUT and STDERR will be used for the script. TODO: Add file STDOUT and STDERR for scripts