Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scan): skip wordpress scan for preudo servers #1142

Merged
merged 1 commit into from
Jan 20, 2021
Merged

Conversation

kotakanbe
Copy link
Member

@kotakanbe kotakanbe commented Jan 20, 2021

What did you implement:

Scan with the following config.toml, vuls connects via ssh and issues wp command, which results in an error.

[default]
  [default.wordpress]
    osUser = "hoge"
    docRoot = "/path"
    cmdPath = "fuga"

[servers]
[servers.localgem]
type = "pseudo"
lockfiles = [
  "/home/ubuntu/work/redmine/gem1/Gemfile.lock"
]
[Jan 21 06:28:24] DEBUG [localhost] execResult: servername: localgem
  cmd: /usr/bin/ssh -tt -o StrictHostKeyChecking=yes -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=auto -o ControlPath=/home/ubuntu/.vuls/controlmaster-%r-localgem.%p -o Controlpersist=10m @ -p  stty cols 1000; sudo -u hoge -i -- fuga cli version --allow-root
  exitstatus: 255
  stdout: 
  stderr: usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]
           [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
           [user@]hostname [command]
  err: %!s(<nil>)
[Jan 21 06:28:24] ERROR [localhost] Error on localgem, err: [Failed to scan WordPress:
    github.com/future-architect/vuls/scan.GetScanResults.func1
        /home/ubuntu/go/src/github.com/future-architect/vuls/scan/serverapi.go:646
  - Failed to exec `sudo -u hoge -i -- fuga cli version --allow-root`. Check the OS user, command path of wp-cli, DocRoot and permission: &config.WordPressConf{OSUser:"hoge", DocRoot:"/path", CmdPath:"fuga"}:
    github.com/future-architect/vuls/scan.(*base).scanWordPress
        /home/ubuntu/go/src/github.com/future-architect/vuls/scan/base.go:633]
Scan Summary
================
localgem        Error           Use configtest subcommand or scan with --debug to view the details

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

scan works fine with the above config.toml

Checklist:

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

@kotakanbe kotakanbe merged commit b20d2b2 into master Jan 20, 2021
@kotakanbe kotakanbe deleted the ssh-255 branch January 28, 2021 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant