-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[feature request] Enable openssh fido/u2f support #2525
Comments
@tavrez Is this something you could checkout/debug using the SDK, then a simple PR if it works for you (i.e. then wrap it into the installer). As Git-for-Windows is open source your contribution would be welcomed (with the usual quality caveats ;-). |
What @PhilipOakley said. @tavrez you can start by downloading Git for Windows' SDK, running the installer, then |
I've tried now to build OpenSSH with But that change alone is not enough to use OpenSSH with FIDO/U2F support on Windows. I'm not aware which libfido2 I could use then. |
Our OpenSSH build is an MSYS one, so you will need the MSYS version of libfido2. There does not seem to be any at the moment, though: https://github.com/msys2/MSYS2-packages/find/master/. |
Thanks Johannes, that's what I was afraid of. I was thinking about to prepare my first pull request. & I'm the wrong for bringing libfido2 to MSYS. Not my terrain. |
Can we just compile it(libfido2 and libcbor) natively and put it inside mingw packages? I mean @cw789 did you test with any of builds? |
No I didn't try that. |
@tavrez sure, by our guest. Download the Git for Windows SDK, then |
I successfully compiled everything and tested library with both my U2F and FIDO2 keys, I will package them properly and push a PR ASAP(I probably need your help since I'm not familiar with progress). |
@tavrez you managed to surprise me! I will gladly help you with whatever process hurdles you face. |
At first I thought since libcbor and libfido2 can be compiled natively on Windows, it's better to compile them under mingw, but then I realised openssh can't use them so I went back to msys. Now the problem is both libcbor and libfido2 only have cmake files, and I do not know how to build PKGBUILD for them. Should I download cmake in their PKGBUILD or you have better approach to this? I should also mention that using fido2 in Windows 10 version 1903 and higher requires administrator privileges, this needs to be noted somewhere for end users |
You'll probably want a compile time dependency ( |
For lurkers: https://github.com/git-for-windows/MSYS2-packages/blob/450628337752150d35673af52f18102994257a9a/task/PKGBUILD#L18 and https://github.com/git-for-windows/MSYS2-packages/blob/450628337752150d35673af52f18102994257a9a/task/PKGBUILD#L55 are probably the most relevant parts of |
First try pushed on git-for-windows/MSYS2-packages#34 |
This is my favorite ticket of the week. |
@tavrez I am curious... Does this mean that we will be able to SSH into a remote server via Windows Hello? If so, how will this be configured, and what is your progress? |
Current shipped version of git for windows (2.25.1) support external modules, as a test:
-w will open module and tries to use it for connecting to security key |
I also found this very nice blog post that explains more about this feature: https://duo.com/labs/tech-notes/u2f-key-support-in-openssh |
OpenSSH v8.2's Release Notes also have a nice section on FIDO/U2F Support, and I found yet another good blog post about this subject: https://foremostlist.com/openssh-now-supports-fido-u2f-security-keys-for-2-factor-authentication/. |
Thanks for all the link, I've completely read all the man pages and related codes on OpenSSH. After couple of tests on yesterday and today I think I learned how I should wrap things up, need sometime to polish and test things, then I will push things inside my repo for tests, after that we can pull it inside msys as optional module if needed. |
Sadly I have to say with the current implementations I cannot make this module :-( OpenSSH is hashing the random challenge before giving it to the sk module, see: Either OpenSSH should gives the module the original challenge or Windows API should have an option to not hash the input data. So for now, I can't do anything but sending mails to developers |
😞 I have to say, however, that I do not quite understand the problem... whether we let the Windows API hash the original data or a hashed version thereof should not matter, as long as we're consistent about double-hashing, no (and as long as SHA-256 is safe)? |
If I understand it correctly, the authentication module is supposed to generate a response out of the hash of the challenge. If it generates that response out of the hash of the hash of the challenge the remote will (rightfully) reject that response as invalid. |
Oh right, the hash is generated both on the client and on the server. My bad. Thanks for screwing on my head right @rimrul! |
Good news: I contacted with both Microsoft and OpenSSH team, no answer from MS till now but OpenSSH dev responded me that my suggestion about changes in API format is "reasonable". I'll try to finish my implementation and give it to them so they can change what's needed in future releases. |
I finished writing my module on tavrez/openssh-sk-winhello |
Nice! I'll check it out as soon as I'll get a chance, and hope that others will do the same. |
@tavrez |
@tavrez do you think it'd be time to bundle this with Git for Windows, or do you think it needs more testing? |
I’ll do couple more tests at the weekend and will share the results |
Any news on this? This looks very cool to have this feature ☺ |
Sorry I forgot to mention it here, due to a weird bug some users reported in tavrez/openssh-sk-winhello/issues/1 I've decided to contact Microsoft to see if they can help, it usually takes a long time to get an answer from them. If you are interested, you can download and install it manually from my repo, I'll help if you have any problems with it. |
Ok I'm ready to discuss about what I should do to make my module bundled inside git-for-windows :-) |
Perfect! What about tavrez/openssh-sk-winhello#1, though? Also, I cloned, built and installed it, tried |
Well, in short, it's ok.
OpenSSH supports ECDSA or Ed25519 key types, if your internal TPM module support generation of these type of keys, it lets you use it, but I haven't seen any TPM module supporting these kind of keys :/ |
I guess that's my TPM's fault, then. So... next step: open a PR over at https://github.com/git-for-windows/MSYS2-packages to add the openssh-sk-winhello package, loosely modeled after https://github.com/git-for-windows/MSYS2-packages/blob/HEAD/windows-default-manifest/PKGBUILD. I am looking forward to it! |
Before I create PR, let's talk about these things :D
|
How about adding some automated build to check for compatibility? Is there a way to test-load your helper in a headless environment, i.e. without actually authenticating anything? Sort of a dry run?
I think that would be neat.
Oh. Can we somehow introduce a good default if that environment variable is not set? And what config setting is required? I thought this was purely on the SSH side...
In my test, that nag indeed goes away. How about editing test -z "$SIGNTOOL" ||
eval "$SIGNTOOL" ssh-sk-helper.exe I can then easily set it up in the automated builds of OpenSSH.
That is how I like to update my SDK, the biggest problem is it does not track all the packages, so if you have installed, say,
Yes. The end user installation is intended to live in It does not seem to me as if you really wanted Git for Windows, you're more interested in something like MSYS2 (or Git for Windows' SDK, which is a close cousin of MSYS2). |
Yes,I can create a mini app to load the dll and write its API version, but you also need to check API version of ssh, I'm not sure if it's possible.
If we do not set env variable, ssh will use its internal implementation(libfido2 one which requires admin privileges), but if we set something and it doesn't work(e.g. version mismatch), it will fail and won't fallback to it's internal build.
Perfect! Thank you, if signing is available in auto build, it is gonna be so great.
I love Git for Windows, you have many great packages in git-for-windows/MSYS-packages , just wanted to see them in action! I can continue to add packages manually into it |
TBH I was kind of hoping for some sort of built-in functionality where you could, say, query a "module version" or some such. I'd rather not reimplement DLL loading in a separate tool because it's not what we want to verify, we want to verify that
Hmm. Maybe it is time to add a patch to git-for-windows/MSYS2-packages' I am really wary of requiring an environment variable because there are so many ways to call into Git, and we do not want to prevent users from overriding config settings via their own environment variables. I mean, we could potentially teach |
It's possible from their source files, sk-api.h is available on both openssh and my code, they should define same (SSH_SK_VERSION_MAJOR & SSH_SK_VERSION_MAJOR_MASK)
How about a new file in /etc/profile.d ? exporting env we need in it. and if users define same in .bashrc, it can overwrite ours |
I am more worried about having a binary
When I said:
I did mean it. Your |
FWIW: FIDO2/U2F support was just merged into PowerShell's fork of openssh-portable: PowerShell/openssh-portable#541 |
I think we have some FIDO2 support in our current OpenSSH, but it would need for someone other than me to drive this forward. |
I just tested the latest version of MSYS2 and my FIDO/U2F key works perfectly with Windows Hello. Looking at the PRs to upstream's MSYS2-packages repository, I guess msys2/MSYS2-packages#2875 and msys2/MSYS2-packages#2884 must be added to https://github.com/git-for-windows/MSYS2-packages, for FIDO/U2F keys to work with Windows Hello in Git for Windows. I may have time to send a few PRs, but anyone else is also free to do it :) |
Please do. We already link libfido2 and libcbor, but when I recently tried to upgrade to a new-enough libfido2 version to have support for Windows Hello, I ran into a segfault. If you can resolve all that, I will be happy to merge the PR(s) and build the packages. |
Is it too soon to ask for this?
libfido2 is available on windows so I think enabling openssh fido support with --with-security-key-builtin will work
The text was updated successfully, but these errors were encountered: