Skip to content
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

FIDO2 luks support #77826

Merged
merged 5 commits into from Jan 27, 2020
Merged

FIDO2 luks support #77826

merged 5 commits into from Jan 27, 2020

Conversation

mmahut
Copy link
Member

@mmahut mmahut commented Jan 16, 2020

Motivation for this change

This changes introduces the possibility of using FIDO2 compatible tokens with luks.

I'm using this change for several days but all testing is welcome.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@mmahut
Copy link
Member Author

mmahut commented Jan 16, 2020

@1000101 To test it, follow the documentation to create your credentials and configure your system then run nixos-rebuild switch -I nixpkgs=https://github.com/mmahut/nixpkgs/archive/fido2luks.tar.gz.

@mmahut mmahut force-pushed the fido2luks branch 2 times, most recently from bba7abc to a3688a0 Compare January 16, 2020 15:09
@1000101
Copy link
Member

1000101 commented Jan 17, 2020

@1000101 To test it, follow the documentation to create your credentials and configure your system then run nixos-rebuild switch -I nixpkgs=https://github.com/mmahut/nixpkgs/archive/fido2luks.tar.gz.

It works great with latest 5.4.x (5.4.11) kernel but when trying with stable 4.19.x (4.19.95) the prompt gets stuck waiting for additional entropy from the user (even with passwordless setup).

@mmahut
Copy link
Member Author

mmahut commented Jan 17, 2020

Indeed, the problem with < 5.4 kernels is that when the system is booting and fido2luks is run during the initrd process, it can take several seconds to initialize because of limited entropy from the pool.

This has been greatly fixed with random: try to actively add entropy rather than passively wait for it
that is in 5.4.

For now, I will just create a warning for end users to suggest using linuxPackages_latest with this option.

@mmahut mmahut force-pushed the fido2luks branch 3 times, most recently from f36e097 to 98edf5b Compare January 17, 2020 09:51
@prusnak
Copy link
Member

prusnak commented Jan 20, 2020

Let's wait until this change is released: shimunn/fido2luks@c4e0841

It adds --await-dev which waits for the device if not connected (default is 15 seconds). We can then get rid of the shell script doing the same (function wait_fido2key).

@mmahut mmahut added the 2.status: wait-for-upstream Waiting for upstream fix (or their other action). label Jan 20, 2020
@prusnak
Copy link
Member

prusnak commented Jan 21, 2020

@mmahut upstream just released 0.2.3, so we are good to go! \o/ https://github.com/shimunn/fido2luks/tags

@mmahut mmahut force-pushed the fido2luks branch 2 times, most recently from fc7549e to 0b3bfa5 Compare January 22, 2020 08:09
@ofborg ofborg bot requested a review from prusnak January 22, 2020 08:34
@mmahut mmahut removed the 2.status: wait-for-upstream Waiting for upstream fix (or their other action). label Jan 22, 2020
nixos/modules/system/boot/luksroot.nix Outdated Show resolved Hide resolved
Copy link
Member

@prusnak prusnak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! LGTM

@mmahut mmahut merged commit 61dbbe4 into NixOS:master Jan 27, 2020
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Jan 27, 2020
FIDO2 luks support

(cherry picked from commit 61dbbe4)
@arianvp
Copy link
Member

arianvp commented Apr 24, 2020

I've tried this but it doesn't work with any of the Yubikeys in the office.

For yubikey 5 it prints:

fido2luks credential  "HELLO"
authenticator error: Error while decoding CBOR from device.

@prusnak
Copy link
Member

prusnak commented Apr 24, 2020

I am not sure whether Yubikey 5 supports FIDO2 hmac-secret extension.

@arianvp
Copy link
Member

arianvp commented Apr 24, 2020

Yes it does... I use FIDO2 support for it in many places including Microsoft Hello + Bitlocker (Which uses the same extensions as this tool)

https://support.yubico.com/support/solutions/articles/15000014219-yubikey-5-series-technical-manual#FIDO2hx8dol including the required hmac-secret extension https://support.yubico.com/support/solutions/articles/15000027138-yubikey-5-2-3-enhancements-to-fido-2-support

@prusnak
Copy link
Member

prusnak commented Apr 24, 2020

@arianvp are you sure your key has the required firmware version 5.2.3?

@arianvp
Copy link
Member

arianvp commented Apr 24, 2020

Yes all our keys are updated to 5.2.4

@arianvp
Copy link
Member

arianvp commented Apr 24, 2020

I've opened an upstream issue. I don't think we can do much here. shimunn/fido2luks#10

Hope we can fix it there (and backport it to 20.03)

@arianvp
Copy link
Member

arianvp commented Apr 24, 2020

Perhaps we could instead base this module on https://github.com/mjec/fido2-hmac-secret ?

It's actively used in Arch and based in the libfido2 library that is maintained by Yubikey. I have a bit more faith in it working than an experimental rust ctap implementation that isn't too actively maintained

@prusnak
Copy link
Member

prusnak commented Apr 24, 2020

implementation that isn't too actively maintained

These are pretty strong words. Last commit to that repo was 19 days ago, while the module you are suggesting has the last commit in February.

@arianvp
Copy link
Member

arianvp commented Apr 24, 2020

Sorry my wording could've been clearer and less strong. Thanks for calling me out on that.

I wasn't talking about fido2luks vs fido2-hmac-secret but about the dependencies they depend on that implement the interesting bits.
I was comparing https://github.com/Yubico/libfido2 and https://github.com/shimunn/ctap here .

where libfido2 seems more actively maintained and battle-tested (and also already used by the openssh that we package).

Anyhow lets hope I can help debug with the fido2luks author to see if we can get it working on Yubikey 5.

Thanks for helping debugging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants