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

Add support for Yubikey as auth backend #131

Open
radeksimko opened this issue May 2, 2015 · 58 comments
Open

Add support for Yubikey as auth backend #131

radeksimko opened this issue May 2, 2015 · 58 comments
Labels
community-sentiment Tracking high-profile issues from the community enhancement

Comments

@radeksimko
Copy link
Member

radeksimko commented May 2, 2015

https://www.vaultproject.io/docs/auth/index.html

https://www.yubico.com/faq/yubikey/

Yubikey is slowly becoming quite popular when it comes to HW solution to 2FA and more importantly it's quite easy to use it.

I'm not sure if the integration should actually be 1FA (generated token from Yubikey only) or extra factor to existing auth backends. Eventually it can be both?

EDIT: Its currently possible with a 3rd party plugin https://github.com/bruj0/vault-plugin-auth-u2f

@ketzacoatl
Copy link

++

@carldanley
Copy link

👍

@sherzberg
Copy link
Contributor

This would be awesome to use as unseal tokens as well. No clue if that would work the the current Shamir keys, but still a neat idea for operator unsealing.

@GonZo
Copy link

GonZo commented Jul 5, 2015

👍

6 similar comments
@CharlieSu
Copy link

👍

@nicr9
Copy link

nicr9 commented Sep 29, 2015

👍

@GonZo
Copy link

GonZo commented Sep 30, 2015

👍

@eedgar
Copy link

eedgar commented Oct 6, 2015

👍

@peterloron
Copy link

👍

@bscott
Copy link

bscott commented Oct 21, 2015

👍

@klauern
Copy link

klauern commented Oct 21, 2015

I am curious about how this would work. I know that with the recent GitHub support for Yubikeys, this would need to support the U2F protocol, which I can't find any mention of it being supported anywhere other than Google Chrome. Are there libraries that integrate with the USB device so you could get the token?

@nicr9
Copy link

nicr9 commented Oct 22, 2015

@klauern I started looking into this a while ago. I've been fleshing out a prototype using GeertJohan/yubigo.

I have the verification logic done but I'm looking for a neat way to associate policies with particular yubikeys/users. Each yubikey has a 12 digit identifier that's easy to derive from a OTP but it's not a particularly intuitive way to refer to a user.

@klauern
Copy link

klauern commented Oct 22, 2015

I do think I ran across your repo when I was doing research on this earlier, but I think I was more confused about what you would need to write to integrate with Vault.

I was looking into this yesterday, and I think what I am trying to understand is how to interface with the Yubikey itself. This StackOverflow question seemed to ask the right question, but it wasn't until I started reading the comments before I saw that what I was looking for was a Host Client Library, of which Yubico links to two: https://developers.yubico.com/Software_Projects/FIDO_U2F/U2F_Host_Libraries/

So my next thought would be, if you want to add a U2F Yubikey as a backend in Vault, you're assuming that you'll get the token through some other means, most likely Google Chrome. I suppose that's possible, as I do that more-or-less with the Google Cloud SDK, but if you could natively support that from the command-line when you call vault itself, you'd more likely want to integrate with something like the libu2f-host C library.

Now, I'm honestly hoping I'm completely off-base and clueless, but this is all new to me, so I expect I'm not alone in trying to understand how it would work.

@JensRantil
Copy link

@klauern There are two different Yubikey modes that could be supported:

  • U2F
  • OTP

The former has a more complex authentication methodology and requires a driver which currently mostly is useful in Chrome. For example, U2F wouldn't be possible to use from curl. The latter (OTP) is much easier to implement, but at the expense that a MITM (say, a keylogger) could collect the password. However, replay attacks aren't possible.

I suggest you start with supporting the OTP before digging into U2F. I assume most Vault users aren't communicating with Vault through Chrome, right?

@klauern
Copy link

klauern commented Oct 22, 2015

This is where I think I'm limited a bit. I own a FIDO U2F Security Key, which only supports U2F. I suppose if Vault were to support YubiKeys, OTP would probably be the preference, but would limit those people who own the U2F-only version. Maybe that's why I am having such trouble, as I can't simply press the button to generate a token like you can in an OTP-mode enabled version.

@JensRantil
Copy link

@klauern I see. I'm sure you already know this, but you can order an OTP-supported key for $25 from here. If that's too much, you could always try opening up a support ticket and see if they'd be willing to sponsor with a key or maybe @sherzberg @GonZo @CharlieSu @nicr9 @eedgar @peterloron @ketzacoatl @bscott is willing to sponsor you with one?

@CharlieSu
Copy link

There is another mode that could also be supported that doesn't require interfacing with any external services.

https://www.yubico.com/products/services-software/personalization-tools/challenge-response/

HMAC-SHA1 secrets for each key could be stored in the vault and used to authenticate a user. You'd send a challenge to the device and know what the expected response would be.

I'd be more than happy to sponsor someone if it speeds things up. Send me your address and promise you'll actively work on it and I'll ship one out.

https://keybase.io/charlessullivan

@jefferai
Copy link
Member

To @CharlieSu 's point, it may make sense for someone interested in seeing this through to reality to come up with a design document that can be reviewed. It would be nice to get some kind of community consensus as to what the desired behavior is before implementing something that may not meet those needs.

There seem to be some basic questions that simply aren't answered yet, such as whether Vault should be responsible for implementing the YubiKey protocol and validating tokens, or simply holding a mapping from tokens to policies and passing through the validation process to Yubico's servers. Not to mention UDF vs. OTP vs. HMAC-SHA1.

@asemt
Copy link

asemt commented Oct 31, 2015

👍

2 similar comments
@cvle
Copy link

cvle commented Dec 1, 2015

👍

@jfuechsl
Copy link

jfuechsl commented Dec 4, 2015

👍

@kitotik
Copy link

kitotik commented Dec 19, 2015

👍 Cool to see the discussions on U2F.

We've been experimenting automating yubikey provisioning and authentication with the TLS backend in Vault using pkcs11 with some success.

@rdark
Copy link

rdark commented Feb 25, 2016

@kitotik do you have any more info on that? I'm considering using some of the new Yubikeys with PIV support for authenticating users using client certs stored on the key.

@skyzyx
Copy link

skyzyx commented Mar 8, 2016

👍

2 similar comments
@oppegard
Copy link

oppegard commented Mar 8, 2016

👍

@z00m1n
Copy link
Contributor

z00m1n commented Mar 8, 2016

👍

@pearkes pearkes closed this as completed Apr 19, 2016
@jefferai jefferai reopened this Apr 19, 2016
@winpat
Copy link

winpat commented Jul 1, 2016

👍

@h4m24
Copy link

h4m24 commented Feb 25, 2017

👍

@markojak
Copy link

We all use Yubikeys for logins and management and using this would be a great MFA and would encourage us to use vault

@mjungsbluth
Copy link

For authentication you can use the PIV applet on modern Yubikeys to authenticate against the cert auth backend.

@jdelic could you elaborate on the how? I assume curl with OpenSSL + engine_pkcs11 + p11-kit + opensc? At least on OS X this is not straight forward as the bundled curl as well as Homebrews curl are by default built against darwinssl for good reasons (use the system keychain) which prohibits using the yubikey's piv applet (at least I found no way to reference the key on the yubikey) on macOS Sierra

@wiktor-k
Copy link

Homebrews curl are by default built against darwinssl for good reasons (use the system keychain) which prohibits using the yubikey's piv applet (at least I found no way to reference the key on the yubikey) on macOS Sierra

Interesting because on windows curl built with WinSSL (Secure Channel) automatically uses certs in Certificate Store and Windows adds Yubikey PIV certs when the key is inserted in the USB port. So curl with WinSSL is all that's needed to use e.g. client certificates.

Are you sure MacOS does not add Yubikey PIV certs to Keychain?

OH, now I see Yubico documentation mentions OpenSC so you're right, curl with darwinssl would not work: https://developers.yubico.com/PIV/Guides/Mac_code_signing.html

@mjungsbluth
Copy link

mjungsbluth commented Aug 28, 2017

I had a look at curl's sources and everything seemed to support keys on a smart card, so I dug deeper and alas, it actually seems to work (at least curl is able to load the certificate + key). It seems the default "Yubikey PIV Authentication" key doesn't work (maybe because it ECDSA and not RSA).

curl selects the identity based on the certificate's subject's commonName.

To list the usable identities you can use macOS Sierra's security tool (if it is listed but not valid, there most likely is a missing trust)

> security find-identity -p ssl-client

> curl -E "<commonName>" https://targeturl

@rm-rf-etc
Copy link
Contributor

Seems like Yubikey is important. Vault is advertised as better than Dropbox for storing secrets but Dropbox supports Yubikey.

@limnick
Copy link

limnick commented Dec 14, 2018

Throwing in my +1 for this now 3 year old request!

