duo-labs / cloudmapper

CloudMapper helps you analyze your Amazon Web Services (AWS) environments.
BSD 3-Clause "New" or "Revised" License
5.9k stars 800 forks source link

Improvement: Support mutli-account output files. Add options for output filename for report.html, iam_report.html, data.json #815

Open kbroughton opened 3 years ago

kbroughton commented 3 years ago

Collect supports multi-account by automatically pre-pending the account-name from config.json to the file path cloudmapper/account-data/$account_name/.

This enhancement would bring similar mutli-account support to the above-mentioned commands

All of the mentioned commands write to a file at the end of the run. For weboftrust.py, the output is written to web/data.json. This is hard-coded which creates both a docker-mounting problem (to persist outside the container you clobber the web/ directory which has needed files) and blocks multi-account runs.

iam_report and report place their outputfile in web/account-data and are also hard-coded.

The proposed fix is to

  1. prefix all output files with $account_name
  2. move web/data.json to web/account-data/$account_name-data.json
  3. fix all references (eg webserver.py) to use the config.json default account $default_account_name- as the default displayed report etc. or have them select from all files with .endswith('iam_report.html')
  4. add argparse options for allowing over-ride of file location and selection of account data for display

If this is acceptable, i can create a PR