Skip to content

Commit 6fa9f6d

Browse files
committed
Change config.toml, Auto-generate UUIDs, change structure of optional field
1 parent 820831f commit 6fa9f6d

14 files changed

+355
-189
lines changed

Gopkg.lock

+9-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+4
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,7 @@
8888
[[constraint]]
8989
branch = "master"
9090
name = "github.com/kotakanbe/go-cve-dictionary"
91+
92+
[[constraint]]
93+
branch = "master"
94+
name = "github.com/hashicorp/uuid"

README.ja.md

+24-45
Original file line numberDiff line numberDiff line change
@@ -779,13 +779,12 @@ host = "172.31.4.82"
779779
# "cpe:/a:rubyonrails:ruby_on_rails:4.2.1",
780780
#]
781781
#ignoreCves = ["CVE-2016-6313"]
782-
#optional = [
783-
# ["key", "value"],
784-
#]
785-
#[servers.172-31-4-82.containers]
782+
#[default.containers]
786783
#type = "lxd" # or "docker"
787784
#includes = ["${running}"]
788785
#excludes = ["container_name", "container_id"]
786+
#[default.optional]
787+
#key = "value"
789788
```
790789
下記serversセクションで値が指定されなかった場合のデフォルト値
791790
@@ -798,16 +797,17 @@ host = "172.31.4.82"
798797
#port = "22"
799798
#user = "root"
800799
#keyPath = "/home/username/.ssh/id_rsa"
800+
#Memo = "DB Server"
801801
#cpeNames = [
802802
# "cpe:/a:rubyonrails:ruby_on_rails:4.2.1",
803803
#]
804804
#ignoreCves = ["CVE-2016-6314"]
805-
#optional = [
806-
# ["key", "value"],
807-
#]
808-
#containers = ["${running}"]
809805
#[servers.172-31-4-82.containers]
810-
#type = "lxd"
806+
#type = "lxd" # or "docker"
807+
#includes = ["${running}"]
808+
#excludes = ["container_name", "container_id"]
809+
#[servers.172-31-4-82.optional]
810+
#key = "value"
811811
```
812812
813813
serversセクションの値は、defaultセクションの値よりも優先される。
@@ -820,7 +820,7 @@ host = "172.31.4.82"
820820
- cpeNames: see [Usage: Scan vulnerability of non-OS package](#usage-scan-vulnerability-of-non-os-package)
821821
- ignoreCves: CVE IDs that will not be reported. But output to JSON file.
822822
- optional: JSONレポートに含めたい追加情報
823-
- containers: see [Usage: Scan Docker containers](#usage-scan-docker-containers)
823+
- containers: see [Example: Scan containers (Docker/LXD)](#example-scan-containers-dockerlxd)
824824
825825
826826
Vulsは各サーバにSSHで接続するが、OSコマンドでの接続と、Goのネイティブ実装の2種類のSSH接続方法をサポートしている。
@@ -1175,6 +1175,7 @@ report:
11751175
[-debug]
11761176
[-debug-sql]
11771177
[-pipe]
1178+
[-uuid]
11781179

11791180
[RFC3339 datetime format under results dir]
11801181

@@ -1252,6 +1253,8 @@ report:
12521253
Write report to S3 (bucket/dir/yyyyMMdd_HHmm/servername.json/xml/txt)
12531254
-to-slack
12541255
Send report via Slack
1256+
-uuid
1257+
Auto generate of scan target servers and then write to config.toml and scan result
12551258
```
12561259
12571260
## How to read a report
@@ -1440,7 +1443,6 @@ $ vuls scan \
14401443
## Example: IgnoreCves
14411444
14421445
Slack, EMail, テキスト出力しないくないCVE IDがある場合は、設定ファイルに定義することでレポートされなくなる。
1443-
ただ、JSONファイルには以下のように出力される。
14441446
14451447
- config.toml
14461448
```toml
@@ -1453,27 +1455,6 @@ user = "kanbe"
14531455
ignoreCves = ["CVE-2016-6314"]
14541456
```
14551457

1456-
- bsd.json
1457-
```json
1458-
[
1459-
{
1460-
"ServerName": "bsd",
1461-
"Family": "FreeBSD",
1462-
"Release": "10.3-RELEASE",
1463-
"IgnoredCves" : [
1464-
"CveDetail" : {
1465-
"CVE-2016-6313",
1466-
...
1467-
},
1468-
"CveDetail" : {
1469-
"CVE-2016-6314",
1470-
...
1471-
}
1472-
]
1473-
}
1474-
]
1475-
```
1476-
14771458
## Example: Add optional key-value pairs to JSON
14781459

14791460
追加情報をJSONに含めることができる。
@@ -1483,18 +1464,16 @@ ignoreCves = ["CVE-2016-6314"]
14831464
- config.toml
14841465
```toml
14851466
[default]
1486-
optional = [
1487-
["key1", "default_value"],
1488-
["key3", "val3"],
1489-
]
1467+
[default.optional]
1468+
key1 = "default_value"
1469+
key3 = val3
14901470

14911471
[servers.bsd]
14921472
host = "192.168.11.11"
14931473
user = "kanbe"
1494-
optional = [
1495-
["key1", "val1"],
1496-
["key2", "val2"],
1497-
]
1474+
[servers.bsd.optional]
1475+
key1 = "val1"
1476+
key2 = "val2"
14981477
```
14991478

15001479
- bsd.json
@@ -1505,11 +1484,11 @@ optional = [
15051484
"Family": "FreeBSD",
15061485
"Release": "10.3-RELEASE",
15071486
.... snip ...
1508-
"Optional": [
1509-
[ "key1", "val1" ],
1510-
[ "key2", "val2" ],
1511-
[ "key3", "val3" ]
1512-
]
1487+
"Optional": {
1488+
"key1": "val1" ,
1489+
"key2": "val2" ,
1490+
"key3": "val3"
1491+
}
15131492
}
15141493
]
15151494
```

README.md

+25-43
Original file line numberDiff line numberDiff line change
@@ -792,13 +792,17 @@ You can customize your configuration using this template.
792792
#port = "22"
793793
#user = "username"
794794
#keyPath = "/home/username/.ssh/id_rsa"
795+
#Memo = "DB Server"
795796
#cpeNames = [
796797
# "cpe:/a:rubyonrails:ruby_on_rails:4.2.1",
797798
#]
798799
#ignoreCves = ["CVE-2016-6313"]
799-
#optional = [
800-
# ["key", "value"],
801-
#]
800+
#[default.containers]
801+
#type = "lxd" # or "docker"
802+
#includes = ["${running}"]
803+
#excludes = ["container_name", "container_id"]
804+
#[default.optional]
805+
#key = "value"
802806
```
803807
Items of the default section will be used if not specified.
804808
@@ -815,13 +819,12 @@ You can customize your configuration using this template.
815819
# "cpe:/a:rubyonrails:ruby_on_rails:4.2.1",
816820
#]
817821
#ignoreCves = ["CVE-2016-6314"]
818-
#optional = [
819-
# ["key", "value"],
820-
#]
821822
#[servers.172-31-4-82.containers]
822823
#type = "lxd" # or "docker"
823824
#includes = ["${running}"]
824825
#excludes = ["container_name", "container_id"]
826+
#[servers.172-31-4-82.optional]
827+
#key = "value"
825828
```
826829
827830
You can overwrite the default value specified in default section.
@@ -833,7 +836,7 @@ You can customize your configuration using this template.
833836
- cpeNames: see [Usage: Scan vulnerability of non-OS package](#usage-scan-vulnerability-of-non-os-package)
834837
- ignoreCves: CVE IDs that will not be reported. But output to JSON file.
835838
- optional: Add additional information to JSON report.
836-
- containers: see [Example: Scan containers (Docker/LXD)(#example-scan-containers-dockerlxd)
839+
- containers: see [Example: Scan containers (Docker/LXD)](#example-scan-containers-dockerlxd)
837840
838841
Vuls supports two types of SSH. One is external command. The other is native go implementation. For details, see [-ssh-native-insecure option](#-ssh-native-insecure-option)
839842
@@ -1186,6 +1189,7 @@ report:
11861189
[-debug]
11871190
[-debug-sql]
11881191
[-pipe]
1192+
[-pipe]
11891193

11901194
[RFC3339 datetime format under results dir]
11911195

@@ -1263,6 +1267,8 @@ report:
12631267
Write report to S3 (bucket/dir/yyyyMMdd_HHmm/servername.json/xml/txt)
12641268
-to-slack
12651269
Send report via Slack
1270+
-uuid
1271+
Auto generate of scan target servers and then write to config.toml and scan result
12661272
```
12671273
12681274
## How to read a report
@@ -1443,7 +1449,7 @@ $ vuls scan \
14431449
14441450
## Example: IgnoreCves
14451451
1446-
Define ignoreCves in config if you don't want to report(Slack, EMail, Text...) specific CVE IDs. But these ignoreCves will be output to JSON file like below.
1452+
Define ignoreCves in config if you don't want to report(Slack, EMail, Text...) specific CVE IDs.
14471453
14481454
- config.toml
14491455
```toml
@@ -1456,28 +1462,6 @@ user = "kanbe"
14561462
ignoreCves = ["CVE-2016-6314"]
14571463
```
14581464

1459-
- bsd.json
1460-
```json
1461-
[
1462-
{
1463-
"ServerName": "bsd",
1464-
"Family": "FreeBSD",
1465-
"Release": "10.3-RELEASE",
1466-
"IgnoredCves" : [
1467-
"CveDetail" : {
1468-
"CVE-2016-6313",
1469-
...
1470-
},
1471-
"CveDetail" : {
1472-
"CVE-2016-6314",
1473-
...
1474-
}
1475-
]
1476-
}
1477-
]
1478-
```
1479-
1480-
14811465
## Example: Add optional key-value pairs to JSON
14821466

14831467
Optional key-value can be outputted to JSON.
@@ -1487,18 +1471,16 @@ For instance, you can use this field for Azure ResourceGroup name, Azure VM Name
14871471
- config.toml
14881472
```toml
14891473
[default]
1490-
optional = [
1491-
["key1", "default_value"],
1492-
["key3", "val3"],
1493-
]
1474+
[default.optional]
1475+
key1 = "default_value"
1476+
key3 = val3
14941477

14951478
[servers.bsd]
14961479
host = "192.168.11.11"
14971480
user = "kanbe"
1498-
optional = [
1499-
["key1", "val1"],
1500-
["key2", "val2"],
1501-
]
1481+
[servers.bsd.optional]
1482+
key1 = "val1"
1483+
key2 = "val2"
15021484
```
15031485

15041486
- bsd.json
@@ -1509,11 +1491,11 @@ optional = [
15091491
"Family": "FreeBSD",
15101492
"Release": "10.3-RELEASE",
15111493
.... snip ...
1512-
"Optional": [
1513-
[ "key1", "val1" ],
1514-
[ "key2", "val2" ],
1515-
[ "key3", "val3" ]
1516-
]
1494+
"Optional": {
1495+
"key1": "val1" ,
1496+
"key2": "val2" ,
1497+
"key3": "val3"
1498+
}
15171499
}
15181500
]
15191501
```

commands/discover.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ subjectPrefix = "[vuls]"
117117
#]
118118
#dependencyCheckXMLPath = "/tmp/dependency-check-report.xml"
119119
#ignoreCves = ["CVE-2014-6271"]
120-
#optional = [
121-
# ["key", "value"],
122-
#]
123-
#containers = ["${running}"]
120+
#[default.containers]
121+
#type = "lxd" # or "docker"
122+
#includes = ["${running}"]
123+
#excludes = ["container_name", "container_id"]
124+
#[default.optional]
125+
#key = "value"
124126
125127
126128
[servers]
@@ -131,18 +133,18 @@ host = "{{$ip}}"
131133
#port = "22"
132134
#user = "root"
133135
#keyPath = "/home/username/.ssh/id_rsa"
136+
#Memo = "DB Server"
134137
#cpeNames = [
135138
# "cpe:/a:rubyonrails:ruby_on_rails:4.2.1",
136139
#]
137140
#dependencyCheckXMLPath = "/tmp/dependency-check-report.xml"
138141
#ignoreCves = ["CVE-2014-0160"]
139-
#optional = [
140-
# ["key", "value"],
141-
#]
142142
#[servers.{{index $names $i}}.containers]
143143
#type = "docker" #or "lxd" default: docker
144144
#includes = ["${running}"]
145145
#excludes = ["container_name_a", "4aa37a8b63b9"]
146+
#[servers.{{index $names $i}}.optional]
147+
#key = "value1"
146148
147149
148150
{{end}}

0 commit comments

Comments
 (0)