Cloud Authentication via CLI - SethBodine/audit-tools GitHub Wiki
Authentication commands for each supported cloud provider. Run these inside the container after starting it. Ensure credentials are configured before running any assessment tools.
The AWS CLI stores credentials and config in the following locations. Files are created automatically via aws configure or manually.
| OS | Path |
|---|---|
| Linux / macOS | ~/.aws/ |
| Windows | %USERPROFILE%\.aws\ |
| File | Purpose |
|---|---|
config |
Region and output format |
credentials |
Access key, secret key, and optional session token |
The AWS Account needs to be set-up with Access Key and Secret Key, if MFA is configured, it will be configured with a Virtual MFA Device. This ARN can be found in your IAM Account.
aws configure # May not be required
aws sts get-session-token --serial-number arn:aws:iam::<accountnumber>:mfa/<username> --token-code <6 Digit Code>
aws configure # Update Secret and Key
aws configure set aws_session_token <SESSION_TOKEN_HERE> # Add temporary Session Token
aws iam generate-credential-report # Generates IAM Credential ReportNote: Not recommended.
aws configure # Update Secret and Key
aws iam generate-credential-report # Generates IAM Credential ReportTo assume a role, add a profile to the credentials file:
[<profile-name>]
role_arn = arn:aws:iam::<account-number>:role/<role-name>
source_profile = defaultThen use the profile:
aws iam generate-credential-report --profile <profile-name>See the AWS documentation for more detail.
az loginaz login --use-device-codeNavigate to the URL shown and enter the code to complete authentication.
gcloud auth login --no-launch-browser
gcloud projects list
gcloud config set project <PROJECT_ID>TBC - setup is more involved than other providers.
# Ensure you are logged into Azure first
sudo az aks install-cli
az aks get-credentials -g <RESOURCE_GROUP> -n <CLUSTER_NAME>
kubelogin convert-kubeconfig -l azurecli
kubectl get nodes# Ensure you are logged into AWS first
aws eks update-kubeconfig --region <region> --name <cluster-name>
kubectl get nodes