Fix RHEL oval scan

This commit is contained in:
Kota Kanbe
2017-04-26 13:49:18 +09:00
committed by kota kanbe
parent 1a319859eb
commit 587c87b3a0
2 changed files with 6 additions and 2 deletions

View File

@@ -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 {

View File

@@ -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