fix(rocky): fix Scan in Rocky Linux (#1266)

* fix(rocky): fix OVAL scan in Rocky Linux

* chore: add FreeBSD13 EOL, fix #1245

* chore(rocky): add Rocky Linux EOL tests

* feat(rocky): implement with reference to CentOS

* feat(raspbian): add Raspbian to Server mode

* feat(rocky): support gost scan

* fix(rocky): rocky support lessThan

* chore: update doc and comment
This commit is contained in:
Norihiro NAKAOKA
2021-07-08 05:39:48 +09:00
committed by GitHub
parent 0ea4d58c63
commit 0bf12412d6
17 changed files with 577 additions and 38 deletions

View File

@@ -49,7 +49,7 @@ func (o *centos) depsFast() []string {
}
// repoquery
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8, Rocky8
return []string{"yum-utils"}
}
@@ -59,7 +59,7 @@ func (o *centos) depsFastRoot() []string {
}
// repoquery
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8, Rocky8
return []string{"yum-utils"}
}

View File

@@ -100,10 +100,14 @@ func detectRedhat(c config.ServerInfo) (bool, osTypeInterface) {
release := result[2]
switch strings.ToLower(result[1]) {
case "centos", "centos linux":
case "centos", "centos linux", "centos stream":
cent := newCentOS(c)
cent.setDistro(constant.CentOS, release)
return true, cent
case "rocky", "rocky linux":
rocky := newRocky(c)
rocky.setDistro(constant.Rocky, release)
return true, rocky
default:
// RHEL
rhel := newRHEL(c)
@@ -476,7 +480,7 @@ func (o *redhatBase) isExecNeedsRestarting() bool {
// TODO zypper ps
// https://github.com/future-architect/vuls/issues/696
return false
case constant.RedHat, constant.CentOS, constant.Oracle:
case constant.RedHat, constant.CentOS, constant.Rocky, constant.Oracle:
majorVersion, err := o.Distro.MajorVersion()
if err != nil || majorVersion < 6 {
o.log.Errorf("Not implemented yet: %s, err: %+v", o.Distro, err)
@@ -655,7 +659,7 @@ func (o *redhatBase) rpmQf() string {
func (o *redhatBase) detectEnabledDnfModules() ([]string, error) {
switch o.Distro.Family {
case constant.RedHat, constant.CentOS:
case constant.RedHat, constant.CentOS, constant.Rocky:
//TODO OracleLinux
default:
return nil, nil

View File

@@ -55,7 +55,7 @@ func (o *rhel) depsFastRoot() []string {
}
// repoquery
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8, Rocky8
return []string{"yum-utils"}
}

View File

@@ -11,7 +11,7 @@ type rocky struct {
redhatBase
}
// NewAmazon is constructor
// NewRocky is constructor
func newRocky(c config.ServerInfo) *rocky {
r := &rocky{
redhatBase{
@@ -49,7 +49,7 @@ func (o *rocky) depsFast() []string {
}
// repoquery
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8, Rocky
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8, Rocky8
return []string{"yum-utils"}
}
@@ -59,7 +59,7 @@ func (o *rocky) depsFastRoot() []string {
}
// repoquery
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8, Rocky
// `rpm -qa` shows dnf-utils as yum-utils on RHEL8, CentOS8, Rocky8
return []string{"yum-utils"}
}

View File

@@ -211,12 +211,14 @@ func ParseInstalledPkgs(distro config.Distro, kernel models.Kernel, pkgList stri
var osType osTypeInterface
switch distro.Family {
case constant.Debian, constant.Ubuntu:
case constant.Debian, constant.Ubuntu, constant.Raspbian:
osType = &debian{base: base}
case constant.RedHat:
osType = &rhel{redhatBase: redhatBase{base: base}}
case constant.CentOS:
osType = &centos{redhatBase: redhatBase{base: base}}
case constant.Rocky:
osType = &rocky{redhatBase: redhatBase{base: base}}
case constant.Oracle:
osType = &oracle{redhatBase: redhatBase{base: base}}
case constant.Amazon:

View File

@@ -26,7 +26,7 @@ func isRunningKernel(pack models.Package, family string, kernel models.Kernel) (
}
return false, false
case constant.RedHat, constant.Oracle, constant.CentOS, constant.Amazon:
case constant.RedHat, constant.Oracle, constant.CentOS, constant.Rocky, constant.Amazon:
switch pack.Name {
case "kernel", "kernel-devel", "kernel-core", "kernel-modules", "kernel-uek":
ver := fmt.Sprintf("%s-%s.%s", pack.Version, pack.Release, pack.Arch)