Description
openedon Oct 14, 2020
In theory, this plugin should work with hardware tokens like the Yubikey, which supports OATH+HOTP. In practice, it doesn't work out of the box: the secret generated by the script is base32-encoded, while ykpersonalize expects a hex string. The secret is also 16 bytes instead of the expected 20.
Has anyone tried to make this plugin work with yubikeys? So far my attempts are failing and i'm just wondering if i'm missing anything obvious. So far the YK folks have been quite helpful and simply said to "pad the value with zeros", but so far it doesn't work for me. This is the (python) code I have so far to convert between the two:
remainder = len(secret_b32) % 8
if remainder > 0:
# XXX: assume 6 chars are missing, the actual padding may vary:
# https://tools.ietf.org/html/rfc3548#section-5
secret_b32 += "======"
secret = base64.b32decode(secret_b32)
if len(secret) < 20:
# pad to 20 bytes
secret += b'0' * (20 - len(secret))
print(binascii.hexlify(secret).decode('ascii'))I am setting the google authenticator plugin side with:
google-authenticator -c -Q NONE -r 1 -R 30 -e 1 -w 3
And writing it to the yubikey with:
ykpersonalize -1 -o oath-hotp -o oath-hotp8 -o append-cr -a
The error I'm getting from the pam module is:
Invalid verification code for [USERNAME]
The module is hooked into sshd with:
auth required pam_google_authenticator.so no_increment_hotp nullok debug
I'm successfully using liboath-pam right now with the yubikey, FWIW.
Activity