klouddb / klouddbshield

KloudDB Shield is a security tool that checks for Postgres CIS Benchmarks - Postgres, MySQL and RDS
https://klouddb.gitbook.io/klouddb_shield
Other
82 stars 15 forks source link

JSON Output not Working #9

Closed quentinkhoo closed 2 months ago

quentinkhoo commented 3 months ago

Hello all! Thank you for the work on this!

Just wondering, is it possible to output results in JSON? I see that even though the output resulting file is rdssecreport.json, I still get a table format. For context this was the command I ran ciscollector -r -output-type json and I ran this against the AWS RDS Sec Report option

root@ac223b16a220:~# ciscollector -r -output-type json
 1: All Postgres checks(Recommended)
 2: Postgres CIS and User Security checks
 3: HBA Scanner
 4: Postgres PII report
 5: Inactive user report
 6: Client ip report
 7: HBA unused lines report
 8: Password Manager
 9: Password leak scanner
10: AWS RDS Sec Report
11: AWS Aurora Sec Report
12: MySQL Report
13: Transaction Wraparound Report
14: Exit

Enter your choice to execute(from 1 to 14):10

But for some reason my results are still in table format and not JSON.

% cat rdssecreport.json

┌───────┬──────────────────────────────────────────────────────────────────────┬────────┐
│ Ctrl  │ Title                                                                │ Status │
├───────┼──────────────────────────────────────────────────────────────────────┼────────┤
│ 2.3.1 │ Ensure that encryption is enabled for RDS instances                  │ Fail   │
├───────┼──────────────────────────────────────────────────────────────────────┼────────┤
│ 2.3.2 │ Ensure that auto minor version upgrade is enabled for RDS instances  │ Fail   │
├───────┼──────────────────────────────────────────────────────────────────────┼────────┤
│ 2.3.3 │ Ensure that public address is not given to RDS instance              │ Pass   │
├───────┼──────────────────────────────────────────────────────────────────────┼────────┤
│ 3.5.0 │ Multi-AZ check                                                       │ Fail   │
├───────┼──────────────────────────────────────────────────────────────────────┼────────┤
│ 3.8.0 │ Ensure Relational Database Service backup retention policy is set    │ Pass   │
├───────┼──────────────────────────────────────────────────────────────────────┼────────┤
│ 4.2.0 │ Ensure SNS topic is created for RDS events                           │ Pass   │
├───────┼──────────────────────────────────────────────────────────────────────┼────────┤
│ 4.3.0 │ Ensure RDS event subscriptions are enabled for Instance level events │ Fail   │
├───────┼──────────────────────────────────────────────────────────────────────┼────────┤
│ 4.4.0 │ Ensure RDS event subscriptions are enabled for DB security groups    │ Fail   │
└───────┴──────────────────────────────────────────────────────────────────────┴────────┘

If it matters, this is my ciscollector --version

root@ac223b16a220:~# ciscollector --version
Thu, 05 Sep 2024 18:16:29 +0800 DBG ../home/runner/work/klouddbshield/klouddbshield/pkg/config/config.go:350 > version=2.0
klouddb commented 2 months ago

@quentinkhoo Are you seeing this for RDS report only ? Did you try Postgres report ?

quentinkhoo commented 2 months ago

@quentinkhoo Are you seeing this for RDS report only ? Did you try Postgres report ?

@klouddb Yep unfortunately I have the same issue the Postgres reports as well, can't seem to get a json formated report.

klouddb commented 2 months ago

@quentinkhoo We have verified this and found that the JSON output is currently available only for the log parser feature. We plan to add JSON output support for other features in future releases

klouddb commented 1 day ago

@quentinkhoo We added JSON output in new release (released yesterday).. Also we introduced new features like SSL check etc.. Also you can specify custom path for your config file now

klouddb commented 5 hours ago

@quentinkhoo Here are the flags you need to use ciscollector -r --output-type json --config ./

1) To specify custom config file path use --config flag 2) To specify JSON type use --output-type json .. Please try these two flags and let us know