Documentation ¶
Index ¶
Constants ¶
const ( SecurityLevelOff uint8 = 0 SecurityLevelNormal uint8 = 1 SecurityLevelHigh uint8 = 2 SecurityLevelExtreme uint8 = 4 SecurityLevelsNormalAndHigh uint8 = SecurityLevelNormal | SecurityLevelHigh SecurityLevelsNormalAndExtreme uint8 = SecurityLevelNormal | SecurityLevelExtreme SecurityLevelsHighAndExtreme uint8 = SecurityLevelHigh | SecurityLevelExtreme SecurityLevelsAll uint8 = SecurityLevelNormal | SecurityLevelHigh | SecurityLevelExtreme StatusOff uint8 = 0 StatusError uint8 = 1 StatusWarning uint8 = 2 StatusOk uint8 = 3 )
Definitions of Security and Status Levels.
Variables ¶
This section is empty.
Functions ¶
func ActiveSecurityLevel ¶
func ActiveSecurityLevel() uint8
ActiveSecurityLevel returns the current security level.
func AddOrUpdateThreat ¶
func AddOrUpdateThreat(new *Threat)
AddOrUpdateThreat adds or updates a new threat in the system status.
func DeleteThreat ¶
func DeleteThreat(id string)
DeleteThreat deletes a threat from the system status.
func FmtActiveSecurityLevel ¶
func FmtActiveSecurityLevel() string
FmtActiveSecurityLevel returns the current security level as a string.
func FmtSecurityLevel ¶
FmtSecurityLevel returns the given security level as a string.
func SelectedSecurityLevel ¶
func SelectedSecurityLevel() uint8
SelectedSecurityLevel returns the selected security level.
Types ¶
type SecurityLevelOption ¶
SecurityLevelOption defines the returned function by ConfigIsActive.
func ConfigIsActive ¶
func ConfigIsActive(name string) SecurityLevelOption
ConfigIsActive returns whether the given security level dependent config option is on or off.
func ConfigIsActiveConcurrent ¶
func ConfigIsActiveConcurrent(name string) SecurityLevelOption
ConfigIsActiveConcurrent returns whether the given security level dependent config option is on or off and is concurrency safe.
type SystemStatus ¶
type SystemStatus struct { record.Base sync.Mutex ActiveSecurityLevel uint8 SelectedSecurityLevel uint8 OnlineStatus netenv.OnlineStatus CaptivePortal *netenv.CaptivePortal ThreatMitigationLevel uint8 Threats map[string]*Threat }
SystemStatus saves basic information about the current system status.
func EnsureSystemStatus ¶
func EnsureSystemStatus(r record.Record) (*SystemStatus, error)
EnsureSystemStatus ensures that the given record is of type SystemStatus and unwraps it, if needed.
func (*SystemStatus) Save ¶
func (s *SystemStatus) Save()
Save saves the SystemStatus to the database.
func (*SystemStatus) SaveAsync ¶ added in v0.4.13
func (s *SystemStatus) SaveAsync()
SaveAsync saves the SystemStatus to the database asynchronously.
type Threat ¶
type Threat struct { ID string // A unique ID chosen by reporting module (eg. modulePrefix-incident) to periodically check threat existence Name string // Descriptive (human readable) name for detected threat Description string // Simple description AdditionalData interface{} // Additional data a module wants to make available for the user MitigationLevel uint8 // Recommended Security Level to switch to for mitigation Started int64 Ended int64 }
Threat describes a detected threat.