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

file location changes to support clean docker volume mounting #814

Open kbroughton opened 3 years ago

kbroughton commented 3 years ago

-This affects any command involving the web/ directory as output, eg report, iam_report

When running in Docker, it is desirable to mount volumes so the data persists when the run is over.

docker run -v $PWD/account-data:/opt/cloudmapper/account-data cloudmapper:latest collect --account $account --profile $profile

This works fine because the only contents in cloudmapper/account-data is sample data. It's fine to clobber it and everything works great. However, report and iam_report create files in web/account-data/ which already contains map.html. So it is not possible to add -v $PWD/web/account-data:/opt/cloudmapper/web/account-data to persist the reports because it would clobber the map.html file. As a workaround, every user would have to write scripts to copy in map.html, move it into place after clobbering, or move report.html into cloudmapper/account-data after creation. This is messy.

The fix would be to place map.html in another location, like web/map.html and then fix all the references to it. I can create a PR if this solution is acceptable.