Documentation
¶
Index ¶
- Constants
- func ActiveSecurityLevel() uint8
- func AddOrUpdateThreat(new *Threat)
- func DeleteThreat(id string)
- func FmtActiveSecurityLevel() string
- func FmtSecurityLevel(level uint8) string
- func Gate17Status() uint8
- func PortmasterStatus() uint8
- func SelectedSecurityLevel() uint8
- func SetGate17Status(g17Status uint8, msg string)
- func SetPortmasterStatus(pmStatus uint8, msg string)
- func SetUpdateStatus(newStatus string)
- type SecurityLevelOption
- type SystemStatus
- type Threat
Constants ¶
const ( SecurityLevelOff uint8 = 0 SecurityLevelDynamic uint8 = 1 SecurityLevelSecure uint8 = 2 SecurityLevelFortress uint8 = 4 SecurityLevelsDynamicAndSecure uint8 = SecurityLevelDynamic | SecurityLevelSecure SecurityLevelsDynamicAndFortress uint8 = SecurityLevelDynamic | SecurityLevelFortress SecurityLevelsSecureAndFortress uint8 = SecurityLevelSecure | SecurityLevelFortress SecurityLevelsAll uint8 = SecurityLevelDynamic | SecurityLevelSecure | SecurityLevelFortress StatusOff uint8 = 0 StatusError uint8 = 1 StatusWarning uint8 = 2 StatusOk uint8 = 3 )
Definitions of Security and Status Levels
const ( UpdateStatusCurrentStable = "stable" UpdateStatusCurrentBeta = "beta" UpdateStatusAvailable = "available" // restart or reboot required UpdateStatusFailed = "failed" // check logs )
Update status options
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 PortmasterStatus ¶
func PortmasterStatus() uint8
PortmasterStatus returns the current Portmaster status.
func SelectedSecurityLevel ¶
func SelectedSecurityLevel() uint8
SelectedSecurityLevel returns the selected security level.
func SetGate17Status ¶
SetGate17Status sets the current Gate17 status.
func SetPortmasterStatus ¶
SetPortmasterStatus sets the current Portmaster status.
func SetUpdateStatus ¶
func SetUpdateStatus(newStatus string)
SetUpdateStatus updates the system status with a new update status.
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
PortmasterStatus uint8
PortmasterStatusMsg string
Gate17Status uint8
Gate17StatusMsg string
ThreatMitigationLevel uint8
Threats map[string]*Threat
UpdateStatus string
}
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
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.