Merge pull request #300 from knqyf263/use_assumeno
Use --assumeno option
This commit is contained in:
@@ -603,9 +603,9 @@ configtest:
|
||||
|
||||
スキャン対象サーバ上の`/etc/sudoers`のサンプル
|
||||
|
||||
- CentOS, RHEL, Amazon Linux
|
||||
- CentOS, RHEL, Amazon Linux (CentOS 5の場合は`/bin/echo`も必要)
|
||||
```
|
||||
vuls ALL=(root) NOPASSWD: /usr/bin/yum, /bin/echo
|
||||
vuls ALL=(root) NOPASSWD: /usr/bin/yum (, /bin/echo)
|
||||
```
|
||||
- Ubuntu, Debian
|
||||
```
|
||||
|
||||
@@ -606,9 +606,9 @@ configtest:
|
||||
And also, configtest subcommand checks sudo settings on target servers whether Vuls is able to SUDO with nopassword via SSH.
|
||||
|
||||
Example of /etc/sudoers on target servers
|
||||
- CentOS, RHEL
|
||||
- CentOS, RHEL (CentOS 5 needs also `/bin/echo`)
|
||||
```
|
||||
vuls ALL=(root) NOPASSWD: /usr/bin/yum, /bin/echo
|
||||
vuls ALL=(root) NOPASSWD: /usr/bin/yum (, /bin/echo)
|
||||
```
|
||||
- Ubuntu, Debian
|
||||
```
|
||||
|
||||
@@ -97,8 +97,13 @@ func detectRedhat(c config.ServerInfo) (itsMe bool, red osTypeInterface) {
|
||||
}
|
||||
|
||||
func (o *redhat) checkIfSudoNoPasswd() error {
|
||||
majorVersion, err := o.Distro.MajorVersion()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Not implemented yet: %s, err: %s", o.Distro, err)
|
||||
}
|
||||
|
||||
cmd := "yum --version"
|
||||
if o.Distro.Family == "centos" {
|
||||
if o.Distro.Family == "centos" && majorVersion < 6 {
|
||||
cmd = "echo N | " + cmd
|
||||
}
|
||||
r := o.exec(cmd, o.sudo())
|
||||
@@ -532,7 +537,7 @@ func (o *redhat) getAllChangelog(packInfoList models.PackageInfoList) (stdout st
|
||||
packageNames += fmt.Sprintf("%s ", packInfo.Name)
|
||||
}
|
||||
|
||||
command := "echo N | "
|
||||
command := ""
|
||||
if 0 < len(config.Conf.HTTPProxy) {
|
||||
command += util.ProxyEnv()
|
||||
}
|
||||
@@ -544,6 +549,15 @@ func (o *redhat) getAllChangelog(packInfoList models.PackageInfoList) (stdout st
|
||||
if config.Conf.SkipBroken {
|
||||
yumopts += " --skip-broken"
|
||||
}
|
||||
|
||||
// CentOS 5 does not have --assumeno option.
|
||||
majorVersion, _ := o.Distro.MajorVersion()
|
||||
if majorVersion < 6 {
|
||||
command = "echo N | " + command
|
||||
} else {
|
||||
yumopts += " --assumeno"
|
||||
}
|
||||
|
||||
// yum update --changelog doesn't have --color option.
|
||||
command += fmt.Sprintf(" LANGUAGE=en_US.UTF-8 yum %s --changelog update ", yumopts) + packageNames
|
||||
|
||||
|
||||
Reference in New Issue
Block a user