Skip to content

Instantly share code, notes, and snippets.

@andrew-aiken
andrew-aiken / CheckUserAccessKeys.py
Last active January 28, 2022 18:03
AWS User API Access Token Age Check
import os
import boto3
from datetime import date
# Email stuff
EMAIL_ADDRESS_BODY = os.environ.get('EMAIL_ADDRESS_BODY')
SOURCE_ADDRESS = os.environ.get('SOURCE_ADDRESS')
CC_EMAIL_ADDRESS = os.environ.get('CC_EMAIL_ADDRESS')
ENV = os.environ.get('env')
@andrew-aiken
andrew-aiken / CognitoMFA.py
Last active June 30, 2023 10:39
AWS Cognito MFA Setup Script
# AWS Cognito MFA
# MFA is not configured by default when using the AWS Cognito web UI.
# The following script will setup a user account, setup MFA for the user, and return a temporary password.
import boto3, json, pyotp
import string, random
import sys
import hmac, hashlib, base64