* [QUESTION]Is it possible that git would support two-factor authentication? @ 2021-08-11 11:00 lilinchao 2021-08-11 13:50 ` Konstantin Ryabitsev ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: lilinchao @ 2021-08-11 11:00 UTC (permalink / raw) To: git; +Cc: Jeff King Many websites support two-factor authentication(2FA) to log in, like Github, I wander if we can support it in application layer. When client clone something, they need input username and password, it is like a website login process. For security, we can enable 2FA during this process. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [QUESTION]Is it possible that git would support two-factor authentication? 2021-08-11 11:00 [QUESTION]Is it possible that git would support two-factor authentication? lilinchao @ 2021-08-11 13:50 ` Konstantin Ryabitsev 2021-08-11 15:23 ` Theodore Ts'o 2021-08-13 22:56 ` brian m. carlson 2021-08-11 13:54 ` Derrick Stolee [not found] ` <9b199de2faab11eba548a4badb2c2b1195555@gmail.com> 2 siblings, 2 replies; 8+ messages in thread From: Konstantin Ryabitsev @ 2021-08-11 13:50 UTC (permalink / raw) To: lilinchao@oschina.cn; +Cc: git, Jeff King On Wed, Aug 11, 2021 at 07:00:50PM +0800, lilinchao@oschina.cn wrote: > Many websites support two-factor authentication(2FA) to log in, like Github, I wander if we can support it in application layer. > When client clone something, they need input username and password, it is like a website login process. For security, we can > enable 2FA during this process. As you well know, "cloning" a repository can be done via any number of mechanisms: 1. locally from another repository on disk 2. locally, from a git bundle file 3. remotely, using the anonymous git:// protocol 4. remotely, using ssh or http(s) protocols 2-factor authentication does not make sense in the first three cases (you already have access to all the objects with 1 and 2, and the git:// protocol is public and anonymous by design). For the ssh/https scheme, 2fa is already supported by the underlying protocol, so it does not make sense for git to implement it again on the application level. Hope this helps. -K ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [QUESTION]Is it possible that git would support two-factor authentication? 2021-08-11 13:50 ` Konstantin Ryabitsev @ 2021-08-11 15:23 ` Theodore Ts'o 2021-08-13 22:56 ` brian m. carlson 1 sibling, 0 replies; 8+ messages in thread From: Theodore Ts'o @ 2021-08-11 15:23 UTC (permalink / raw) To: Konstantin Ryabitsev; +Cc: lilinchao@oschina.cn, git, Jeff King On Wed, Aug 11, 2021 at 09:50:55AM -0400, Konstantin Ryabitsev wrote: > On Wed, Aug 11, 2021 at 07:00:50PM +0800, lilinchao@oschina.cn wrote: > > Many websites support two-factor authentication(2FA) to log in, > > like Github, I wander if we can support it in application layer. > > When client clone something, they need input username and > > password, it is like a website login process. For security, we can > > enable 2FA during this process. > > As you well know, "cloning" a repository can be done via any number of > mechanisms: > > 1. locally from another repository on disk > 2. locally, from a git bundle file > 3. remotely, using the anonymous git:// protocol > 4. remotely, using ssh or http(s) protocols > > 2-factor authentication does not make sense in the first three cases (you > already have access to all the objects with 1 and 2, and the git:// protocol > is public and anonymous by design). For the ssh/https scheme, 2fa is already > supported by the underlying protocol, so it does not make sense for git to > implement it again on the application level. It might be helpful to be explicit about what *kind* of two-factor authentication you are interested in. There are multiple different kinds of 2FA systems, including ssh keys stored on a hardware token such as a smartcard or a Yuibikey, U2F Fido systems using a security key, TOTP or HOTP otp systems, etc. Each of these systems have different tradeoffs in terms of ease of use from the user perspective (both from the point of view of initial setup and day-to-day use after getting set up), security against MITM attacks, and ease of integration/deployment from the system administrator's perspective. Cheers, - Ted ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [QUESTION]Is it possible that git would support two-factor authentication? 2021-08-11 13:50 ` Konstantin Ryabitsev 2021-08-11 15:23 ` Theodore Ts'o @ 2021-08-13 22:56 ` brian m. carlson 1 sibling, 0 replies; 8+ messages in thread From: brian m. carlson @ 2021-08-13 22:56 UTC (permalink / raw) To: Konstantin Ryabitsev; +Cc: lilinchao@oschina.cn, git, Jeff King [-- Attachment #1: Type: text/plain, Size: 1619 bytes --] On 2021-08-11 at 13:50:55, Konstantin Ryabitsev wrote: > 2-factor authentication does not make sense in the first three cases (you > already have access to all the objects with 1 and 2, and the git:// protocol > is public and anonymous by design). For the ssh/https scheme, 2fa is already > supported by the underlying protocol, so it does not make sense for git to > implement it again on the application level. To expand on this a little bit, you can absolutely set up a Git server with OpenSSH and require 2FA with OpenSSH. That should work just fine. You could also leverage a custom credential helper for HTTPS to require a 2FA code, send it to a server, which would issue a one-time token for Basic auth. All of this is achievable with existing tooling that we have today or tooling that can be easily built. One note here is that as a practical matter, many people require automated cloning of repositories, such as to use their CI systems. Those systems generally cannot practically use 2FA and the security would not be improved if they did, so some solution that allows for that to work is going to be required. Also, in workflows that require many repositories to be cloned, it can be kind of a hassle to wait for one clone to complete, enter the 2FA code (or touch the YubiKey) for the second clone, wait for it to complete, do 2FA for the third clone, and so on. So while you can do this, it's important to keep in mind that there are some user experience tradeoffs here that need to be considered as well. -- brian m. carlson (he/him or they/them) Toronto, Ontario, CA [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 262 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [QUESTION]Is it possible that git would support two-factor authentication? 2021-08-11 11:00 [QUESTION]Is it possible that git would support two-factor authentication? lilinchao 2021-08-11 13:50 ` Konstantin Ryabitsev @ 2021-08-11 13:54 ` Derrick Stolee [not found] ` <9b199de2faab11eba548a4badb2c2b1195555@gmail.com> 2 siblings, 0 replies; 8+ messages in thread From: Derrick Stolee @ 2021-08-11 13:54 UTC (permalink / raw) To: lilinchao@oschina.cn, git; +Cc: Jeff King, mjcheetham On 8/11/2021 7:00 AM, lilinchao@oschina.cn wrote: > Many websites support two-factor authentication(2FA) to log in, like Github, I wander if we can support it in application layer. > When client clone something, they need input username and password, it is like a website login process. For security, we can > enable 2FA during this process. Typically, this is handled at the credential helper layer, which is a tool outside of the Git codebase that can more closely work with such 2FA/MFA requirements. For example, GCM Core [1] supports 2FA with GitHub, Azure DevOps, and BitBucket. [1] https://github.com/microsoft/Git-Credential-Manager-Core The mechanism is that Git attempts an operation and gets an error code, so it asks for a credential from the helper. The helper then communicates with the server to do whatever authentication is required, including possibly performing multi-factor auth. All of these details are hidden from Git, which is good. I've CC'd Matthew Cheetham who is the maintainer of GCM Core to correct me if I misstated anything here. Thanks, -Stolee ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <9b199de2faab11eba548a4badb2c2b1195555@gmail.com>]
* Re: Re: [QUESTION]Is it possible that git would support two-factor authentication? [not found] ` <9b199de2faab11eba548a4badb2c2b1195555@gmail.com> @ 2021-08-13 7:49 ` lilinchao 2021-08-14 22:02 ` Johannes Schindelin 0 siblings, 1 reply; 8+ messages in thread From: lilinchao @ 2021-08-13 7:49 UTC (permalink / raw) To: Derrick Stolee, git; +Cc: Jeff King, mjcheetham >On 8/11/2021 7:00 AM, lilinchao@oschina.cn wrote: >> Many websites support two-factor authentication(2FA) to log in, like Github, I wander if we can support it in application layer. >> When client clone something, they need input username and password, it is like a website login process. For security, we can >> enable 2FA during this process. > >Typically, this is handled at the credential helper layer, which >is a tool outside of the Git codebase that can more closely work >with such 2FA/MFA requirements. For example, GCM Core [1] supports >2FA with GitHub, Azure DevOps, and BitBucket. > >[1] https://github.com/microsoft/Git-Credential-Manager-Core > >The mechanism is that Git attempts an operation and gets an error >code, so it asks for a credential from the helper. The helper >then communicates with the server to do whatever authentication >is required, including possibly performing multi-factor auth. >All of these details are hidden from Git, which is good. > Indeed, this is good, I've experienced this tool these days at WSL and Windows, but finally I hope these features can be supported by Git itself, and then the user end can easily configure it. >I've CC'd Matthew Cheetham who is the maintainer of GCM Core to >correct me if I misstated anything here. Thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Re: [QUESTION]Is it possible that git would support two-factor authentication? 2021-08-13 7:49 ` lilinchao @ 2021-08-14 22:02 ` Johannes Schindelin [not found] ` <BEBB4A79-9773-4701-A8C5-06C20AB42686@github.com> 0 siblings, 1 reply; 8+ messages in thread From: Johannes Schindelin @ 2021-08-14 22:02 UTC (permalink / raw) To: lilinchao@oschina.cn; +Cc: Derrick Stolee, git, Jeff King, mjcheetham [-- Attachment #1: Type: text/plain, Size: 1463 bytes --] Hi, On Fri, 13 Aug 2021, lilinchao@oschina.cn wrote: > >On 8/11/2021 7:00 AM, lilinchao@oschina.cn wrote: > >> Many websites support two-factor authentication(2FA) to log in, like Github, I wander if we can support it in application layer. > >> When client clone something, they need input username and password, it is like a website login process. For security, we can > >> enable 2FA during this process. > > > >Typically, this is handled at the credential helper layer, which > >is a tool outside of the Git codebase that can more closely work > >with such 2FA/MFA requirements. For example, GCM Core [1] supports > >2FA with GitHub, Azure DevOps, and BitBucket. > > > >[1] https://github.com/microsoft/Git-Credential-Manager-Core > > > >The mechanism is that Git attempts an operation and gets an error > >code, so it asks for a credential from the helper. The helper > >then communicates with the server to do whatever authentication > >is required, including possibly performing multi-factor auth. > >All of these details are hidden from Git, which is good. > > > Indeed, this is good, I've experienced this tool these days at WSL and Windows, > but finally I hope these features can be supported by Git itself, and then the user end can easily configure it. The problem here is that 2FA is highly provider-specific. And that's why Git itself refuses to implement it. Hence the credential helper layer. Ciao, Johannes ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <BEBB4A79-9773-4701-A8C5-06C20AB42686@github.com>]
[parent not found: <1F2C610F-8800-466A-A0CA-7A6068A14805@github.com>]
[parent not found: <D8CFA50F-266A-4995-8058-D29A2D490D5F@github.com>]
* Re: [QUESTION]Is it possible that git would support two-factor authentication? [not found] ` <D8CFA50F-266A-4995-8058-D29A2D490D5F@github.com> @ 2021-08-17 10:19 ` Matthew Cheetham 0 siblings, 0 replies; 8+ messages in thread From: Matthew Cheetham @ 2021-08-17 10:19 UTC (permalink / raw) To: Johannes Schindelin, lilinchao@oschina.cn; +Cc: Derrick Stolee, git, Jeff King (Re-sending, this time without HTML) Hello! > On 14 Aug 2021, at 11:02 pm, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > > Hi, > > On Fri, 13 Aug 2021, lilinchao@oschina.cn wrote: > >>> On 8/11/2021 7:00 AM, lilinchao@oschina.cn wrote: >>>> Many websites support two-factor authentication(2FA) to log in, like Github, I wander if we can support it in application layer. >>>> When client clone something, they need input username and password, it is like a website login process. For security, we can >>>> enable 2FA during this process. >>> >>> Typically, this is handled at the credential helper layer, which >>> is a tool outside of the Git codebase that can more closely work >>> with such 2FA/MFA requirements. For example, GCM Core [1] supports >>> 2FA with GitHub, Azure DevOps, and BitBucket. >>> >>> [1] https://github.com/microsoft/Git-Credential-Manager-Core >>> >>> The mechanism is that Git attempts an operation and gets an error >>> code, so it asks for a credential from the helper. The helper >>> then communicates with the server to do whatever authentication >>> is required, including possibly performing multi-factor auth. >>> All of these details are hidden from Git, which is good. >>> >> Indeed, this is good, I've experienced this tool these days at WSL and Windows, >> but finally I hope these features can be supported by Git itself, and then the user end can easily configure it. > > The problem here is that 2FA is highly provider-specific. And that's why > Git itself refuses to implement it. Hence the credential helper layer. > > Ciao, > Johannes Johannes and Derrick are correct. Sadly, there is no standard “modern" authentication/authorization stack that Git could support in practice. You may think of OAuth2.0 as being a good choice, and you’d be right for the most part! However there are several shortcomings today. Plenty of vendors implement OAuth2 in different ways (technically they’re not following RFC 6749 [1]), or have extensions to the specification that end up being required for most use. At the same time there’s no standard discovery mechanism for the various required endpoints to avoid having the Git project “hardcode” this configuration for each provider - the Git project should be agnostic. OpenID Connect [2] extends OAuth2 with some useful things like endpoint discovery [3], but that is also optional to implement and still requires some server-side registration and administration (that is vendor specific). There’s also the question of user interaction. Often this is tied to specific, opinionated choices like: user agent (browser), operating system integrations, YubiKey or custom multi-factor authentication solutions (SMS? biometrics? OTP apps?). There may be more that Git can do to surface authN/Z challenges to a credential helper (such at Git Credential Manager [4]) that might help in making auth in a post-password world less painful. The project is open to contributions to any vendor or auth stack. [1] https://datatracker.ietf.org/doc/html/rfc6749 [2] https://openid.net/specs/openid-connect-core-1_0.html [3] https://openid.net/specs/openid-connect-discovery-1_0.html [4] https://aka.ms/gcmcore Thanks, Matthew ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-08-17 10:20 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-08-11 11:00 [QUESTION]Is it possible that git would support two-factor authentication? lilinchao 2021-08-11 13:50 ` Konstantin Ryabitsev 2021-08-11 15:23 ` Theodore Ts'o 2021-08-13 22:56 ` brian m. carlson 2021-08-11 13:54 ` Derrick Stolee [not found] ` <9b199de2faab11eba548a4badb2c2b1195555@gmail.com> 2021-08-13 7:49 ` lilinchao 2021-08-14 22:02 ` Johannes Schindelin [not found] ` <BEBB4A79-9773-4701-A8C5-06C20AB42686@github.com> [not found] ` <1F2C610F-8800-466A-A0CA-7A6068A14805@github.com> [not found] ` <D8CFA50F-266A-4995-8058-D29A2D490D5F@github.com> 2021-08-17 10:19 ` Matthew Cheetham
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).