diff --git a/report/util.go b/report/util.go index f9ee7ed1..8ef9aa53 100644 --- a/report/util.go +++ b/report/util.go @@ -378,7 +378,7 @@ func isCveInfoUpdated(cveID string, previous, current models.ScanResult) bool { } } for _, cType := range cTypes { - if equal := prevLastModified[cType].Equal(curLastModified[cType]); !equal { + if !prevLastModified[cType].Equal(curLastModified[cType]) { return true } } diff --git a/scan/redhat.go b/scan/redhat.go index 712f25dd..d6ea08ed 100644 --- a/scan/redhat.go +++ b/scan/redhat.go @@ -78,6 +78,28 @@ func detectRedhat(c config.ServerInfo) (itsMe bool, red osTypeInterface) { } } + // https://bugzilla.redhat.com/show_bug.cgi?id=1332025 + // CentOS cloud image + if r := exec(c, "ls /etc/centos-release", noSudo); r.isSuccess() { + if r := exec(c, "cat /etc/centos-release", noSudo); r.isSuccess() { + re := regexp.MustCompile(`(.*) release (\d[\d\.]*)`) + result := re.FindStringSubmatch(strings.TrimSpace(r.Stdout)) + if len(result) != 3 { + util.Log.Warn("Failed to parse CentOS version: %s", r) + return true, red + } + + release := result[2] + switch strings.ToLower(result[1]) { + case "centos", "centos linux": + red.setDistro(config.CentOS, release) + return true, red + default: + util.Log.Warn("Failed to parse CentOS: %s", r) + } + } + } + if r := exec(c, "ls /etc/redhat-release", noSudo); r.isSuccess() { // https://www.rackaid.com/blog/how-to-determine-centos-or-red-hat-version/ // e.g.