From 8117f76ab583bb05347ffe80467b45d0f5ab175f Mon Sep 17 00:00:00 2001 From: arjundashrath <54043589+arjundashrath@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:27:48 +0530 Subject: [PATCH 1/4] Update log.go --- log.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/log.go b/log.go index 2c26108..2d35241 100644 --- a/log.go +++ b/log.go @@ -22,7 +22,7 @@ func WriteLog(message string) { if message == "\n" { f.WriteString(fmt.Sprintf("\n")) } else{ - f.WriteString(fmt.Sprintf("%s:%s\n", time.Now().String(), message)) + f.WriteString(fmt.Sprintf("%s:%s\n", time.Now().Format("Mon, 02 Jan 2006 15:04:05 MST"), message)) } From 613506056cd6caea18bc405aab1cca056f9242a4 Mon Sep 17 00:00:00 2001 From: arjundashrath <54043589+arjundashrath@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:31:40 +0530 Subject: [PATCH 2/4] Update agent.go --- agent.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/agent.go b/agent.go index 0e5b5e3..c8e02b4 100644 --- a/agent.go +++ b/agent.go @@ -66,9 +66,11 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer, apiclient := &ApiClient{Client: &http.Client{}, APIURL: config.APIURL} // TODO: pass in an iowriter/ use log library - WriteLog(fmt.Sprintf("read config %v", config)) + WriteLog(fmt.Sprintf("read config \n %v", config)) + WriteLog("\n") WriteLog(fmt.Sprintf("%s %s", StepSecurityLogCorrelationPrefix, config.CorrelationId)) + WriteLog("\n") Cache := InitCache(config.EgressPolicy) @@ -125,6 +127,7 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer, return err } + WriteLog("\n") WriteLog("updated resolved") // Change DNS for docker, causes process in containers to use agent's DNS proxy @@ -134,7 +137,8 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer, return err } - WriteLog("set docker config") + WriteLog("\n") + WriteLog("set docker config\n") if config.EgressPolicy == EgressPolicyAudit { netMonitor := NetworkMonitor{ @@ -159,7 +163,9 @@ func Run(ctx context.Context, configFilePath string, hostDNSServer DNSServer, WriteLog("added audit rules") } else if config.EgressPolicy == EgressPolicyBlock { + WriteLog("\n") WriteLog(fmt.Sprintf("Allowed domains:%v", config.Endpoints)) + WriteLog("\n") netMonitor := NetworkMonitor{ CorrelationId: config.CorrelationId, @@ -206,6 +212,7 @@ func refreshDNSEntries(ctx context.Context, iptables *Firewall, allowedEndpoints case <-ctx.Done(): return case <-ticker.C: + WriteLog("\n") WriteLog("Refreshing DNS entries") for domainName, endpoints := range allowedEndpoints { element, found := dnsProxy.Cache.Get(domainName) From 495a4d882c4d5bc29d7446f141026999e0158a97 Mon Sep 17 00:00:00 2001 From: arjundashrath <54043589+arjundashrath@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:32:26 +0530 Subject: [PATCH 3/4] Update eventhandler.go --- eventhandler.go | 1 + 1 file changed, 1 insertion(+) diff --git a/eventhandler.go b/eventhandler.go index edd168b..999de16 100644 --- a/eventhandler.go +++ b/eventhandler.go @@ -41,6 +41,7 @@ func (eventHandler *EventHandler) handleFileEvent(event *Event) { } if strings.Contains(event.FileName, "post_event.json") { + WriteLog("\n") WriteLog("post_event called") // send done signal to post step From 6e50df23e7c53c1d55f974318dec23145cc6d2ca Mon Sep 17 00:00:00 2001 From: arjundashrath <54043589+arjundashrath@users.noreply.github.com> Date: Mon, 7 Feb 2022 13:33:19 +0530 Subject: [PATCH 4/4] Update procmon_linux.go --- procmon_linux.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/procmon_linux.go b/procmon_linux.go index 128477c..4d5a1bc 100644 --- a/procmon_linux.go +++ b/procmon_linux.go @@ -17,6 +17,7 @@ import ( ) func (p *ProcessMonitor) MonitorProcesses(errc chan error) { + WriteLog("\n") WriteLog("Monitor Processes called") client, err := libaudit.NewAuditClient(nil) @@ -104,6 +105,7 @@ func (p *ProcessMonitor) MonitorProcesses(errc chan error) { } WriteLog("receive called") + WriteLog("\n") p.receive(client) }