git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: http-smart-backend: can clone, cannot push

From
ADAntonio García Domínguez <antonio.garciadominguez@uca.es>
Date
Jun 1, 2010, 16:59 UTC
Message-ID
<201006011900.01926.antonio.garciadominguez@uca.es>
In-Reply-To
<20100601155833.GT16470@spearce.org>
Hi all,
Show 5 quoted lines
> A flaw of the smart HTTP transport is the servers are
> nearly impossible to configure for anonymous clone and
> authenticated push via the same URL.  The servers just
> can't seem to be configured to require authentication
> for the $GIT_DIR/info/refs?service=git-receive-pack request.

Yeah, the problem seems to be that query string. Apache's <Location> doesn't help with that. However, you could add a custom authentication handler which checks the query part of the URL, right?

<shameless plug> In fact, I submitted a patch which adds smart HTTP integration to Redmine's Perl auth module at [1] and does just this. I've tested on a server I set up at my uni, and pretty much nowhere else :-/. Lines 250-254 should do just that: check the unparsed URI (possibly including the query string) for git- receive-pack at the end. That includes .../git-receive-pack and .../refs?service=git-receive-pack.

Perhaps you could take just the parts you need from the patched Redmine.pm file. </shameless plug>

Another option could be using RewriteCond to set an environment variable depending on REQUEST_URI and QUERY_STRING [2] and use "Allow from env=..." [3]. I think it should be simpler than writing and installing an authentication handler, but I'm not sure, either. I'm mostly limited to Apache here: perhaps it can be easier with other web servers.

[1]: http://www.redmine.org/attachments/3300/0001-Redmine.pm-add-Git-smart- HTTP-support-v4.patch [2]: http://www.phwinfo.com/forum/alt-apache-configuration/329880-regular- expressions-locationmatch.html#post1483835 [3]: http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#allow

Regards, Antonio

Previous: Shawn O. PearceNext: Jeremiah Foster
Message 7 of 9 in “http-smart-backend: can clone, cannot push”
  1. Jeremiah FosterJun 1, 2010
  2. Tay Ray ChuanJun 1, 2010
  3. Jeremiah FosterJun 1, 2010
  4. Tay Ray ChuanJun 1, 2010
  5. Jeremiah FosterJun 1, 2010
  6. Shawn O. PearceJun 1, 2010
  7. Antonio García DomínguezJun 1, 2010
  8. Jeremiah FosterJun 2, 2010
  9. Erik Faye-LundJun 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.