Documentation
¶
Index ¶
- Constants
- func MakeDebugPolicy() policyMatcher
- func MakeDisabledPolicy() policyMatcher
- func MakeProductionPolicy() policyMatcher
- func NewPolicyAll(mm ...policyMatcher) policyMatcher
- func NewPolicyAny(mm ...policyMatcher) policyMatcher
- func NewPolicyMatchAction(aa ...string) policyMatcher
- func NewPolicyMatchRequestOrigin(rr ...string) policyMatcher
- func NewPolicyMatchResource(rr ...string) policyMatcher
- func NewPolicyMatchSeverity(ss ...Severity) policyMatcher
- func NewPolicyNegate(m policyMatcher) policyMatcher
- func NewPolicyNone() policyMatcher
- func NewService(s actionlogStore, logger, tee *zap.Logger, policy policyMatcher) (svc *service)
- func RequestOriginFromContext(ctx context.Context) string
- func RequestOriginToContext(ctx context.Context, origin string) context.Context
- type Action
- type ActionSet
- type Filter
- type Meta
- type Recorder
- type Severity
Constants ¶
const ( RequestOrigin_APP_Init = "app/init" RequestOrigin_APP_Upgrade = "app/upgrade" RequestOrigin_APP_Activate = "app/activate" RequestOrigin_APP_Provision = "app/provision" RequestOrigin_APP_Run = "app/run" RequestOrigin_API_REST = "api/rest" RequestOrigin_API_GRPC = "api/grpc" RequestOrigin_Auth = "auth" RequestOrigin_Automation = "automation" )
Variables ¶
This section is empty.
Functions ¶
func MakeDebugPolicy ¶
func MakeDebugPolicy() policyMatcher
func MakeDisabledPolicy ¶
func MakeDisabledPolicy() policyMatcher
func MakeProductionPolicy ¶
func MakeProductionPolicy() policyMatcher
func NewPolicyAll ¶
func NewPolicyAll(mm ...policyMatcher) policyMatcher
NewPolicyAll returns policy where all sub-policies should match
func NewPolicyAny ¶
func NewPolicyAny(mm ...policyMatcher) policyMatcher
NewPolicyAny returns policy where at least one of the sub-policies should match
func NewPolicyMatchAction ¶
func NewPolicyMatchAction(aa ...string) policyMatcher
NewPolicyMatchAction matches action
func NewPolicyMatchRequestOrigin ¶
func NewPolicyMatchRequestOrigin(rr ...string) policyMatcher
NewPolicyMatchRequestOrigin matches resources
func NewPolicyMatchResource ¶
func NewPolicyMatchResource(rr ...string) policyMatcher
NewPolicyMatchResource matches resources
func NewPolicyMatchSeverity ¶
func NewPolicyMatchSeverity(ss ...Severity) policyMatcher
NewPolicyMatchSeverity matches severity
func NewPolicyNegate ¶
func NewPolicyNegate(m policyMatcher) policyMatcher
NewPolicyNegate negates passed policy
func NewService ¶
NewService initializes action log service
func RequestOriginFromContext ¶
RequestOriginFromContext returns remote IP address from context
Types ¶
type Action ¶
type Action struct {
ID uint64 `json:"actionID,string"`
// Timestamp of the raised event
Timestamp time.Time `json:"timestamp"`
// Origin of the action (rest-api, cli, grpc, system)
RequestOrigin string `json:"requestOrigin"`
// Request ID
RequestID string `json:"requestID"`
// This can contain a series of IP addresses (when proxied)
// https://en.wikipedia.org/wiki/X-Forwarded-For#Format
ActorIPAddr string `json:"actorIPAddr"`
// ID of the user (if not anonymous)
ActorID uint64 `json:"actorID,string"`
// Resource
Resource string `json:"resource"`
// Type of action
Action string `json:"action"`
// Error, if any
Error string `json:"error"`
// Action severity
Severity Severity `json:"severity"`
// Description of the event
Description string `json:"description"`
// Meta data, resource specific values
Meta Meta `json:"meta"`
}
Standardized data structure for audit log events
type ActionSet ¶
type ActionSet []*Action
ActionSet slice of Action
This type is auto-generated.
func (ActionSet) Filter ¶
Filter iterates through every slice item, calls f(Action) (bool, err) and return filtered slice
This function is auto-generated.
func (ActionSet) FindByID ¶
FindByID finds items from slice by its ID property
This function is auto-generated.
type Filter ¶
type Filter struct {
FromTimestamp *time.Time `json:"from"`
ToTimestamp *time.Time `json:"to"`
BeforeActionID uint64 `json:"beforeActionID"`
ActorID []string `json:"actorID"`
Origin string `json:"origin"`
Resource string `json:"resource"`
Action string `json:"action"`
Limit uint `json:"limit"`
// Standard helpers for sorting
filter.Sorting
}
type Meta ¶
type Meta map[string]interface{}
Any additional data that can be packed with the raised audit event
type Severity ¶
type Severity uint8
Severity determinants event severity level
const ( Emergency Severity = iota Alert Critical Error Warning Notice Info Debug ActionResourceType = "corteza::generic:action" )
Severity constants
not using log/syslog LOG_* constants as they are only available outside windows env.