venth / aws-adfs

Command line tool to ease aws cli authentication against ADFS (multi factor authentication with active directory)
MIT License
286 stars 99 forks source link

Failed response from DUO on macOS Darwin #393

Closed Leglaw closed 1 year ago

Leglaw commented 1 year ago

355

Without ths User-Agent identifying as Linux on macOS, we're back to a broken state for macOS users.

I and developers at our company have all successfully been using the following user-agent:

"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) like Gecko"
pdecat commented 1 year ago

From my understanding, you were using a patched version with this change before the release of v2.8.0, is that it?

What error are you facing?

pdecat commented 1 year ago

Does the following change work for you?

diff --git a/aws_adfs/_duo_universal_prompt_authenticator.py b/aws_adfs/_duo_universal_prompt_authenticator.py
index 0a91fd2..fe2c623 100644
--- a/aws_adfs/_duo_universal_prompt_authenticator.py
+++ b/aws_adfs/_duo_universal_prompt_authenticator.py
@@ -40,7 +40,7 @@ from . import roles_assertion_extractor
 _headers = {
     "Accept-Language": "en",
     "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) like Gecko"
-    if platform.system() == "Linux"
+    if platform.system() in ("Linux", "Darwin")
     else "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
     "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
     "Accept": "text/plain, */*; q=0.01",
Leglaw commented 1 year ago

Yes that patch works perfectly.