refactor(scan): remove yum-security related code (#836)
* refactor(scan): remove yum-security related code * fix(reporting): error if no OVAL entry
This commit is contained in:
62
scan/rhel.go
62
scan/rhel.go
@@ -53,47 +53,11 @@ func (o *rhel) depsFastRoot() []string {
|
||||
if o.getServerInfo().Mode.IsOffline() {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
majorVersion, _ := o.Distro.MajorVersion()
|
||||
switch majorVersion {
|
||||
case 5:
|
||||
return []string{
|
||||
"yum-utils",
|
||||
"yum-security",
|
||||
}
|
||||
case 6:
|
||||
return []string{
|
||||
"yum-utils",
|
||||
"yum-plugin-security",
|
||||
}
|
||||
default:
|
||||
return []string{
|
||||
"yum-utils",
|
||||
}
|
||||
}
|
||||
return []string{"yum-utils"}
|
||||
}
|
||||
|
||||
func (o *rhel) depsDeep() []string {
|
||||
majorVersion, _ := o.Distro.MajorVersion()
|
||||
switch majorVersion {
|
||||
case 5:
|
||||
return []string{
|
||||
"yum-utils",
|
||||
"yum-security",
|
||||
"yum-changelog",
|
||||
}
|
||||
case 6:
|
||||
return []string{
|
||||
"yum-utils",
|
||||
"yum-plugin-security",
|
||||
"yum-plugin-changelog",
|
||||
}
|
||||
default:
|
||||
return []string{
|
||||
"yum-utils",
|
||||
"yum-plugin-changelog",
|
||||
}
|
||||
}
|
||||
return o.depsFastRoot()
|
||||
}
|
||||
|
||||
func (o *rhel) checkIfSudoNoPasswd() error {
|
||||
@@ -118,25 +82,17 @@ func (o *rhel) sudoNoPasswdCmdsFastRoot() []cmd {
|
||||
majorVersion, _ := o.Distro.MajorVersion()
|
||||
if majorVersion < 6 {
|
||||
return []cmd{
|
||||
// {"needs-restarting", exitStatusZero},
|
||||
{"yum repolist --color=never", exitStatusZero},
|
||||
{"yum list-security --security --color=never", exitStatusZero},
|
||||
{"yum info-security --color=never", exitStatusZero},
|
||||
{"repoquery -h", exitStatusZero},
|
||||
}
|
||||
}
|
||||
return []cmd{
|
||||
{"yum repolist --color=never", exitStatusZero},
|
||||
{"yum updateinfo list updates --security --color=never", exitStatusZero},
|
||||
{"yum updateinfo updates --security --color=never ", exitStatusZero},
|
||||
{"repoquery -h", exitStatusZero},
|
||||
{"needs-restarting", exitStatusZero},
|
||||
}
|
||||
}
|
||||
|
||||
func (o *rhel) sudoNoPasswdCmdsDeep() []cmd {
|
||||
return append(o.sudoNoPasswdCmdsFastRoot(),
|
||||
cmd{"yum changelog all updates --color=never", exitStatusZero})
|
||||
return o.sudoNoPasswdCmdsFastRoot()
|
||||
}
|
||||
|
||||
type rootPrivRHEL struct{}
|
||||
@@ -145,18 +101,6 @@ func (o rootPrivRHEL) repoquery() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (o rootPrivRHEL) yumRepolist() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (o rootPrivRHEL) yumUpdateInfo() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (o rootPrivRHEL) yumChangelog() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (o rootPrivRHEL) yumMakeCache() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user