Commit 333b89eb authored by Brandon Smith's avatar Brandon Smith

Support privacyIDEA as primary auth

parent e25b7f44
...@@ -73,31 +73,24 @@ def passthrough(): ...@@ -73,31 +73,24 @@ def passthrough():
pass pass
sys.exit(0) sys.exit(0)
index = ssh.expect(["Authenticated with partial success.",
"[^ \r\n]+",
pexpect.EOF])
if index == 0:
print(ssh.match.group())
elif index == 1:
passthrough()
elif index == 2:
sys.exit(0)
while True: while True:
index = ssh.expect(["Enter additional factors: ", index = ssh.expect(["Authenticated with partial success.",
"Enter additional factors: ",
"----- BEGIN U2F CHALLENGE -----\r\n", "----- BEGIN U2F CHALLENGE -----\r\n",
"[^ \r\n]+", "[^ \r\n]+",
pexpect.EOF]) pexpect.EOF])
if index == 0: if index == 0:
print(ssh.match.group())
if index == 1:
try: try:
pin = getpass.getpass(ssh.match.group()) pin = getpass.getpass(ssh.match.group())
except EOFError: except EOFError:
pin = "" pin = ""
ssh.sendline(pin.strip()) ssh.sendline(pin.strip())
elif index == 1: elif index == 2:
u2f_origin = ssh.readline().strip() u2f_origin = ssh.readline().strip()
u2f_challenge = ssh.readline().strip() u2f_challenge = ssh.readline().strip()
ssh.expect("(.*)----- END U2F CHALLENGE -----") ssh.expect("(.*)----- END U2F CHALLENGE -----")
...@@ -109,8 +102,8 @@ while True: ...@@ -109,8 +102,8 @@ while True:
p.wait() p.wait()
ssh.sendline(out.strip()) ssh.sendline(out.strip())
elif index == 2: elif index == 3:
passthrough() passthrough()
elif index == 3: elif index == 4:
sys.exit(0) sys.exit(0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment