Last active
April 14, 2016 23:03
-
-
Save mig5/0d93b672b41427f32f52c789dfabcc54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
KEY1="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
KEY2="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
challenge=`head -c63 /dev/urandom | xxd -c 63 -ps` | |
response=`qvm-run -a --nogui -u root -p sys-usb "ykchalresp -2 -x $challenge"` | |
function yubi_auth() { | |
correct_response=`echo $challenge | xxd -r -ps | openssl dgst -sha1 -macopt hexkey:$1 -mac HMAC -r | cut -f1 -d ' '` | |
test "x$correct_response" = "x$response" | |
return $? | |
} | |
yubi_auth $KEY1 || yubi_auth $KEY2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment