-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #8859, add NitroKey3 HOTP support #22
Conversation
Hang on, it looks like there's a bug with the HOTP code for a small number of outputs...fixing... |
Fixed; ready for review. |
This part isn't that easy - it still need to handle old names for compatibility. Otherwise, the update will break login for some users, which is not acceptable. |
bin/yk-auth
Outdated
hmac=$(printf "$(printf "%016X" "$counter" | sed -e 's/\(..\)/\\x\1/g')" | | ||
openssl dgst -sha256 -mac HMAC -macopt "hexkey:$key" | sed -e 's/^.* //') | ||
otp=$(printf "%08d" "$(( ( (0x${hmac:$((2 * 0x${hmac: -1})):8}) & 0x7FFFFFFF) % (10**8) ))" ) | ||
response=$(qvm-run -a --nogui -p $vm "\$HOME/.local/bin/nitropy nk3 secrets get loginxs" | tail -n1 | tr -d "\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is nitropy
installed? I take there is no proper distribution package, right? Unfortunately, pip (or pipx for that matter) has rather poor integrity validation and is something we do not recommend using. I see there is also an option to download binary (binary? isn't that python?) directly from https://github.com/Nitrokey/pynitrokey/releases/tag/v0.4.44, but it isn't signed either.
Lets see, maybe this can be fixed: Nitrokey/pynitrokey#495
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, pipx
seems to be the main way for the typical end user.
The "binary" is actually an executable Linux binary; unpacking it and doing sudo ln -s /path/to/unpacked/binary /usr/local/bin/nitropy
allows easy execution without calling python3; it may still use python3 "under the hood", but who knows; when I uninstall python3 in a dvm (as far as possible; the process crashes because qubes packages need python3) and via qvm-console-dispvm
unpack and execute the binary, it works.
Edit: any crypto ops currently don't work with the binary, however, due to this issue
Signed artifacts or even better official distro packaging would be nice, yes.
Added checks for old filenames in the script. Edit: All other suggestions also implemented and I've expanded the command to also work with a proper |
Ok, now it looks mostly fine. Please run shellcheck on the script, there are few pre-existing issues, but your change add several more (especially missing quotes in quite a few places). |
PipelineRetry |
Implemented / fixed all
If I put For line 88:
These are "just" warnings, but it's beyond my skill to fix...the code is the basically the same as in the above mentioned script; I've refactored it a bit, but my changes are not the cause of the warnings. |
What about using xxd instead of printf to decode hex? Something like:
(sed is not necessary then)
This looks to be bash-specific feature, maybe simply change shebang at the top to |
BTW should this work with Nitrokey Pro? I think it does support HOTP too. |
It worked,
...so not caused by this PR I think.
Theoretically NK3, NKPro and even NK Storage should be compatible, but I don't have the latter two to test with and I'm not sure how one would tell them via command line ( |
Hmm, looks like |
You can put something like:
(I checked - it's f36 where the package was split) as for the other failure, unrelated CI issue, should be fixed in the meantime |
Well, still no answer about NitroKey Pro or Storage on their forum and the latest All other problems are resolved. |
Okay so someone who seems pretty knowledgeable on the NitroKey forum (a member) says |
Okay, thanks for checking |
I can confirm the YubiKey support still works :) |
Thanks for merging! Edit: I'll wait ~2 weeks with the doc PR as it's too complicated right now to setup |
Update: none of the above mentioned issues have been resolved and I can't get |
This PR:
qvm-run
of yubikey solution not returning anything when screen locked qubes-issues#8859yk-*
file names to removeyk-
as they are now for both YK and NK3coreutils
forbase32
,util-linux
forhexdump
,xxd
orvim-common
forxxd
, all available by default in dom0) to rpm fileI have tested the new NK3 functionality, but don't have a YubiKey to test with; since the YK functionality is not modified aside from @marmarek 's tip in the above linked issue, it should still work / work again, since that issue broke YK support.
Should this PR be accepted, I will provide another one to update the docs.