future-architect/vuls


Do you want to work on this issue?
You can request for a bounty in order to promote it!
"user" keyword not working in config.toml #1455
barszpaw posted onGitHub
What did you do?
scan remote host by ssh using username specified in config.toml
[default]
port = "22"
user = "scanuser"
keyPath = "/home/vuls/.ssh/id_rsa"
scanMode = ["deep"]
scanModules = ["ospkg"]
sshConfigPath = "/home/vuls/.ssh/config"
[servers]
[servers.my-server]
host = "my-server"
What did you expect to happen?
scan via ssh with username scanuser those differ from current linux user vuls
What happened instead?
Command vuls scan use $USER env as user for ssh login
- Current Output
vuls@vuls:~$ vuls scan -debug [May 3 01:25:46] INFO [localhost] vuls-v0.19.7-build-20220502_215403_91ed318 [May 3 01:25:46] INFO [localhost] Start scanning [May 3 01:25:46] INFO [localhost] config: /home/vuls/config.toml [May 3 01:25:46] DEBUG [localhost] map[string]config.ServerInfo{ "my-server": config.ServerInfo{ ServerName: "my-server", User: "scanuser", Host: "my-server", JumpServer: []string{}, Port: "22", SSHConfigPath: "/home/vuls/.ssh/config", KeyPath: "/home/vuls/.ssh/id_rsa", CpeNames: []string{}, ScanMode: []string{ "deep", }, ScanModules: []string{ "ospkg", }, OwaspDCXMLPath: "", ContainersOnly: false, ContainersIncluded: []string{}, ContainersExcluded: []string{}, ContainerType: "", Containers: map[string]config.ContainerSetting{}, IgnoreCves: []string{}, IgnorePkgsRegexp: []string{}, GitHubRepos: map[string]config.GitHubConf{}, UUIDs: map[string]string{}, Memo: "", Enablerepo: []string{}, Optional: map[string]interface {}{}, Lockfiles: []string{}, FindLock: false, Type: "", IgnoredJSONKeys: []string{}, WordPress: &config.WordPressConf{ OSUser: "", DocRoot: "", CmdPath: "", }, PortScan: &config.PortScanConf{ IsUseExternalScanner: false, ScannerBinPath: "", HasPrivileged: false, ScanTechniques: []string{}, SourcePort: "", }, IPv4Addrs: []string{}, IPv6Addrs: []string{}, IPSIdentifiers: map[string]string{}, LogMsgAnsiColor: "\x1b[32m", Container: config.Container{ ContainerID: "", Name: "", Image: "", }, Distro: config.Distro{ Family: "", Release: "", }, Mode: config.ScanMode{ flag: 0x04, }, Module: config.ScanModule{ flag: 0x01, }, }, } [May 3 01:25:46] INFO [localhost] Validating config... [May 3 01:25:46] INFO [localhost] Detecting Server/Container OS... [May 3 01:25:46] INFO [localhost] Detecting OS of servers... [May 3 01:25:46] DEBUG [localhost] Validating SSH Settings for Server:my-server ... [May 3 01:25:46] DEBUG [localhost] Executing... /usr/bin/ssh -G -F /home/vuls/.ssh/config -p 22 -l scanuser my-server [May 3 01:25:46] DEBUG [localhost] Setting SSH User:scanuser for Server:my-server ... [May 3 01:25:46] DEBUG [localhost] Setting SSH Port:22 for Server:my-server ... [May 3 01:25:46] DEBUG [localhost] Executing... ls /etc/debian_version vuls@my-server's password: [May 3 01:25:50] DEBUG [localhost] Executing... ls /etc/debian_version vuls@my-server's password:
Steps to reproduce the behaviour
use as config.toml these content:
[default]
port = "22"
user = "scanuser"
keyPath = "/home/vuls/.ssh/id_rsa"
scanMode = ["deep"]
scanModules = ["ospkg"]
sshConfigPath = "/home/vuls/.ssh/config"
[servers]
[servers.my-server]
host = "my-server"
and as 'vuls' username try scan remote host with username "scanuser" ( remote username should exists on remote host )
Configuration
Go version (
go version
):go version go1.18.1 linux/amd64
Go environment (
go env
):GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/vuls/.cache/go-build" GOENV="/home/vuls/.config/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/home/vuls/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/vuls/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GOVCS="" GOVERSION="go1.18.1" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/dev/null" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1279271044=/tmp/go-build -gno-record-gcc-switches"
To check the commit hash of HEAD $ vuls -v vuls-v0.19.7-build-20220502_215403_91ed318
- config.toml:
[default]
port = "22"
user = "scanuser"
keyPath = "/home/vuls/.ssh/id_rsa"
scanMode = ["deep"]
scanModules = ["ospkg"]
sshConfigPath = "/home/vuls/.ssh/config"
[servers]
[servers.my-server]
host = "my-server"
- command:
vuls scan