Skip to content

Commit

Permalink
add support for crown jewel policies
Browse files Browse the repository at this point in the history
Add support for generating lenient policies protecting sensitive assets (mount points here)

Signed-off-by: Ankur Kothiwal <[email protected]>
  • Loading branch information
Ankurk99 committed Jun 7, 2023
1 parent abe7d0b commit 136df30
Show file tree
Hide file tree
Showing 8 changed files with 480 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/conf/local-file.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ recommend:
cron-job-time-interval: "1h0m00s" # format: XhYmZs
recommend-host-policy: true

# Recommended policies configuration
crownjewel:
operation-mode: 1 # 1: cronjob | 2: one-time-job
cron-job-time-interval: "1h0m00s" # format: XhYmZs

# license
license:
enabled: false
Expand Down
5 changes: 5 additions & 0 deletions src/conf/local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ recommend:
cron-job-time-interval: "1h0m00s" # format: XhYmZs
recommend-host-policy: true

# Recommended policies configuration
crownjewel:
operation-mode: 1 # 1: cronjob | 2: one-time-job
cron-job-time-interval: "1h0m00s" # format: XhYmZs

# license
license:
enabled: false
Expand Down
26 changes: 26 additions & 0 deletions src/config/configManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ func LoadConfigFromFile() {
RecommendAdmissionControllerPolicy: viper.GetBool("recommend.admission-controller-policy"),
}

// crown jewel policy configurations
CurrentCfg.ConfigCrownjewelPolicy = types.ConfigCrownjewelPolicy{
CronJobTimeInterval: "@every " + viper.GetString("crownjewel.cron-job-time-interval"),
OneTimeJobTimeSelection: "", // e.g., 2021-01-20 07:00:23|2021-01-20 07:00:25
OperationMode: viper.GetInt("crownjewel.operation-mode"),
}

// load database
CurrentCfg.ConfigDB = LoadConfigDB()

Expand Down Expand Up @@ -524,3 +531,22 @@ func GetCfgRecommendHostPolicy() bool {
func GetCfgRecommendAdmissionControllerPolicy() bool {
return CurrentCfg.ConfigRecommendPolicy.RecommendAdmissionControllerPolicy
}

// ================================== //
// == Get Crown Jewel Config Info == //
// ================================ //

// run the Crown jewel scan once
func GetCfgCrownjewelOneTime() string {
return CurrentCfg.ConfigCrownjewelPolicy.OneTimeJobTimeSelection
}

// run the Crown jewel scan as a cron job
func GetCfgCrownjewelCronJobTime() string {
return CurrentCfg.ConfigCrownjewelPolicy.CronJobTimeInterval
}

// dont' run the Crown jewel scan
func GetCfgCrownjewelOperationMode() int {
return CurrentCfg.ConfigCrownjewelPolicy.OperationMode
}
Loading

0 comments on commit 136df30

Please sign in to comment.