Skip to content

Commit

Permalink
Merge pull request #176 from future-architect/add_sudo_check_to_prepare
Browse files Browse the repository at this point in the history
Add sudo check to prepare subcommand
  • Loading branch information
kotakanbe authored Sep 13, 2016
2 parents 00c0354 + 8a8ac5f commit 1b85e56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions commands/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ func (p *PrepareCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{
logger.Info("Detecting OS... ")
scan.InitServers(logger)

logger.Info("Checking sudo configuration... ")
if err := scan.CheckIfSudoNoPasswd(logger); err != nil {
logger.Errorf("Failed to sudo with nopassword via SSH. Define NOPASSWD in /etc/sudoers on target servers")
return subcommands.ExitFailure
}

logger.Info("Installing...")
if errs := scan.Prepare(); 0 < len(errs) {
for _, e := range errs {
Expand Down
2 changes: 1 addition & 1 deletion scan/serverapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func detectContainerOSesOnServer(containerHost osTypeInterface) (oses []osTypeIn

// CheckIfSudoNoPasswd checks whether vuls can sudo with nopassword via SSH
func CheckIfSudoNoPasswd(localLogger *logrus.Entry) error {
timeoutSec := 1 * 15
timeoutSec := 15
errs := parallelSSHExec(func(o osTypeInterface) error {
return o.checkIfSudoNoPasswd()
}, timeoutSec)
Expand Down

0 comments on commit 1b85e56

Please sign in to comment.