From 587c87b3a0d07ff2d0524b9f6c92ba17231ea256 Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Wed, 26 Apr 2017 13:49:18 +0900 Subject: [PATCH] Fix RHEL oval scan --- commands/util.go | 5 ++++- oval/redhat.go | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/commands/util.go b/commands/util.go index 775f26e0..057c1809 100644 --- a/commands/util.go +++ b/commands/util.go @@ -187,8 +187,11 @@ func fillCveInfoFromOvalDB(r models.ScanResult) (*models.ScanResult, error) { case "ubuntu", "debian": ovalClient = oval.NewDebian() fmt.Println("hello") - case "redhat", "centos": + case "rhel", "centos": ovalClient = oval.NewRedhat() + fmt.Println("good morning") + default: + return nil, fmt.Errorf("Oval %s is not implemented yet", r.Family) } result, err := ovalClient.FillCveInfoFromOvalDB(r) if err != nil { diff --git a/oval/redhat.go b/oval/redhat.go index 6cb795d5..e9fc9f36 100644 --- a/oval/redhat.go +++ b/oval/redhat.go @@ -35,7 +35,7 @@ func (o Redhat) FillCveInfoFromOvalDB(r models.ScanResult) (*models.ScanResult, d := db.NewRedHat() for _, pack := range r.Packages { - definitions, err := d.GetByPackName("6", pack.Name) + definitions, err := d.GetByPackName(r.Release, pack.Name) if err != nil { return nil, fmt.Errorf("Failed to get RedHat OVAL info by package name: %v", err) } @@ -86,6 +86,7 @@ func (o Redhat) fillOvalInfo(r models.ScanResult, definition ovalmodels.Definiti for cveID, found := range found { if !found { cves = append(cves, vulnInfos[cveID]) + util.Log.Debugf("%s is newly detected by OVAL", cveID) } } r.ScannedCves = cves