-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
feat(server): Apply filters for IgnoreCves and PkgsRegexps on server mode #1270
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the template for the config.toml generated by the discover command. There is no example of ignorePkgsRegexp
here. I would like to have it added.
Lines 80 to 238 in f0b3a8b
# https://vuls.io/docs/en/config.toml.html#database-section | |
[cveDict] | |
#type = ["sqlite3", "mysql", "postgres", "redis", "http" ] | |
#sqlite3Path = "/path/to/cve.sqlite3" | |
#url = "" | |
[ovalDict] | |
#type = ["sqlite3", "mysql", "postgres", "redis", "http" ] | |
#sqlite3Path = "/path/to/oval.sqlite3" | |
#url = "" | |
[gost] | |
#type = ["sqlite3", "mysql", "postgres", "redis", "http" ] | |
#sqlite3Path = "/path/to/gost.sqlite3" | |
#url = "" | |
[exploit] | |
#type = ["sqlite3", "mysql", "postgres", "redis", "http" ] | |
#sqlite3Path = "/path/to/go-exploitdb.sqlite3" | |
#url = "" | |
[metasploit] | |
#type = ["sqlite3", "mysql", "postgres", "redis", "http" ] | |
#sqlite3Path = "/path/to/go-msfdb.sqlite3" | |
#url = "" | |
# https://vuls.io/docs/en/config.toml.html#slack-section | |
#[slack] | |
#hookURL = "https://hooks.slack.com/services/abc123/defghijklmnopqrstuvwxyz" | |
##legacyToken = "xoxp-11111111111-222222222222-3333333333" | |
#channel = "#channel-name" | |
##channel = "${servername}" | |
#iconEmoji = ":ghost:" | |
#authUser = "username" | |
#notifyUsers = ["@username"] | |
# https://vuls.io/docs/en/config.toml.html#email-section | |
#[email] | |
#smtpAddr = "smtp.example.com" | |
#smtpPort = "587" | |
#user = "username" | |
#password = "password" | |
#from = "[email protected]" | |
#to = ["[email protected]"] | |
#cc = ["[email protected]"] | |
#subjectPrefix = "[vuls]" | |
# https://vuls.io/docs/en/config.toml.html#http-section | |
#[http] | |
#url = "http://localhost:11234" | |
# https://vuls.io/docs/en/config.toml.html#syslog-section | |
#[syslog] | |
#protocol = "tcp" | |
#host = "localhost" | |
#port = "514" | |
#tag = "vuls" | |
#facility = "local0" | |
#severity = "alert" | |
#verbose = false | |
# https://vuls.io/docs/en/usage-report.html#example-put-results-in-s3-bucket | |
#[aws] | |
#profile = "default" | |
#region = "ap-northeast-1" | |
#s3Bucket = "vuls" | |
#s3ResultsDir = "/path/to/result" | |
#s3ServerSideEncryption = "AES256" | |
# https://vuls.io/docs/en/usage-report.html#example-put-results-in-azure-blob-storage<Paste> | |
#[azure] | |
#accountName = "default" | |
#accountKey = "xxxxxxxxxxxxxx" | |
#containerName = "vuls" | |
# https://vuls.io/docs/en/config.toml.html#chatwork-section | |
#[chatwork] | |
#room = "xxxxxxxxxxx" | |
#apiToken = "xxxxxxxxxxxxxxxxxx" | |
# https://vuls.io/docs/en/config.toml.html#googlechat-section | |
#[googlechat] | |
#webHookURL = "https://chat.googleapis.com/v1/spaces/xxxxxxxxxx/messages?key=yyyyyyyyyy&token=zzzzzzzzzz%3D" | |
#skipIfNoCve = false | |
#serverNameRegexp = "^(\\[Reboot Required\\] )?((spam|ham).*|.*(egg)$)" # include spamonigiri, hamburger, boiledegg | |
#serverNameRegexp = "^(\\[Reboot Required\\] )?(?:(spam|ham).*|.*(?:egg)$)" # exclude spamonigiri, hamburger, boiledegg | |
# https://vuls.io/docs/en/config.toml.html#telegram-section | |
#[telegram] | |
#chatID = "xxxxxxxxxxx" | |
#token = "xxxxxxxxxxxxxxxxxx" | |
#[wpscan] | |
#token = "xxxxxxxxxxx" | |
#detectInactive = false | |
# https://vuls.io/docs/en/config.toml.html#default-section | |
[default] | |
#port = "22" | |
#user = "username" | |
#keyPath = "/home/username/.ssh/id_rsa" | |
#scanMode = ["fast", "fast-root", "deep", "offline"] | |
#scanModules = ["ospkg", "wordpress", "lockfile", "port"] | |
#cpeNames = [ | |
# "cpe:/a:rubyonrails:ruby_on_rails:4.2.1", | |
#] | |
#owaspDCXMLPath = "/tmp/dependency-check-report.xml" | |
#ignoreCves = ["CVE-2014-6271"] | |
#containersOnly = false | |
#containerType = "docker" #or "lxd" or "lxc" default: docker | |
#containersIncluded = ["${running}"] | |
#containersExcluded = ["container_name_a"] | |
# https://vuls.io/docs/en/config.toml.html#servers-section | |
[servers] | |
{{- $names:= .Names}} | |
{{range $i, $ip := .IPs}} | |
[servers.{{index $names $i}}] | |
host = "{{$ip}}" | |
#port = "22" | |
#user = "root" | |
#sshConfigPath = "/home/username/.ssh/config" | |
#keyPath = "/home/username/.ssh/id_rsa" | |
#scanMode = ["fast", "fast-root", "deep", "offline"] | |
#scanModules = ["ospkg", "wordpress", "lockfile", "port"] | |
#type = "pseudo" | |
#memo = "DB Server" | |
#cpeNames = [ "cpe:/a:rubyonrails:ruby_on_rails:4.2.1" ] | |
#owaspDCXMLPath = "/path/to/dependency-check-report.xml" | |
#ignoreCves = ["CVE-2014-0160"] | |
#containersOnly = false | |
#containerType = "docker" #or "lxd" or "lxc" default: docker | |
#containersIncluded = ["${running}"] | |
#containersExcluded = ["container_name_a"] | |
#[servers.{{index $names $i}}.containers.container_name_a] | |
#cpeNames = [ "cpe:/a:rubyonrails:ruby_on_rails:4.2.1" ] | |
#owaspDCXMLPath = "/path/to/dependency-check-report.xml" | |
#ignoreCves = ["CVE-2014-0160"] | |
#[servers.{{index $names $i}}.githubs."owner/repo"] | |
#token = "yourToken" | |
#ignoreGitHubDismissed = false | |
#[servers.{{index $names $i}}.wordpress] | |
#cmdPath = "/usr/local/bin/wp" | |
#osUser = "wordpress" | |
#docRoot = "/path/to/DocumentRoot/" | |
#[servers.{{index $names $i}}.portscan] | |
#scannerBinPath = "/usr/bin/nmap" | |
#hasPrivileged = true | |
#scanTechniques = ["sS"] | |
#sourcePort = "65535" | |
#[servers.{{index $names $i}}.optional] | |
#key = "value1" | |
{{end}} |
There is little description of ignorePkgsRegexp
even in vulsdoc/vuls. In particular, there is no explanation in the config.toml section. I would like to see the explanation added here as well.
Here are the links to the parts that I need clarification on. However, I suspect that these are not all the parts that need to be explained, so please add explanations where you think they are needed.
https://github.com/vulsdoc/vuls/blob/47f6cedb39ef59f823e06ecd5cd1b98d8d91272f/docs/configtoml.md
https://github.com/vulsdoc/vuls/blob/47f6cedb39ef59f823e06ecd5cd1b98d8d91272f/docs/usage-automatic-discovery.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I look at the options for server mode, I see -ignore-unscored-cves
and -ignore-unfixed
. Can't you also support this?
$ vuls server -h
...
-ignore-unfixed
Don't show the unfixed CVEs
-ignore-unscored-cves
Don't Server the unscored CVEs
...
The report seems to be handled as follows.
Line 136 in f0b3a8b
r.ScannedCves = r.ScannedCves.FilterUnfixed(config.Conf.IgnoreUnfixed) |
Lines 156 to 159 in f0b3a8b
// IgnoreUnscored | |
if config.Conf.IgnoreUnscoredCves { | |
r.ScannedCves = r.ScannedCves.FindScoredVulns() | |
} |
what exactly do you want me to implement here? |
I am sorry that my English is not good enough to convey my intentions. There are three tasks that I would like you to do in this PR. The first is to add an example of |
Thanks for the reply! <3
Your English is totally fine!! i just wanted more context which you added for me! thanks!
I would love to work on this so ill try to fix the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, thanks for the PR to vulsdoc/vuls.
I saw commit:93729c6e73fef787c2d349e1ee1a404a32824d6c.
Thanks for the implementation of -ignore-unscored-cves
and -ignore-unfixed
.
I commented on the implementation questions.
Also, please write how you verified this feature and the results in the PR section How Has This Been Tested?
.
The first is to add an example of ignorePkgsRegexp to the discover command.
Please add #ignorePkgsRegexp = ["^kernel", "^python"]
below the link line.
f.BoolVar(&config.Conf.IgnoreUnscoredCves, "ignore-unscored-cves", false, | ||
"Don't Server the unscored CVEs") | ||
|
||
f.BoolVar(&config.Conf.IgnoreUnfixed, "ignore-unfixed", false, | ||
f.BoolVar(&p.ignoreUnfixed, "ignore-unfixed", false, | ||
"Don't show the unfixed CVEs") | ||
|
||
f.BoolVar(&p.ignoreUnscoredCves, "ignore-unscored-cves", false, | ||
"Don't show the unscored CVEs") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you add it to serverCmd to manage option states instead of config.Conf.IgnoreUnfixed
and config.Conf.IgnoreUnscoredCves
.
https://github.com/qwexvf/vuls/blob/93729c6e73fef787c2d349e1ee1a404a32824d6c/config/config.go#L77-L78
r.ScannedCves = r.ScannedCves.FilterIgnorePkgs(ignorePkgsRegexps) | ||
|
||
// IgnoreUnfixed | ||
r.ScannedCves = r.ScannedCves.FilterUnfixed(h.IgnoreUnfixed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it possible to use config.Conf.IgnoreUnfixed
?
r.ScannedCves = r.ScannedCves.FilterUnfixed(h.IgnoreUnfixed) | ||
|
||
// IgnoreUnscoredCves | ||
if h.IgnoreUnscoredCves { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it possible to use config.Conf.IgnoreUnscoredCves
?
What did you implement:
Closes #1267
I applied the filters for ignoreCves and PkgsRegexps to the result from server mode.
Type of change
How Has This Been Tested?
How to reproduce this?
To get the same kind of results, simply run the
vuls server
command with the same config on listed below on run the same POST command.Then, Checked the result by myself.
Results for
ignoreCves
Results for
PkgsRegexps
CVE-2019-16905
is one of the cves that includes opensshChecklist:
make fmt
make test
Is this ready for review?: YES
References