Documentation
¶
Index ¶
- Constants
- Variables
- func IPFromRequest(req *http.Request) (net.IP, error)
- func KeyGen(size int) string
- func UUIDGen() uuid.UUID
- type AdminAPIConfig
- type AdminAPIResponse
- type AdminAPIUser
- type ArchivedReport
- type ClientConfig
- func (cc *ClientConfig) DialContext(ctx context.Context, network, addr string) (con net.Conn, err error)
- func (cc *ClientConfig) DialTLSContext(ctx context.Context, network, addr string) (net.Conn, error)
- func (cc *ClientConfig) ManagerIP() net.IP
- func (cc *ClientConfig) Transport() http.RoundTripper
- type Command
- func (c *Command) AddDropFile(filename, filepath string) error
- func (c *Command) AddDropFileFromPath(path string) error
- func (c *Command) AddFetchFile(filepath string)
- func (c *Command) BuildCmd() (*exec.Cmd, error)
- func (c *Command) Complete(other *Command) error
- func (c *Command) FromExecCmd(cmd *exec.Cmd)
- func (c *Command) Run() (err error)
- func (c *Command) SetCommandLine(cl string) error
- func (c Command) String() string
- func (c *Command) Strip()
- func (c *Command) Unrunnable()
- type CommandAPI
- type DumpFile
- type Endpoint
- type EndpointAPIConfig
- type EndpointDumps
- type EndpointFile
- type Endpoints
- func (es *Endpoints) Add(e *Endpoint)
- func (es *Endpoints) DelByUUID(uuid string)
- func (es *Endpoints) Endpoints() []*Endpoint
- func (es *Endpoints) GetByUUID(uuid string) (*Endpoint, bool)
- func (es *Endpoints) GetMutByUUID(uuid string) (*Endpoint, bool)
- func (es *Endpoints) HasByUUID(uuid string) bool
- func (es *Endpoints) Len() int
- func (es *Endpoints) MutEndpoints() []*Endpoint
- type EventStreamer
- type FileUpload
- type Forwarder
- func (f *Forwarder) ArchiveLogs()
- func (f *Forwarder) CleanOlderQueued() error
- func (f *Forwarder) Close()
- func (f *Forwarder) Collect()
- func (f *Forwarder) DiskSpaceQueue() int64
- func (f *Forwarder) HasQueuedEvents() bool
- func (f *Forwarder) LogfilePath() string
- func (f *Forwarder) PipeEvent(event interface{})
- func (f *Forwarder) ProcessQueue()
- func (f *Forwarder) Reset()
- func (f *Forwarder) Run()
- func (f *Forwarder) Save() (err error)
- type ForwarderConfig
- type LogStream
- type LoggingConfig
- type Manager
- func (m *Manager) AddCommand(uuid string, c *Command) error
- func (m *Manager) AddEndpoint(uuid, key string)
- func (m *Manager) Collect(wt http.ResponseWriter, rq *http.Request)
- func (m *Manager) Command(wt http.ResponseWriter, rq *http.Request)
- func (m *Manager) CreateNewAdminAPIUser(user *AdminAPIUser) (err error)
- func (m *Manager) GetCommand(uuid string) (*Command, error)
- func (m *Manager) IoCs(wt http.ResponseWriter, rq *http.Request)
- func (m *Manager) IoCsSha256(wt http.ResponseWriter, rq *http.Request)
- func (m *Manager) IsDone() bool
- func (m *Manager) LoadGeneEngine() error
- func (m *Manager) Rules(wt http.ResponseWriter, rq *http.Request)
- func (m *Manager) RulesSha256(wt http.ResponseWriter, rq *http.Request)
- func (m *Manager) Run()
- func (m *Manager) ServerKey(wt http.ResponseWriter, rq *http.Request)
- func (m *Manager) Shutdown() (lastErr error)
- func (m *Manager) UpdateReducer(identifier string, e *event.EdrEvent)
- func (m *Manager) UploadDump(wt http.ResponseWriter, rq *http.Request)
- func (m *Manager) Wait()
- type ManagerClient
- func (m *ManagerClient) Close()
- func (m *ManagerClient) FetchCommand() (*Command, error)
- func (m *ManagerClient) GetIoCs() ([]string, error)
- func (m *ManagerClient) GetIoCsSha256() (string, error)
- func (m *ManagerClient) GetRules() (string, error)
- func (m *ManagerClient) GetRulesSha256() (string, error)
- func (m *ManagerClient) IsFileAboveUploadLimit(path string) bool
- func (m *ManagerClient) IsServerAuthEnforced() bool
- func (m *ManagerClient) IsServerAuthenticated() (auth bool, up bool)
- func (m *ManagerClient) IsServerUp() bool
- func (m *ManagerClient) PostCommand(command *Command) error
- func (m *ManagerClient) PostDump(f *FileUpload) error
- func (m *ManagerClient) PostLogs(r io.Reader) error
- func (m *ManagerClient) Prepare(method, url string, body io.Reader) (*http.Request, error)
- func (m *ManagerClient) PrepareGzip(method, url string, body io.Reader) (*http.Request, error)
- type ManagerConfig
- type ManagerLogConfig
- type TLSConfig
- type UploadShrinker
Constants ¶
const ( // UserAgent used by the client UserAgent = "Whids-API-Client/1.0" // Mega byte size Mega = 1 << 20 )
const ( // DefaultLogfileSize default forwarder logfile size DefaultLogfileSize = logfile.MB * 5 // DiskSpaceThreshold allow 1GB of queued events DiskSpaceThreshold = logfile.GB // MinRotationInterval is the minimum rotation interval allowed MinRotationInterval = time.Minute )
const ( AuthKeyHeader = "X-Api-Key" // Endpoint related EndpointUUIDHeader = "X-Endpoint-Uuid" EndpointIPHeader = "X-Endpoint-IP" EndpointHostnameHeader = "X-Endpoint-Hostname" )
const ( // DefaultLogPerm default logfile permission for Manager DefaultLogPerm = 0600 // DefaultManagerLogSize default size for Manager's logfiles DefaultManagerLogSize = utils.Mega * 100 // DefaultKeySize default size for API key generation DefaultKeySize = 64 // EptAPIDefaultPort default port used by manager's endpoint API EptAPIDefaultPort = 1519 // AdmAPIDefaultPort default port used by manager's admin API AdmAPIDefaultPort = 1520 // DefaultMaxUploadSize default maximum upload size DefaultMaxUploadSize = 100 * utils.Mega // IoCContainerName default container name to store manager's IoCs IoCContainerName = "edr_iocs" )
const ( // EptAPIServerKeyPath API route used to get server key EptAPIServerKeyPath = "/key" // EptAPIRulesPath API route used to get Gene rules available in server EptAPIRulesPath = "/rules" // EptAPIRulesSha256Path API route used to retrieve sha256 of latest batch of Gene rules EptAPIRulesSha256Path = "/rules/sha256" // EptAPIIoCsPath API route used to serve IOC container EptAPIIoCsPath = "/iocs" // EptAPIIoCsSha256Path API route used to serve sha256 of IOC container EptAPIIoCsSha256Path = "/iocs/sha256" // EptAPIPostLogsPath API route used to post logs EptAPIPostLogsPath = "/logs" // EptAPIPostDumpPath API route used to dump things EptAPIPostDumpPath = "/upload/dumps" // EptAPICommandPath used to GET commands and POST results EptAPICommandPath = "/commands" )
Routes used by Clients
const ( AdmAPIUsers = "/users" AdmAPIUserByID = AdmAPIUsers + "/{uuuid:" + uuidRe + "}" AdmAPIStatsPath = "/stats" AdmAPIIocsPath = "/iocs" AdmAPIRulesPath = "/rules" AdmAPIRulesReloadPath = "/rules/reload" AdmAPIRulesSavePath = "/rules/save" AdmAPIEndpointsPath = "/endpoints" AdmAPIEndpointsByIDPath = AdmAPIEndpointsPath + "/{euuid:" + uuidRe + "}" // Command related AdmAPICommandSuffix = "/command" AdmAPIEndpointCommandPath = AdmAPIEndpointsByIDPath + AdmAPICommandSuffix AdmAPIEndpointCommandFieldPath = AdmAPIEndpointCommandPath + "/{field}" // Logs related AdmAPILogsSuffix = "/logs" AdmAPIEndpointLogsPath = AdmAPIEndpointsByIDPath + AdmAPILogsSuffix AdmAPIDetectionSuffix = "/detections" AdmAPIEndpointDetectionsPath = AdmAPIEndpointsByIDPath + AdmAPIDetectionSuffix // Reports related AdmAPIReportSuffix = "/report" AdmAPIEndpointsReportsPath = AdmAPIEndpointsPath + "/reports" AdmAPIEndpointReportPath = AdmAPIEndpointsByIDPath + AdmAPIReportSuffix AdmAPIArchiveSuffix = "/archive" AdmAPIEndpointReportArchivePath = AdmAPIEndpointReportPath + AdmAPIArchiveSuffix // Dumps related AdmAPIArticfactsSuffix = "/artifacts" AdmAPIEndpointsArtifactsPath = AdmAPIEndpointsPath + AdmAPIArticfactsSuffix AdmAPIEndpointArtifacts = AdmAPIEndpointsByIDPath + AdmAPIArticfactsSuffix AdmAPIEndpointArtifact = AdmAPIEndpointArtifacts + "/{pguid:" + uuidRe + "}/{ehash:[[:xdigit:]]+}/{fname:.*}" //Websockets AdmAPIStreamEvents = "/stream/events" AdmAPIStreamDetections = "/stream/detections" )
Routes used for Admin API
const (
MaxLimitLogAPI = 10000
)
Variables ¶
var (
ErrNothingToDo = fmt.Errorf("nothing to do")
)
var ( // ErrUnkEndpoint error to return when endpoint is unknown ErrUnkEndpoint = fmt.Errorf("unknown endpoint") )
var ( // Hostname the client is running on (initialized in init() function) Hostname string )
var OpenAPIDefinition = `` /* 81347-byte string literal not displayed */
var (
UploadShrinkerBufferSize = int64(3 * utils.Mega)
)
Functions ¶
func IPFromRequest ¶
IPFromRequest extracts the user IP address from req, if present. source: https://blog.golang.org/context/userip/userip.go
Types ¶
type AdminAPIConfig ¶
type AdminAPIConfig struct {
Host string `toml:"host" comment:"Hostname or IP address where the API should listen to"`
Port int `toml:"port" comment:"Port used by the API"`
}
AdminAPIConfig configuration for Administrative API
type AdminAPIResponse ¶
type AdminAPIResponse struct {
Data interface{} `json:"data"`
Message string `json:"message"`
Error string `json:"error"`
}
AdminAPIResponse standard structure to encode any response from the AdminAPI
func NewAdminAPIRespError ¶
func NewAdminAPIRespError(err error) *AdminAPIResponse
NewAdminAPIRespError creates a new response from an error
func NewAdminAPIRespErrorString ¶
func NewAdminAPIRespErrorString(err string) *AdminAPIResponse
NewAdminAPIRespErrorString creates a new error response from an error
func NewAdminAPIResponse ¶
func NewAdminAPIResponse(data interface{}) *AdminAPIResponse
NewAdminAPIResponse creates a new response from data
func (*AdminAPIResponse) ToJSON ¶
func (r *AdminAPIResponse) ToJSON() []byte
ToJSON serializes the response to JSON
func (*AdminAPIResponse) UnmarshalData ¶
func (r *AdminAPIResponse) UnmarshalData(i interface{}) error
UnmarshalData unmarshals the Data field of the response to an interface
type AdminAPIUser ¶
type AdminAPIUser struct {
sod.Item
Uuid string `json:"uuid" sod:"unique"`
Identifier string `json:"identifier" sod:"unique"`
Key string `json:"key,omitempty" sod:"unique"`
Group string `json:"group" sod:"index"`
Description string `json:"description"`
}
AdminAPIUser structure definition
type ArchivedReport ¶
type ClientConfig ¶
type ClientConfig struct {
Proto string `toml:"proto" comment:"Protocol to use to connect to manager (http or https)"`
Host string `toml:"host" comment:"Hostname or IP of the manager"`
Port int `toml:"port" comment:"Port at which endpoint API is running on manager server"`
UUID string `toml:"endpoint-uuid" comment:"Endpoint UUID configured on manager used to authenticate this endpoint"`
Key string `toml:"endpoint-key" comment:"Endpoint key configured on manager used to authenticate this endpoint"`
ServerKey string `` /* 203-byte string literal not displayed */
ServerFingerprint string `toml:"server-fingerprint" comment:"Configure manager certificate pinning\n Put here the manager's certificate fingerprint"`
Unsafe bool `toml:"unsafe" comment:"Allow unsafe HTTPS connection"`
MaxUploadSize int64 `toml:"max-upload-size" comment:"Maximum allowed upload size"`
// contains filtered or unexported fields
}
ClientConfig structure definition
func (*ClientConfig) DialContext ¶
func (*ClientConfig) DialTLSContext ¶
func (*ClientConfig) ManagerIP ¶
func (cc *ClientConfig) ManagerIP() net.IP
ManagerIP returns the IP address of the manager if any, returns nil otherwise
func (*ClientConfig) Transport ¶
func (cc *ClientConfig) Transport() http.RoundTripper
Transport creates an approriate HTTP transport from a configuration Cert pinning inspired by: https://medium.com/@zmanian/server-public-key-pinning-in-go-7a57bbe39438
type Command ¶
type Command struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Args []string `json:"args"`
// used to drop files on the endpoint
Drop []*EndpointFile `json:"drop"`
// used to fetch files from the endpoint
Fetch map[string]*EndpointFile `json:"fetch"`
Json interface{} `json:"json"`
Stdout []byte `json:"stdout"`
Stderr []byte `json:"stderr"`
Error string `json:"error"`
Sent bool `json:"sent"`
Background bool `json:"background"`
Completed bool `json:"completed"`
ExpectJSON bool `json:"expect-json"`
Timeout time.Duration `json:"timeout"`
SentTime time.Time `json:"sent-time"`
// contains filtered or unexported fields
}
Command structure representing a command sent to an endpoint
func (*Command) AddDropFile ¶
AddDropFile adds a file to drop on the endpoint. Argument filepath is the path of the file on the local filesystem
func (*Command) AddDropFileFromPath ¶
AddDropFileFromPath adds a file to drop on the endpoint. It is a wrapper around AddDropFile
func (*Command) AddFetchFile ¶
AddFetchFile adds a file to fetch from the endpoint.
func (*Command) FromExecCmd ¶
func (*Command) Run ¶
Run runs the command according to the specified settings it aims at being used on the endpoint
func (*Command) SetCommandLine ¶
SetCommandLine sets the command line to execute on the endpoint
func (*Command) Strip ¶
func (c *Command) Strip()
Strip reduces the command to the strict necessary fields to make the return trip from the endpoint to the manager
func (*Command) Unrunnable ¶
func (c *Command) Unrunnable()
type CommandAPI ¶
type CommandAPI struct {
CommandLine string `json:"command-line"`
FetchFiles []string `json:"fetch-files"`
DropFiles []string `json:"drop-files"`
Timeout time.Duration `json:"timeout"`
}
CommandAPI structure used by Admin API clients to POST commands
func (*CommandAPI) ToCommand ¶
func (c *CommandAPI) ToCommand() (*Command, error)
ToCommand converts a CommandAPI to a Command
type Endpoint ¶
type Endpoint struct {
sod.Item
Uuid string `json:"uuid" sod:"unique"`
Hostname string `json:"hostname"`
IP string `json:"ip"`
Group string `json:"group"`
Criticality int `json:"criticality"`
Key string `json:"key,omitempty"`
Command *Command `json:"command,omitempty"`
Score float64 `json:"score"`
Status string `json:"status"`
LastDetection time.Time `json:"last-detection"`
LastConnection time.Time `json:"last-connection"`
}
Endpoint structure used to track and interact with endpoints
func NewEndpoint ¶
NewEndpoint returns a new Endpoint structure
func (*Endpoint) UpdateLastConnection ¶
func (e *Endpoint) UpdateLastConnection()
UpdateLastConnection updates the LastConnection member of Endpoint structure
type EndpointAPIConfig ¶
type EndpointAPIConfig struct {
Host string `toml:"host" comment:"Hostname or IP where the API should listen to"`
Port int `toml:"port" comment:"Port used by the API"`
ServerKey string `` /* 162-byte string literal not displayed */
}
EndpointAPIConfig structure holding configuration for the API used by endpoints
type EndpointDumps ¶
type EndpointFile ¶
type EndpointFile struct {
UUID string `json:"uuid"`
Name string `json:"name"`
Data []byte `json:"data"`
Error string `json:"error"`
}
EndpointFile describes a File to drop or fetch from the endpoint
type Endpoints ¶
Endpoints structure used to manage endpoints This struct looks over complicated for what it does but it is because it was more complex before and got simplified (too lazy to change it...)
func (*Endpoints) GetMutByUUID ¶
GetMutByUUID returns reference to an Endpoint
func (*Endpoints) MutEndpoints ¶
MutEndpoints returns a list of references of the endpoints
type EventStreamer ¶
func NewEventStreamer ¶
func NewEventStreamer() *EventStreamer
func (*EventStreamer) NewStream ¶
func (s *EventStreamer) NewStream() *LogStream
func (*EventStreamer) Queue ¶
func (s *EventStreamer) Queue(e *event.EdrEvent)
type FileUpload ¶
type FileUpload struct {
Name string `json:"filename"`
GUID string `json:"guid"`
EventHash string `json:"event-hash"`
Content []byte `json:"content"`
Chunk int `json:"chunk"` // identify the chunk number
Total int `json:"total"` // total number of chunks needed to reconstruct the file
}
FileUpload structure used to forward files from the client to the manager
func (*FileUpload) Dump ¶
func (f *FileUpload) Dump(root string) (err error)
Dump dumps the FileUpload into the given root directory dir
func (*FileUpload) Implode ¶
func (f *FileUpload) Implode() string
Implode returns the full path of the FileUpload
func (*FileUpload) Validate ¶
func (f *FileUpload) Validate() error
Validate that the file upload follows the expected format
type Forwarder ¶
type Forwarder struct {
sync.Mutex
Client *ManagerClient
TimeTresh time.Duration
EventTresh uint64
Pipe *bytes.Buffer
EventsPiped uint64
Local bool
// contains filtered or unexported fields
}
Forwarder structure definition
func NewForwarder ¶
func NewForwarder(c *ForwarderConfig) (*Forwarder, error)
NewForwarder creates a new Forwarder structure Todo: needs update with client
func (*Forwarder) ArchiveLogs ¶
func (f *Forwarder) ArchiveLogs()
ArchiveLogs archives the old log files not compressed into compressed
func (*Forwarder) CleanOlderQueued ¶
CleanOlderQueued cleans up the older queue file
func (*Forwarder) Collect ¶
func (f *Forwarder) Collect()
Collect sends the piped event to the remote server Todo: needs update with client
func (*Forwarder) DiskSpaceQueue ¶
DiskSpaceQueue compute the disk space (in bytes) taken by queued events
func (*Forwarder) HasQueuedEvents ¶
HasQueuedEvents checks whether some events are waiting to be sent
func (*Forwarder) LogfilePath ¶
LogfilePath returns the path of the logfile if it exists else returns empty string
func (*Forwarder) PipeEvent ¶
func (f *Forwarder) PipeEvent(event interface{})
PipeEvent pipes an event to be sent through the forwarder
func (*Forwarder) ProcessQueue ¶
func (f *Forwarder) ProcessQueue()
ProcessQueue processes the events queued Todo: needs update with client
type ForwarderConfig ¶
type ForwarderConfig struct {
Local bool `` /* 127-byte string literal not displayed */
Client ClientConfig `toml:"manager" comment:"Configure connection to the manager"`
Logging LoggingConfig `toml:"logging" comment:"Forwarder's logging configuration"`
}
ForwarderConfig structure definition
type LoggingConfig ¶
type LoggingConfig struct {
Dir string `toml:"dir" comment:"Directory used to store logs"`
RotationInterval time.Duration `toml:"rotation-interval" comment:"Logfile rotation interval"`
}
LoggingConfig structure to encode Logging configuration of the forwarder
type Manager ¶
type Manager struct {
sync.RWMutex
/* Public */
Config *ManagerConfig
// contains filtered or unexported fields
}
Manager structure definition
func NewManager ¶
func NewManager(c *ManagerConfig) (*Manager, error)
NewManager creates a new WHIDS manager with a logfile as parameter
func (*Manager) AddCommand ¶
AddCommand sets a command to be executed on endpoint specified by UUID
func (*Manager) AddEndpoint ¶
AddEndpoint adds new endpoint to the manager
func (*Manager) Collect ¶
func (m *Manager) Collect(wt http.ResponseWriter, rq *http.Request)
Collect HTTP handler
func (*Manager) Command ¶
func (m *Manager) Command(wt http.ResponseWriter, rq *http.Request)
Command HTTP handler
func (*Manager) CreateNewAdminAPIUser ¶
func (m *Manager) CreateNewAdminAPIUser(user *AdminAPIUser) (err error)
CreateNewAdminAPIUser creates a new user in the user able to access admin API in database.
func (*Manager) GetCommand ¶
GetCommand gets the command set for an endpoint specified by UUID
func (*Manager) IoCsSha256 ¶
func (m *Manager) IoCsSha256(wt http.ResponseWriter, rq *http.Request)
func (*Manager) LoadGeneEngine ¶
LoadGeneEngine make the manager update the gene rules it has to serve
func (*Manager) Rules ¶
func (m *Manager) Rules(wt http.ResponseWriter, rq *http.Request)
Rules HTTP handler used to serve the rules
func (*Manager) RulesSha256 ¶
func (m *Manager) RulesSha256(wt http.ResponseWriter, rq *http.Request)
RulesSha256 returns the sha256 of the latest set of rules loaded into the manager
func (*Manager) ServerKey ¶
func (m *Manager) ServerKey(wt http.ResponseWriter, rq *http.Request)
ServerKey HTTP handler used to authenticate server on client side
func (*Manager) UpdateReducer ¶
UpdateReducer updates the reducer member of the Manager
func (*Manager) UploadDump ¶
func (m *Manager) UploadDump(wt http.ResponseWriter, rq *http.Request)
UploadDump HTTP handler used to upload dump files from client to manager
type ManagerClient ¶
type ManagerClient struct {
ManagerIP net.IP
HTTPClient http.Client
// contains filtered or unexported fields
}
ManagerClient structure definition
func NewManagerClient ¶
func NewManagerClient(c *ClientConfig) (*ManagerClient, error)
NewManagerClient creates a new Client to interface with the manager
func (*ManagerClient) Close ¶
func (m *ManagerClient) Close()
Close closes idle connections from underlying transport
func (*ManagerClient) FetchCommand ¶
func (m *ManagerClient) FetchCommand() (*Command, error)
func (*ManagerClient) GetIoCs ¶
func (m *ManagerClient) GetIoCs() ([]string, error)
GetIoCs get IoCs from manager
func (*ManagerClient) GetIoCsSha256 ¶
func (m *ManagerClient) GetIoCsSha256() (string, error)
GetIoCsSha256 retrieves a sha256 from the IoCs available in the manager
func (*ManagerClient) GetRules ¶
func (m *ManagerClient) GetRules() (string, error)
GetRules retrieve the latest batch of Gene rules available on the server
func (*ManagerClient) GetRulesSha256 ¶
func (m *ManagerClient) GetRulesSha256() (string, error)
GetRulesSha256 returns the sha256 string of the latest batch of rules available on the server
func (*ManagerClient) IsFileAboveUploadLimit ¶
func (m *ManagerClient) IsFileAboveUploadLimit(path string) bool
func (*ManagerClient) IsServerAuthEnforced ¶
func (m *ManagerClient) IsServerAuthEnforced() bool
IsServerAuthEnforced returns true if server authentication is requested by the client
func (*ManagerClient) IsServerAuthenticated ¶
func (m *ManagerClient) IsServerAuthenticated() (auth bool, up bool)
IsServerAuthenticated returns true if the server is authenticated and thus can be trusted
func (*ManagerClient) IsServerUp ¶
func (m *ManagerClient) IsServerUp() bool
IsServerUp returns true if manager server is up
func (*ManagerClient) PostCommand ¶
func (m *ManagerClient) PostCommand(command *Command) error
func (*ManagerClient) PostDump ¶
func (m *ManagerClient) PostDump(f *FileUpload) error
PostDump client helper to upload a file to the Manager
func (*ManagerClient) PostLogs ¶
func (m *ManagerClient) PostLogs(r io.Reader) error
PostLogs posts logs to be collected
func (*ManagerClient) PrepareGzip ¶
PrepareGzip prepares a http.Request gzip encoded to be sent to the manager
type ManagerConfig ¶
type ManagerConfig struct {
// TOML strings need to be first otherwise issue parsing back config
Database string `toml:"db" comment:"Path to store database"`
RulesDir string `toml:"rules-dir" comment:"Gene rule directory\n See: https://github.com/0xrawsec/gene-rules"`
DumpDir string `toml:"dump-dir" comment:"Directory where to dump artifacts collected on hosts"`
AdminAPI AdminAPIConfig `toml:"admin-api" comment:"Settings to configure administrative API (not supposed to be reachable by endpoints)"`
EndpointAPI EndpointAPIConfig `toml:"endpoint-api" comment:"Settings to configure API used by endpoints"`
Logging ManagerLogConfig `toml:"logging" comment:"Logging settings"`
TLS TLSConfig `toml:"tls" comment:"TLS settings. Leave empty, not to use TLS"`
// contains filtered or unexported fields
}
ManagerConfig defines manager's configuration structure
func LoadManagerConfig ¶
func LoadManagerConfig(path string) (*ManagerConfig, error)
LoadManagerConfig loads the manager configuration from a file
func (*ManagerConfig) AdminAPIUrl ¶
func (mc *ManagerConfig) AdminAPIUrl() string
EndpointAPIUrl returns the URL of the Admin API
func (*ManagerConfig) EndpointAPIUrl ¶
func (mc *ManagerConfig) EndpointAPIUrl() string
EndpointAPIUrl returns the URL of the Endpoint API
func (*ManagerConfig) Save ¶
func (mc *ManagerConfig) Save() error
Save saves the configuration to a path specified by the path member of the structure
func (*ManagerConfig) SetPath ¶
func (mc *ManagerConfig) SetPath(path string)
SetPath exposes the path member for changes
type ManagerLogConfig ¶
type ManagerLogConfig struct {
Root string `toml:"root" comment:"Root directory where logfiles are stored"`
LogBasename string `toml:"logfile" comment:"Logfile name (relative to root) used to store logs"`
VerboseHTTP bool `toml:"verbose-http" comment:"Enables verbose HTTP logs\n When disabled beaconing requests are filtered out"`
}
ManagerLogConfig structure to hold manager's logging configuration
type TLSConfig ¶
type TLSConfig struct {
Cert string `toml:"cert" comment:"Path to the certificate file to use for TLS connections"`
Key string `toml:"key" comment:"Path to the key to use for TLS connection"`
}
TLSConfig structure definition
type UploadShrinker ¶
type UploadShrinker struct {
// contains filtered or unexported fields
}
func NewUploadShrinker ¶
func NewUploadShrinker(path, guid, ehash string) (it *UploadShrinker, err error)
NewUploadShrinker creates a new object to shrink files to be uploaded to the manager
func (*UploadShrinker) Close ¶
func (i *UploadShrinker) Close() error
Close closes the underlying file
func (*UploadShrinker) Done ¶
func (i *UploadShrinker) Done() bool
Done returns true when all files have been sent
func (*UploadShrinker) Err ¶
func (i *UploadShrinker) Err() error
Err report any error encountered while iterating over Next
func (*UploadShrinker) Next ¶
func (i *UploadShrinker) Next() *FileUpload
Next returns the next FileUpload or nil if finished
func (*UploadShrinker) Size ¶
func (i *UploadShrinker) Size() int64
Size returns the size of the file to be shrinked