git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-http-backend auth via Kerberos
@ 2014-12-18 22:19 Dan Langille (dalangil)
  2014-12-18 22:54 ` brian m. carlson
  0 siblings, 1 reply; 40+ messages in thread
From: Dan Langille (dalangil) @ 2014-12-18 22:19 UTC (permalink / raw)
  To: git@vger.kernel.org

I am trying to get http://git-scm.com/docs/git-http-backend to auth via Kerberos.

I have success when a Kerberos ticket is present.

I am trying to get git to authenticate with Kerberos when a ticket is not present.

Here is what succeeds with a ticket:

<Location /git>
  SSLOptions +StdenvVars
  Options +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch

    # By default, allow access to anyone.
    Order allow,deny
    Allow from All

    # Enable Kerberos authentication using mod_auth_kerb.
    AuthType Kerberos
    AuthName “us.example.com"
    KrbAuthRealm us.example.com
    Krb5KeyTab /usr/local/etc/apache22/repo-test.keytab
    KrbMethodNegotiate on
    KrbSaveCredentials on
    KrbVerifyKDC on
    KrbServiceName Any
    Require valid-user
</Location>

This is what happens without a valid ticket:

$ git clone https://us.example.com/git/clamav-bytecode-compiler
Cloning into 'clamav-bytecode-compiler'...
Username for 'https://us.example.com': dan
Password for 'https://dan@us.example.com': 
fatal: Authentication failed for 'https://us.example.com/git/clamav-bytecode-compiler/'

Of note, I see this in the Apache logs:

Thu Dec 18 16:43:35 2014] [debug] src/mod_auth_kerb.c(1749): [client 10.7.69.10] kerb_authenticate_user entered with user (NULL) and auth_type Kerberos

Ideas?  Suggestions?  Hints?  Thanks.

— 
Dan Langille
Infrastructure & Operations
Talos Group
Sourcefire, Inc.


^ permalink raw reply	[flat|nested] 40+ messages in thread
* [PATCH v2] remote-curl: fall back to basic auth if Negotiate fails
@ 2021-02-16 16:57 Christopher via GitGitGadget
  2021-03-22 11:51 ` [PATCH v3] " Christopher via GitGitGadget
  0 siblings, 1 reply; 40+ messages in thread
From: Christopher via GitGitGadget @ 2021-02-16 16:57 UTC (permalink / raw)
  To: git; +Cc: Eric Wong, Christopher, Christopher Schenk

From: Christopher Schenk <christopher@cschenk.net>

When the username and password are supplied in a url like this
https://myuser:secret@git.exampe/myrepo.git and the server supports the
negotiate authenticaten method git does not fall back to basic auth and
libcurl hardly tries to authenticate with the negotiate method.

Stop using the Negotiate authentication method after the first failure
because if it fails on the first try it will never succeed.

V1 of this patch somehow did not make it to the mailing list so i will
try to send this patch again

Signed-off-by: Christopher Schenk <christopher@cschenk.net>
---
    remote-curl: fall back to basic auth if Negotiate fails
    
    When the username and password are supplied in a url like this
    https://myuser:secret@git.exampe/myrepo.git and the server supports the
    negotiate authenticaten method git does not fall back to basic auth and
    libcurl hardly tries to authenticate with the negotiate method.
    
    Stop using the Negotiate authentication method after the first failure
    because if it fails on the first try it will never succeed.
    
    Signed-off-by: Christopher Schenk christopher@cschenk.net

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-849%2Fchschenk%2Fkerberos-basic-fallback-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-849/chschenk/kerberos-basic-fallback-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/849

Range-diff vs v1:

 1:  285a8a568444 ! 1:  7bfc0b431910 remote-curl: fall back to basic auth if Negotiate fails
     @@ Commit message
          Stop using the Negotiate authentication method after the first failure
          because if it fails on the first try it will never succeed.
      
     +    V1 of this patch somehow did not make it to the mailing list so i will
     +    try to send this patch again
     +
          Signed-off-by: Christopher Schenk <christopher@cschenk.net>
      
       ## http.c ##


 http.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/http.c b/http.c
