Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions privacyidea_pam.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ def u2f_challenge_response(self, transaction_id, message, attributes):
%s
----- END U2F CHALLENGE -----""" % (self.URL,
json.dumps(attributes["u2fSignRequest"]),
str(message or ""))
message)

if bool(attributes.get("hideResponseInput", True)):
prompt_type = self.pamh.PAM_PROMPT_ECHO_OFF
else:
prompt_type = self.pamh.PAM_PROMPT_ECHO_ON

message = self.pamh.Message(prompt_type, challenge)
response = self.pamh.conversation(message)
pam_message = self.pamh.Message(prompt_type, challenge)
response = self.pamh.conversation(pam_message)
chal_response = json.loads(response.resp)

data = {"user": self.user,
Expand Down
5 changes: 4 additions & 1 deletion ssh-u2f.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@

Usage:
Make executable
Configure otp_prompt variable to match your pam prompt
Symlink ssh-u2f, scp-u2f, sftp-u2f, mosh-u2f, etc. into your PATH
Call just like ssh, eg. "ssh-u2f name@example.com"
"""

otp_prompt = "privacyIDEA_Authentication"

ssh = None

def handler(signum, frame):
Expand Down Expand Up @@ -75,7 +78,7 @@ def passthrough():

while True:
index = ssh.expect(["Authenticated with partial success.",
"([Pp]assword[^:\r\n]*|Enter additional factors): ?",
"([Pp]assword[^:\r\n]*|%s): ?" % otp_prompt,
"----- BEGIN U2F CHALLENGE -----\r\n",
"[^ \r\n]+",
pexpect.EOF])
Expand Down