duo-labs / cloudmapper

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

Separate out new principals from ones that have not been used for 90 days in the IAM report #829

Open 0xdabbad00 opened 3 years ago

0xdabbad00 commented 3 years ago

A simple way of doing this is adding the following to https://github.com/duo-labs/cloudmapper/blob/4f5ec6f6eaffdef4c8d14a628215747b548fbc2d/commands/iam_report.py#L104

created = datetime.datetime.strptime(principal_auth["CreateDate"][0:10], "%Y-%m-%d")
        principal_age = (job_completion_date - created).days

        if principal_age < args.max_age:
            stats["is_inactive"] = False
0xdabbad00 commented 3 years ago

Also add those lines here: https://github.com/duo-labs/cloudmapper/blob/4f5ec6f6eaffdef4c8d14a628215747b548fbc2d/shared/common.py#L404

with s/args.max_age/max_age/