Documentation ¶
Index ¶
- Constants
- Variables
- func CpeSearch(pkgInfo PkgInfo) (vulnIdList []int64)
- func DealBaselineList(agentBaseline AgentBaseline) []mongo.WriteModel
- func DealPkgList(pkgInfoList []PkgInfo) []mongo.WriteModel
- func HBAsyncWrite(value interface{})
- func HubAlarmAsyncWrite(value interface{})
- func HubAssetAsyncWrite(value interface{})
- func KubeAlarmAsyncWrite(value interface{})
- func LeaderBaselineAsyncWrite(value interface{})
- func LeaderRaspAsyncWrite(value interface{})
- func LeaderVulnAsyncWrite(value interface{})
- func RaspAlarmAsyncWrite(value interface{})
- func SubTaskAsyncWrite(value interface{})
- func SubTaskUpdateAsyncWrite(value interface{})
- func VirusDetectionAsyncWrite(value interface{})
- type AgentBaseline
- type AgentBaselineInfo
- type AgentCacheStruct
- type AgentVulnInfo
- type AgentVulnSoftInfo
- type BaselineCheckInfo
- type BaselineGroupStatus
- type BaselineInfo
- type BaselineStatus
- type BaselineTaskStatus
- type CheckInfo
- type CheckSumRes
- type CpeCacheStruct
- type CpeInfo
- type DBWriter
- type PkgInfo
- type RaspConfig
- type RaspConfigRule
- type RaspHeartBeat
- type RaspProbeStruct
- type VulnCacheStruct
- type VulnInfoLess
Constants ¶
View Source
const ( SendTimeWeightSec = 15 SendCountWeight = 1000 KeyAgentHB = "key_agentHB" KeyAgentSubTask = "key_agentSubTask" KeyAgentSubTaskUpdate = "key_agentSubTask_update" KeyHubAlarmUpdate = "key_hub_alarm" KeyHubAssetUpdate = "key_hub_asset" KeyLeaderVulnUpdate = "key_leader_vuln" KeyLeaderBaselineUpdate = "key_leader_baseline" KeyLeaderRaspUpdate = "key_leader_rasp" KeyRaspAlarmUpdate = "key_rasp_alarm" KeyKubeAlarmUpdate = "key_kube_alarm" KeyVirusDetectionUpdate = "key_virus_detection" )
View Source
const ( BaselineStatusPassed = "passed" BaselineStatusFailed = "failed" BaselineStatusError = "error" )
View Source
const ( VulnStatusUnProcessed = "unprocessed" VulnStatusIgnored = "ignored" VulnDropStatusUse = "using" VulnActionBlock = "block" CacheTimeout = 24 * time.Hour VulnCacheTimeout = 24 * time.Hour MuchVulnAgent = 2000 )
View Source
const ( RaspHB2997 = "2997" RaspConfig2996 = "2996" )
Variables ¶
View Source
var ( AgentHBOnce sync.Once AgentSubTaskOnce sync.Once AgentSubTaskUpdateOnce sync.Once HubAlarmOnce sync.Once HubAssetOnce sync.Once LeaderVulnOnce sync.Once LeaderBaselineOnce sync.Once LeaderRaspOnce sync.Once RaspAlarmOnce sync.Once KubeAlarmOnce sync.Once VirusDetectionOne sync.Once )
View Source
var ( CpeCache *cache2go.CacheTable VulnCache *cache2go.CacheTable IfLargeAgentCache *cache2go.CacheTable )
Functions ¶
func DealBaselineList ¶
func DealBaselineList(agentBaseline AgentBaseline) []mongo.WriteModel
处理基线信息,返回需要处理的mongo语句列表
func DealPkgList ¶
func DealPkgList(pkgInfoList []PkgInfo) []mongo.WriteModel
处理软件包列表,返回需要处理的mongo语句列表
func HBAsyncWrite ¶
func HBAsyncWrite(value interface{})
func HubAlarmAsyncWrite ¶
func HubAlarmAsyncWrite(value interface{})
func HubAssetAsyncWrite ¶
func HubAssetAsyncWrite(value interface{})
func KubeAlarmAsyncWrite ¶
func KubeAlarmAsyncWrite(value interface{})
func LeaderBaselineAsyncWrite ¶
func LeaderBaselineAsyncWrite(value interface{})
func LeaderRaspAsyncWrite ¶
func LeaderRaspAsyncWrite(value interface{})
func LeaderVulnAsyncWrite ¶
func LeaderVulnAsyncWrite(value interface{})
func RaspAlarmAsyncWrite ¶
func RaspAlarmAsyncWrite(value interface{})
func SubTaskAsyncWrite ¶
func SubTaskAsyncWrite(value interface{})
func SubTaskUpdateAsyncWrite ¶
func SubTaskUpdateAsyncWrite(value interface{})
func VirusDetectionAsyncWrite ¶
func VirusDetectionAsyncWrite(value interface{})
Types ¶
type AgentBaseline ¶
type AgentBaseline struct { AgentId string `json:"agent_id" bson:"agent_id"` Data BaselineInfo `json:"data" bson:"data"` DataType string `json:"data_type" bson:"data_type"` }
type AgentBaselineInfo ¶
type AgentBaselineInfo struct { AgentId string `json:"agent_id" bson:"agent_id"` BaselineId int `json:"baseline_id" bson:"baseline_id"` BaselineVersion string `json:"baseline_version" bson:"baseline_version"` CheckId int `json:"check_id" bson:"check_id"` Type string `json:"type" bson:"type"` CheckName string `json:"check_name" bson:"check_name"` Description string `json:"description" bson:"description"` Solution string `json:"solution" bson:"solution"` TypeCn string `json:"type_cn" bson:"type_cn"` CheckNameCn string `json:"check_name_cn" bson:"check_name_cn"` DescriptionCn string `json:"description_cn" bson:"description_cn"` SolutionCn string `json:"solution_cn" bson:"solution_cn"` CheckLevel string `json:"check_level" bson:"check_level"` Status string `json:"status" bson:"status"` CreateTime int64 `json:"create_time" bson:"create_time"` UpdateTime int64 `json:"update_time" bson:"update_time"` IfWhite bool `json:"if_white" bson:"if_white"` WhiteReason string `json:"white_reason" bson:"white_reason"` ErrReason string `json:"err_reason" bson:"err_reason"` TaskStatus string `json:"task_status" bson:"task_status"` Hostname string `json:"hostname" bson:"hostname"` Tags []string `json:"tags" bson:"tags"` ExtranetIpv4 []string `json:"extranet_ipv4" bson:"extranet_ipv4"` IntranetIpv4 []string `json:"intranet_ipv4" bson:"intranet_ipv4"` }
type AgentCacheStruct ¶
type AgentCacheStruct struct { AgentId string `json:"agent_id" bson:"agent_id"` Hostname string `json:"hostname" bson:"hostname"` Tags []string `json:"tags" bson:"tags"` ExtranetIpv4 []string `json:"extranet_ipv4" bson:"extranet_ipv4"` IntranetIpv4 []string `json:"intranet_ipv4" bson:"intranet_ipv4"` }
agent缓存结构体
func AgentInfoSearch ¶
func AgentInfoSearch(agentId string) (agentInfo AgentCacheStruct)
获取agent信息(带缓存机制)
type AgentVulnInfo ¶
type AgentVulnInfo struct { AgentId string `json:"agent_id" bson:"agent_id"` VulnId int64 `json:"vuln_id" bson:"vuln_id"` CveId string `json:"cve_id" bson:"cve_id"` Status string `json:"status" bson:"status"` Level string `json:"level" bson:"level"` CreateTime int64 `json:"create_time" bson:"create_time"` UpdateTime int64 `json:"update_time" bson:"update_time"` ControlTime int64 `json:"control_time" bson:"control_time"` DropStatus string `json:"drop_status" bson:"drop_status"` Action string `json:"action" bson:"action"` OperateReason string `json:"operate_reason" bson:"operate_reason"` }
type AgentVulnSoftInfo ¶
type AgentVulnSoftInfo struct { AgentId string `json:"agent_id" bson:"agent_id"` VulnId int64 `json:"vuln_id" bson:"vuln_id"` Type string `json:"type" bson:"type"` PackageName string `json:"software_name" bson:"package_name"` PackageVersion string `json:"software_version" bson:"package_version"` PackageSource string `json:"software_source" bson:"package_source"` PackagePath string `json:"software_path" bson:"package_path"` ContainerName string `json:"container_name" bson:"container_name"` ContainerId string `json:"container_id" bson:"container_id"` Cmdline string `json:"cmdline" bson:"cmdline"` UpdateTime int64 `json:"update_time" bson:"update_time"` PidList []struct { Pid string `json:"pid" bson:"pid"` Cmd string `json:"cmd" bson:"cmd"` } `json:"pid_list" bson:"pid_list"` }
type BaselineCheckInfo ¶
type BaselineCheckInfo struct { CheckId int `json:"check_id" bson:"check_id"` Type string `json:"type" bson:"type"` Title string `json:"title" bson:"title"` Description string `json:"description" bson:"description"` Solution string `json:"solution" bson:"solution"` Security string `json:"security" bson:"security"` TitleCn string `json:"title_cn" bson:"title_cn"` TypeCn string `json:"type_cn" bson:"type_cn"` DescriptionCn string `json:"description_cn" bson:"description_cn"` SolutionCn string `json:"solution_cn" bson:"solution_cn"` }
type BaselineGroupStatus ¶
type BaselineGroupStatus struct { GroupId int `json:"group_id" bson:"group_id"` BaselineList []int `json:"baseline_list" bson:"baseline_list"` LastCheckTime int64 `json:"last_check_time" bson:"last_check_time"` Status string `json:"status" bson:"status"` }
基线策略组状态
type BaselineInfo ¶
type BaselineStatus ¶
type BaselineStatus struct { BaselineId int `json:"baseline_id" bson:"baseline_id"` BaselineName string `json:"baseline_name" bson:"baseline_name"` CheckNum int `json:"check_num" bson:"check_num"` LastCheckTime int64 `json:"last_check_time" bson:"last_check_time"` Status string `json:"status" bson:"status"` }
基线状态
type BaselineTaskStatus ¶
type BaselineTaskStatus struct { AgentId string `json:"agent_id" bson:"agent_id"` BaselineId int `json:"baseline_id" bson:"baseline_id"` LastCheckTime int64 `json:"last_check_time" bson:"last_check_time"` HighRiskNum int `json:"high_risk_num" bson:"high_risk_num"` MediumRiskNum int `json:"medium_risk_num" bson:"medium_risk_num"` LowRiskNum int `json:"low_risk_num" bson:"low_risk_num"` PassNum int `json:"pass_num" bson:"pass_num"` Status string `json:"status" bson:"status"` Msg string `json:"msg" bson:"msg"` Hostname string `json:"hostname" bson:"hostname"` Tags []string `json:"tags" bson:"tags"` ExtranetIpv4 []string `json:"extranet_ipv4" bson:"extranet_ipv4"` IntranetIpv4 []string `json:"intranet_ipv4" bson:"intranet_ipv4"` }
基线主机任务状态
type CheckInfo ¶
type CheckInfo struct { BaselineId int `yaml:"baseline_id" bson:"baseline_id" json:"baseline_id"` CheckId int `yaml:"check_id" bson:"check_id" json:"check_id"` BaselineCheck string `yaml:"baseline_check" bson:"baseline_check" json:"baseline_check"` Type string `yaml:"type" bson:"type" json:"type"` Title string `yaml:"title" bson:"title" json:"title"` Description string `yaml:"description" bson:"description" json:"description"` Solution string `yaml:"solution" bson:"solution" json:"solution"` Security string `yaml:"security" bson:"security" json:"security"` TitleCn string `yaml:"title_cn" bson:"title_cn" json:"title_cn"` TypeCn string `yaml:"type_cn" bson:"type_cn" json:"type_cn"` DescriptionCn string `yaml:"description_cn" bson:"description_cn" json:"description_cn"` SolutionCn string `yaml:"solution_cn" bson:"solution_cn" json:"solution_cn"` UpdateTime int64 `yaml:"update_time" bson:"update_time" json:"update_time"` Result int `json:"result" bson:"result"` Msg string `json:"msg" bson:"msg"` }
type CheckSumRes ¶
type CheckSumRes struct {
CheckSum string `json:"checksum" bson:"checksum"`
}
type CpeCacheStruct ¶
type CpeCacheStruct struct {
VulnIdList []int64
}
type CpeInfo ¶
type CpeInfo struct { VulnId int64 `json:"vuln_id" bson:"vuln_id"` CpeName string `json:"cpe_name" bson:"cpe_product"` CpeVersion string `json:"cpe_version" bson:"cpe_version"` VersionEndExcluding string `json:"versionEndExcluding" bson:"versionEndExcluding"` VersionEndIncluding string `json:"versionEndIncluding" bson:"versionEndIncluding"` VersionStartExcluding string `json:"versionStartExcluding" bson:"versionStartExcluding"` VersionStartIncluding string `json:"versionStartIncluding" bson:"versionStartIncluding"` }
type PkgInfo ¶
type PkgInfo struct { AgentId string `json:"agent_id" bson:"agent_id"` PackageSeq string `json:"package_seq" bson:"package_seq"` Type string `json:"type" bson:"type"` Token string `json:"token" bson:"token"` Name string `json:"name" bson:"name"` Version string `json:"sversion" bson:"version"` Source string `json:"source" bson:"source"` Status string `json:"status" bson:"status"` Vendor string `json:"vendor" bson:"vendor"` Cmdline string `json:"cmdline" bson:"cmdline"` Pid string `json:"pid" bson:"pid"` Path string `json:"path" bson:"path"` ContainerName string `json:"container_name" bson:"container_name"` ContainerId string `json:"container_id" bson:"container_id"` }
type RaspConfig ¶
type RaspConfig struct { Id primitive.ObjectID `json:"id" bson:"_id,omitempty"` User string `json:"user" bson:"user"` IfProtect bool `json:"if_protect" bson:"if_protect"` IpList []string `json:"ip_list" bson:"ip_list"` Tag string `json:"tag" bson:"tag"` Cmd string `json:"cmd" bson:"cmd"` EnvList []string `json:"env_list" bson:"env_list"` AliveTime int `json:"alive_time" bson:"alive_time"` Runtime []string `json:"runtime" bson:"runtime"` Block []RaspConfigRule `json:"block" bson:"block"` Filter []RaspConfigRule `json:"filter" bson:"filter"` EnvJson map[string]string `json:"env_json" bson:"env_json"` BlockUuid string `json:"block_uuid" bson:"block_uuid"` FilterUuid string `json:"filter_uuid" bson:"filter_uuid"` LimitUuid string `json:"limit_uuid" bson:"limit_uuid"` PatchUuid string `json:"patch_uuid" bson:"patch_uuid"` TaskStr string `json:"task_str" bson:"task_str"` }
type RaspConfigRule ¶
type RaspConfigRule struct { Runtime string `json:"runtime" bson:"runtime"` HookFunc []string `json:"hook_func" bson:"hook_func"` HookParam int `json:"hook_param" bson:"hook_param"` Rules []struct { Type string `json:"type" bson:"type"` Rule string `json:"rule" bson:"rule"` } `json:"rules" bson:"rules"` }
type RaspHeartBeat ¶
type RaspHeartBeat struct { Pid string `json:"pid" bson:"pid"` AgentId string `json:"agent_id" bson:"agent_id"` Runtime string `json:"runtime" bson:"runtime"` ExeName string `json:"exe_name" bson:"exe_name"` TraceState string `json:"trace_state" bson:"trace_state"` }
rasp心跳key数据
type RaspProbeStruct ¶
type RaspProbeStruct struct { Pid string `json:"pid" bson:"pid"` AgentId string `json:"agent_id" bson:"agent_id"` Filter string `json:"filter" bson:"filter"` Block string `json:"block" bson:"block"` Limit string `json:"limit" bson:"limit"` Patch string `json:"patch" bson:"patch"` }
rasp探针key数据
type VulnCacheStruct ¶
type VulnCacheStruct struct {
VulnInfoList []VulnInfoLess
}
type VulnInfoLess ¶
type VulnInfoLess struct { Id int64 `json:"id" bson:"id"` PublishedTime int64 `json:"published_time" bson:"published_time"` Severity string `json:"severity" bson:"severity"` Cve string `json:"cve" bson:"cve"` VulnNameEn string `json:"vuln_name_en" bson:"title_en"` Action string `json:"action" bson:"action"` Score int64 }
Click to show internal directories.
Click to hide internal directories.