|
|
|
@ -2,6 +2,7 @@ package sgfw
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"encoding/binary"
|
|
|
|
|
"fmt"
|
|
|
|
|
"net"
|
|
|
|
|
"strings"
|
|
|
|
|
"sync"
|
|
|
|
@ -71,7 +72,10 @@ func (dc *dnsCache) processDNS(pkt *nfqueue.NFQPacket) {
|
|
|
|
|
if pinfo == nil {
|
|
|
|
|
if !FirewallConfig.LogRedact {
|
|
|
|
|
log.Warningf("Skipping attempted DNS cache entry for process that can't be found: %v -> %v\n", q.Name, dns.answer)
|
|
|
|
|
} else {
|
|
|
|
|
dbLogger.logRedacted("default", fmt.Sprintf("Skipping attempted DNS cache entry for process that can't be found: %v -> %v\n", q.Name, dns.answer))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -82,7 +86,8 @@ func (dc *dnsCache) processDNS(pkt *nfqueue.NFQPacket) {
|
|
|
|
|
if !FirewallConfig.LogRedact {
|
|
|
|
|
log.Infof("Unhandled DNS message: %v", dns)
|
|
|
|
|
} else {
|
|
|
|
|
log.Infof("Unhandled DNS message [redacted]")
|
|
|
|
|
log.Infof("Unhandled DNS message: %s", STR_REDACTED)
|
|
|
|
|
dbLogger.logRedacted("default", fmt.Sprintf("Unhandled DNS message: %v", dns))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -128,6 +133,7 @@ func (dc *dnsCache) processRecordAddress(name string, answers []dnsRR, pid int)
|
|
|
|
|
log.Warningf("Unexpected RR type in answer section of A response: %v", rec)
|
|
|
|
|
} else {
|
|
|
|
|
log.Warningf("Unexpected RR type in answer section of A response: [redacted]")
|
|
|
|
|
dbLogger.logRedacted("default", fmt.Sprintf("Unexpected RR type in answer section of A response: %v", rec))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -159,6 +165,8 @@ func (dc *dnsCache) processRecordAddress(name string, answers []dnsRR, pid int)
|
|
|
|
|
}
|
|
|
|
|
if !FirewallConfig.LogRedact {
|
|
|
|
|
log.Infof("Adding %s: %s", name, ip)
|
|
|
|
|
} else {
|
|
|
|
|
dbLogger.logRedacted("default", fmt.Sprintf("Adding %s: %s", name, ip))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -183,6 +191,9 @@ func (dc *dnsCache) Lookup(ip net.IP, pid int) string {
|
|
|
|
|
if !FirewallConfig.LogRedact {
|
|
|
|
|
log.Warningf("Skipping expired per-pid (%d) DNS cache entry: %s -> %s / exp. %v (%ds)\n",
|
|
|
|
|
pid, ip.String(), entry.name, entry.exp, entry.ttl)
|
|
|
|
|
} else {
|
|
|
|
|
dbLogger.logRedacted("default", fmt.Sprintf("Skipping expired per-pid (%d) DNS cache entry: %s -> %s / exp. %v (%ds)\n",
|
|
|
|
|
pid, ip.String(), entry.name, entry.exp, entry.ttl))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -198,6 +209,9 @@ func (dc *dnsCache) Lookup(ip net.IP, pid int) string {
|
|
|
|
|
if !FirewallConfig.LogRedact {
|
|
|
|
|
log.Warningf("Skipping expired global DNS cache entry: %s -> %s / exp. %v (%ds)\n",
|
|
|
|
|
ip.String(), entry.name, entry.exp, entry.ttl)
|
|
|
|
|
} else {
|
|
|
|
|
dbLogger.logRedacted("default", fmt.Sprintf("Skipping expired global DNS cache entry: %s -> %s / exp. %v (%ds)\n",
|
|
|
|
|
ip.String(), entry.name, entry.exp, entry.ttl))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|