This Python script audits AWS IAM users' access keys across an AWS account. It identifies active access keys that have not been used for more than 90 days. This helps in enhancing security by monitoring and managing credentials. It scans all keys against all users. Most scripts would check just the first access key. This one covers the case when one user has multiple access keys.
- Multithreading: Utilizes Python threading for concurrent processing of multiple IAM users, improving performance.
- Access Key Status Check: Audits only active access keys.
- Usage Tracking: Reports the number of days each active key has been unused.
Simply run the script in your Python environment. Ensure that your AWS credentials are set in the environment variables before execution.
- Use simpleauditor_IAM.py if you have IAM keys.
python3 simpleauditor_IAM.py
- Use simpleauditor_SSO.py if you have SSO credentials.
python3 simpleauditor_SSO.py
- Python 3.x
- Boto3 library
- AWS credentials (Access Key ID, Secret Access Key, and optionally Session Token) set as environment variables.
-
Install Python 3.x: Ensure Python 3.x is installed on your system. Download from Python's official site.
-
Install Boto3: Use pip to install the Boto3 library.
pip install boto3
-
Set AWS Credentials: Set your AWS credentials as environment variables.
export AWS_ACCESS_KEY_ID="your_access_key_id" export AWS_SECRET_ACCESS_KEY="your_secret_access_key" export AWS_SESSION_TOKEN="your_session_token" # Optional