diff --git a/src/systempolicy/systemPolicy.go b/src/systempolicy/systemPolicy.go index 80a1fede..f59df21f 100644 --- a/src/systempolicy/systemPolicy.go +++ b/src/systempolicy/systemPolicy.go @@ -168,7 +168,6 @@ type SysLogKey struct { // ================ // func getSystemLogs() []types.KnoxSystemLog { - cfgDB := types.ConfigDB{} systemLogs := []types.KnoxSystemLog{} if SystemLogFrom == "file" { @@ -200,9 +199,9 @@ func getSystemLogs() []types.KnoxSystemLog { } // raw json --> knoxSystemLog - if cfgDB.DBDriver == "mysql" { + if CfgDB.DBDriver == "mysql" { systemLogs = plugin.ConvertMySQLKubeArmorLogsToKnoxSystemLogs(jsonLogs) - } else if cfgDB.DBDriver == "sqlite3" { + } else if CfgDB.DBDriver == "sqlite3" { systemLogs = plugin.ConvertSQLiteKubeArmorLogsToKnoxSystemLogs(jsonLogs) } @@ -632,21 +631,25 @@ The aim of the foll API is to merge multiple fromSources within the same policy. For e.g., ---[Input]--- - matchPaths: - - path: /etc/ld.so.cache - fromSource: - - path: /bin/ls - - path: /etc/ld.so.cache - fromSource: - - path: /bin/sleep + + matchPaths: + - path: /etc/ld.so.cache + fromSource: + - path: /bin/ls + - path: /etc/ld.so.cache + fromSource: + - path: /bin/sleep + --- ---[Expected Output]--- - matchPaths: - - path: /etc/ld.so.cache - fromSource: - - path: /bin/ls - - path: /bin/sleep + + matchPaths: + - path: /etc/ld.so.cache + fromSource: + - path: /bin/ls + - path: /bin/sleep + --- */ func mergeFromSource(pols []types.KnoxSystemPolicy) []types.KnoxSystemPolicy { @@ -1231,7 +1234,6 @@ func removeDuplicates(arr []string) []string { // GenFileSetForAllPodsInCluster Generate process specific fileset across all pods in a cluster func GenFileSetForAllPodsInCluster(clusterName string, pods []types.Pod, settype string, slogs []types.KnoxSystemLog) bool { - cfgDB := types.ConfigDB{} res := types.ResourceSetMap{} // key: WorkloadProcess - val: Accesss File Set wpfs := types.WorkloadProcessFileSet{} isNetworkOp := false @@ -1294,10 +1296,10 @@ func GenFileSetForAllPodsInCluster(clusterName string, pods []types.Pod, settype } else { if !reflect.DeepEqual(mergedfs, out[wpfs]) { log.Info().Msgf("updating wpfs db entry for wpfs=%+v", wpfs) - if cfgDB.DBDriver == "mysql" { + if CfgDB.DBDriver == "mysql" { err = libs.UpdateWorkloadProcessFileSetMySQL(CfgDB, wpfs, mergedfs) status = true - } else if cfgDB.DBDriver == "sqlite3" { + } else if CfgDB.DBDriver == "sqlite3" { err = libs.UpdateWorkloadProcessFileSetSQLite(CfgDB, wpfs, mergedfs) status = true }