From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: "Michal Suchánek" <msuchanek@suse.de>,
"David C. Rankin" <drankinatty@gmail.com>,
git@vger.kernel.org
Subject: Re: Local git server can't serve https until repos owned by http, can't serve ssh unless repos owned by user after 2.45.1
Date: Tue, 25 Jun 2024 09:12:38 -0700 [thread overview]
Message-ID: <xmqqr0cl6lxl.fsf@gitster.g> (raw)
In-Reply-To: <20240625072419.GU19642@kitsune.suse.cz> ("Michal Suchánek"'s message of "Tue, 25 Jun 2024 09:24:19 +0200")
Dscho, the f4aa8c8b (fetch/clone: detect dubious ownership of local
repositories, 2024-04-10) is your brainchild and people seem to be
unhappy about having to adjust their settings. Are there any advice
you can offer them?
Michal Suchánek <msuchanek@suse.de> writes:
> On Mon, Jun 17, 2024 at 11:15:13PM +0200, Michal Suchánek wrote:
>> Hello,
>>
>> On Mon, Jun 17, 2024 at 11:47:20AM -0700, Junio C Hamano wrote:
>> > "David C. Rankin" <drankinatty@gmail.com> writes:
>> >
>> > > Security enhancement in 2.45.1 have broken ability to serve git over
>> > > https and ssh from local git server running Apache. (web server runs
>> > > as http:http on Archlinux)
>> > >
>> > > The fix of adding the following to gitconfig (system-wide and
>> > > per-user in ~/.gitconfig) does not solve the problem:
>> > >
>> > > [safe]
>> > > directory = *
>> >
>> > It is not clear what you exactly meant "per-user" above, so just to
>> > make sure. Is this set in the global configuration file for the
>> > httpd (or whoever Apache runs as) user?
>> >
>> > The purpose of "dubious ownershop" thing is to protect the user who
>> > runs Git from random repositories' with potentially malicious hooks
>> > and configuration files, so the user being protected (in this case,
>> > whoever Apache runs as) needs to declare "I trust these
>> > repositories" in its ~/.gitconfig file. What individual owners of
>> > /srv/my-repo.git/ project has in their ~/.gitconfig file does not
>> > matter when deciding if Apache trusts these repositories.
>>
>>
>> looks like the semantic of 'dubious ownershop' changed recently.
>>
>> Disro backport of fixes for CVE-2024-32002 CVE-2024-32004 CVE-2024-32020
>> CVE-2024-32021 CVE-2024-32465 to 2.35.3 broke git-daemon. No amount of
>> whitelisting makes the 'fixed' git serve the repository.
>
> Same regression between 2.45.0 and 2.45.2 which allegedly fixes the
> same CVEs.
>
> Looks like downgrading to gaping hole version is needed to serve repositories
> in general.
>
> Please consider adjusting the fix so that repositories can still be served.
>
> Thanks
>
> Michal
>
> To reproduce:
>
> cat /usr/local/bin/git-ping
> #!/bin/sh -e
>
> # Try connecting to one or more remote repository URLs
>
> while true ; do
> git ls-remote -h "$1" >/dev/null
> shift
> [ -n "$1" ] || break
> done
>
> mkdir -p /srv/git/some
> chown hramrach /srv/git/some
> su hramrach -c "git init --bare /srv/git/some/repo.git"
> su hramrach -c "touch /srv/git/some/repo.git/git-daemon-export-ok"
> version=2.35.3-150300.10.36.1 ; zypper in --oldpackage git-core-$version git-daemon-$version
> systemctl start git-daemon.service
> git ping git://localhost/some/repo.git
> <nothing>
>
> version=2.35.3-150300.10.39.1 ; zypper in --oldpackage git-core-$version git-daemon-$version
> systemctl restart git-daemon.service
> git ping git://localhost/some/repo.git
> fatal: Could not read from remote repository.
>
> Please make sure you have the correct access rights
> and the repository exists.
>
>
> systemctl status git-daemon.service
> ● git-daemon.service - Git Daemon
> Loaded: loaded (/usr/lib/systemd/system/git-daemon.service; disabled; vendor preset: disabled)
> Active: active (running) since Thu 2024-06-06 08:29:28 CEST; 6min ago
> Main PID: 31742 (git)
> Tasks: 2 (limit: 4915)
> CGroup: /system.slice/git-daemon.service
> ├─ 31742 git daemon --reuseaddr --base-path=/srv/git/ --user=git-daemon --group=nogroup
> └─ 31749 /usr/lib/git/git-daemon --reuseaddr --base-path=/srv/git/ --user=git-daemon --group=nogroup
>
> Jun 06 08:29:28 localhost.localdomain systemd[1]: Started Git Daemon.
> Jun 06 08:29:39 localhost.localdomain git-daemon[31756]: fatal: detected dubious ownership in repository at '/srv/git//some/repo.git'
> Jun 06 08:29:39 localhost.localdomain git-daemon[31756]: To add an exception for this directory, call:
> Jun 06 08:29:39 localhost.localdomain git-daemon[31756]: git config --global --add safe.directory /srv/git//some/repo.git
>
> git config --global --add safe.directory /srv/git//some/repo.git
> mv ~/.gitconfig /etc/gitconfig
> git ping git://localhost/some/repo.git
> fatal: Could not read from remote repository.
>
> Please make sure you have the correct access rights
> and the repository exists.
>
> git config --global --add safe.directory /srv/git/some/repo.git
> mv ~/.gitconfig /etc/gitconfig
> git ping git://localhost/some/repo.git
> fatal: Could not read from remote repository.
>
> Please make sure you have the correct access rights
> and the repository exists.
next prev parent reply other threads:[~2024-06-25 16:12 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 0:36 Local git server can't serve https until repos owned by http, can't serve ssh unless repos owned by user after 2.45.1 David C. Rankin
2024-06-17 18:47 ` Junio C Hamano
2024-06-17 21:15 ` Michal Suchánek
2024-06-25 7:24 ` Michal Suchánek
2024-06-25 16:12 ` Junio C Hamano [this message]
2024-06-25 18:34 ` Michal Suchánek
2024-06-26 13:03 ` Phillip Wood
2024-06-26 18:14 ` Junio C Hamano
2024-06-26 18:35 ` Phillip Wood
2024-06-26 18:51 ` Junio C Hamano
2024-09-25 11:34 ` Michal Suchánek
2024-08-29 20:34 ` Joey Hess
2024-07-26 0:38 ` Jamie Landeg-Jones
2024-07-26 5:58 ` David C. Rankin
2024-07-28 3:46 ` Jamie Landeg-Jones
2024-07-28 6:57 ` David C. Rankin
2024-08-01 0:15 ` [SOLVED] " Jamie Landeg-Jones
2024-08-02 19:31 ` Junio C Hamano
2024-06-18 1:08 ` David C. Rankin
2024-06-24 14:53 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqr0cl6lxl.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=drankinatty@gmail.com \
--cc=git@vger.kernel.org \
--cc=msuchanek@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).