index 8b23a546afdf..36f113d46c23 100644
--- a/http.c
+++ b/http.c
@@ -1642,6 +1642,14 @@ static int handle_curl_result(struct slot_results *results)
 		return HTTP_MISSING_TARGET;
 	else if (results->http_code == 401) {
 		if (http_auth.username && http_auth.password) {
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
+			if (results->auth_avail & CURLAUTH_GSSNEGOTIATE) {
+				http_auth_methods &= ~CURLAUTH_GSSNEGOTIATE;
+				http_auth_methods &= results->auth_avail;
+				http_auth_methods_restricted = 1;
+				return HTTP_REAUTH;
+			}
+#endif
 			credential_reject(&http_auth);
 			return HTTP_NOAUTH;
 		} else {

base-commit: 71ca53e8125e36efbda17293c50027d31681a41f
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2021-03-22 11:52 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-18 22:19 git-http-backend auth via Kerberos Dan Langille (dalangil)
2014-12-18 22:54 ` brian m. carlson
2014-12-19 15:07   ` Dan Langille (dalangil)
2014-12-19 15:50     ` Dan Langille (dalangil)
2014-12-19 16:07     ` Dan Langille (dalangil)
2014-12-19 20:16     ` brian m. carlson
2014-12-19 20:57       ` Dan Langille (dalangil)
2014-12-27  4:01         ` [PATCH] remote-curl: fall back to Basic auth if Negotiate fails brian m. carlson
2014-12-27 17:56           ` Jeff King
2014-12-27 21:09             ` brian m. carlson
2014-12-27 21:29               ` Jeff King
2014-12-28  0:05                 ` brian m. carlson
2015-01-01 19:56           ` [PATCH v2] " brian m. carlson
2015-01-03 11:19             ` Jeff King
2015-01-03 17:45               ` brian m. carlson
2015-01-03 20:14                 ` Jeff King
2015-01-05 16:02             ` Dan Langille (dalangil)
2015-01-05 21:23             ` Dan Langille (dalangil)
2015-01-05 23:53               ` brian m. carlson
2015-01-06 15:31                 ` Dan Langille (dalangil)
2015-01-06 15:41                   ` Dan Langille (dalangil)
2015-01-06 16:07                   ` Dan Langille (dalangil)
2015-01-08  0:02                     ` brian m. carlson
2015-01-08  0:29             ` [PATCH v3] " brian m. carlson
2015-01-20 16:40               ` Dan Langille (dalangil)
2015-01-21  0:22                 ` Junio C Hamano
2015-01-22 14:47                   ` Dan Langille (dalangil)
2015-02-17 23:05                   ` Dan Langille (dalangil)
2015-02-17 23:36                     ` Junio C Hamano
2015-02-18 16:17                       ` Dan Langille (dalangil)
2015-02-19 20:35                         ` brian m. carlson
2015-02-24 21:03                           ` Dan Langille (dalangil)
2015-02-25 20:59                             ` Dan Langille (dalangil)
2015-03-10 18:05                               ` Dan Langille (dalangil)
2015-03-10 22:29                                 ` brian m. carlson
2015-03-11 19:33                                   ` Dan Langille (dalangil)
2015-03-11 21:59                                     ` brian m. carlson
2015-03-12 13:09                                       ` Dan Langille (dalangil)
2015-01-05 13:12           ` [PATCH] " Dan Langille (dalangil)
  -- strict thread matches above, loose matches on Subject: below --
2021-02-16 16:57 [PATCH v2] remote-curl: fall back to basic " Christopher via GitGitGadget
2021-03-22 11:51 ` [PATCH v3] " Christopher via GitGitGadget

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).