Skip to content

Instantly share code, notes, and snippets.

@mig5
Last active April 14, 2016 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mig5/0d93b672b41427f32f52c789dfabcc54 to your computer and use it in GitHub Desktop.
Save mig5/0d93b672b41427f32f52c789dfabcc54 to your computer and use it in GitHub Desktop.
#!/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