audit-labs/audit-tools
A collection of scripts, queries, and other goodies you can use in an audit.
clone: git clone https://gitbay.org/audit-labs/audit-tools.git
main: applications/aws/config.py · raw
1"""
2Configuration loader for the AWS audit tool.
3
4Reads AWS_PROFILE, AWS_DEFAULT_REGION, and AWS_AUDIT_ACCOUNT from the
5environment. Credentials themselves come from the standard boto3 credential
6chain — this tool never handles access keys directly.
7
8Usage:
9 export AWS_PROFILE=my-profile # optional; else default chain
10 export AWS_DEFAULT_REGION=us-east-1 # optional
11 export AWS_AUDIT_ACCOUNT=my-account # optional; only for SSO assignments
12"""
13
14import os
15
16from collectors.api import build_cfg
17
18
19def load(profile_override=None, region_override=None, account_override=None):
20 """Return a config dict. AWS needs no required token to validate here;
21 missing or invalid credentials surface at call time."""
22 profile = profile_override or os.environ.get("AWS_PROFILE", "").strip()
23 region = region_override or os.environ.get("AWS_DEFAULT_REGION", "").strip()
24 account = account_override or os.environ.get("AWS_AUDIT_ACCOUNT", "").strip()
25 return build_cfg(profile, region, account)