Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix-typo #574

Merged
merged 1 commit into from
Oct 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions src/systempolicy/systemPolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ type SysLogKey struct {
// ================ //

func getSystemLogs() []types.KnoxSystemLog {
cfgDB := types.ConfigDB{}
systemLogs := []types.KnoxSystemLog{}

if SystemLogFrom == "file" {
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down