nccgroup / opinel

Python code shared by Scout2 and AWS-Recipes
GNU General Public License v2.0
24 stars 18 forks source link

Use MFA auth when mfa-code is provided #21

Closed gforinger closed 6 years ago

gforinger commented 6 years ago

Currently, If you specify an mfa-code on the Scout2 command line, it will be ignored without any warnings or errors.

In Scout2, __main.py__ calls read_creds from opinel/utils/credentials.py

In opinel/utils/credentials.py, the read_creds function only does an init_sts_session with the mfa-code if the force_init bool is set to True, but that never happens if your ~/.aws/credentials file doesn't contain a SessionToken already. If the session token doesn't exist, it should probably set force_init to True.

l01cd3v commented 6 years ago

Thanks !

l01cd3v commented 6 years ago

Should be fixed now - Only the first commit is relevant though...