@martin-sucha
Copy link

@gfraetis a possible workaround how you can use yubikeys with vault is to setup an OpenID Connect auth provider instead that allows to enforce 2FA with yubikey via U2F/Webauthn and let the yubikey be checked as part of login to that provider in web browser. https://www.vaultproject.io/docs/auth/jwt_oidc_providers.html

@gfraetis
Copy link

@gfraetis a possible workaround how you can use yubikeys with vault is to setup an OpenID Connect auth provider instead that allows to enforce 2FA with yubikey via U2F/Webauthn and let the yubikey be checked as part of login to that provider in web browser. https://www.vaultproject.io/docs/auth/jwt_oidc_providers.html

Awesome thank you. My google-fu let me down on this one :) Thanks!

@viralpoetry
Copy link

You can authenticate to Vault by leveraging pkcs11 support in curl with Vault's TLS certificates auth method. Step by step guide:
https://www.malgregator.com/post/vault-authentication-with-yubikey/

@aphorise
Copy link
Contributor

aphorise commented Aug 8, 2020

Unfortunately I've not yet got my Yubikey - however I wondering if support for this may already be in place via HSM?

Aside from TLS / Certificate based authentication with Vault involving Yubikey that's well covered in the article above (by Arthur Rainwater) - I'm wondering if anyone has actually tried something like:

seal "pkcs11" {
        lib             = "/usr/lib/x86_64-linux-gnu/pkcs11/p11-kit-trust.so"
        slot            = "1969300112"
        pin             = "1234"
        key_label       = "hsm:v1:vault-yubi"
        hmac_key_label  = "hsm:v1:vault-yubi-hmac"
        generate_key    = "true"
        #mechanism      = "0x1087"  # // correct value may be needed
        #hmac_mechanism = "0x0251"  # // correct value may be needed
}

Any other pre-Vault / OS configuration and initialisation would be via CLI pkcs11-tool, p11tool, ykman, yubico-piv-tool or any other manufacture specific utility that's provided when dealing with HSM devices typically.

Is this issue still applicable?

@bruj0
Copy link
Contributor

bruj0 commented Oct 20, 2020

I finished the implementation of such an auth backend and you can test it at https://github.com/bruj0/vault-plugin-auth-u2f

@Ramblurr
Copy link

I'm wondering if anyone has actually tried something like:

Using a OpenPGP smartcard (such as a yubikey) as a way to auto-unseal vault would be great indeed!

@viralpoetry
Copy link

@Ramblurr as the most smartcards those days are based on pkcs11 and are basically small HSMs, I believe it's already possible, but only with an enterprise offering.

@anoncam
Copy link

anoncam commented Jan 28, 2021

I am using Vault Enterprise 1.6.1 and I would like to use Yubikey as an auth backend. It would be sweet to do this without having to use a pkcs11 seal

@bruj0
Copy link
Contributor

bruj0 commented Jan 28, 2021

I am using Vault Enterprise 1.6.1 and I would like to use Yubikey as an auth backend. It would be sweet to do this without having to use a pkcs11 seal

You can do it: https://github.com/bruj0/vault-plugin-auth-u2f

@anoncam
Copy link

anoncam commented Jan 29, 2021

I am using Vault Enterprise 1.6.1 and I would like to use Yubikey as an auth backend. It would be sweet to do this without having to use a pkcs11 seal

You can do it: https://github.com/bruj0/vault-plugin-auth-u2f

you are a scholar and a gentleman

@Ramblurr
Copy link

@Ramblurr as the most smartcards those days are based on pkcs11 and are basically small HSMs, I believe it's already possible, but only with an enterprise offering.

Ah, we do not use vault enterprise, so this won't be an option.

@arvid-r
Copy link

arvid-r commented Apr 8, 2021

I want this too! Will try the plug-in, thanks for sharing.

@npwork
Copy link

npwork commented Jul 14, 2021

+1

@heatherezell heatherezell added the community-sentiment Tracking high-profile issues from the community label Oct 12, 2021
@ZenSecurity
Copy link

+1

@AlexHunterCodes
Copy link

This thread has lots of people subscribed, so can folk please use reactions on existing comments instead of posting "+1" or 👍 and pinging everyone? Thanks!

@Bralva
Copy link

Bralva commented Oct 16, 2023

+1

1 similar comment
@tetofonta
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-sentiment Tracking high-profile issues from the community enhancement
Projects
None yet
Development

No branches or pull requests