Discussion:
Trusted users
Kurt Granroth
2010-07-22 21:46:13 UTC
Permalink
The 'trusted' users feature has never worked for me and since it's just
been a tiny annoyance (extra warning message), I never took the time to
dig into it. Well, I did now... and it's not working the way I expect
it to.

I'm using the 'mercurial-server' package so all repo access goes through
the 'hg' user. I have a local user on the server called 'hgadmin' that
is in the same 'hg' group and can modify the repos locally if necessary.

So I create a repo on the server using the 'hgadmin' user and create a
simple hgrc file:

***@hgserv$ ls -l test/.hg/hgrc
-rw-rw-r-- 1 hgadmin hg 46 Jul 22 14:36 test/.hg/hgrc

I clone that from my workstation as the 'kurt' user:

***@local$ hg clone ssh://***@hgserv/test
destination directory: test
requesting all changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 3 changes to 2 files
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
remote: Not trusting file test/.hg/hgrc from untrusted user hgadmin,
group hg
remote: Not trusting file /home/hg/repos/test/.hg/hgrc from untrusted
user hgadmin, group hg

Okay, so hgadmin is untrusted. Let's try to change that. I edit the
'hg' user's .hgrc:

***@hgserv$ tail ~hg/.hgrc
[trusted]
users = hgadmin,hg
groups = hg

Try again.. and still no go. I get the same "untrusted user" message.
So maybe the trusted part is in the local user and not the remote user?

***@local$ tail ~kurt/.hgrc
[trusted]
users = hgadmin,hg
groups = hg

Try again... and still nope.

So where should the 'trusted' user section go in order to not get that
warning message any more?

Kurt
Matt Mackall
2010-07-22 22:35:54 UTC
Permalink
Post by Kurt Granroth
Okay, so hgadmin is untrusted. Let's try to change that. I edit the
[trusted]
users = hgadmin,hg
groups = hg
Ok, and who owns _that_ file?

Also, are you sure it's being read when going through mercurial-server?

More info about trust here: http://mercurial.selenic.com/wiki/Trust
--
Mathematics is the supreme nostalgia of our time.
Kurt Granroth
2010-07-23 04:37:31 UTC
Permalink
Post by Matt Mackall
Post by Kurt Granroth
Okay, so hgadmin is untrusted. Let's try to change that. I edit the
[trusted]
users = hgadmin,hg
groups = hg
Ok, and who owns _that_ file?
That's owned by the hg user.

I went a step further and put the [trusted] section in the
/etc/mercurial/hgrc (readable by all) to see if that made a difference.
Nope.
Post by Matt Mackall
Also, are you sure it's being read when going through mercurial-server?
Ah, so let's try another user:

***@local$ hg clone ssh://***@hgserv//home/hg/repos/test
destination directory: test
requesting all changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 3 changes to 2 files
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

Eh? No warning about the trusted users. Oh, right... I forgot that I
still had the global [trusted] set in the top-level hgrc. Disable that
and run again:

***@local$ hg clone ssh://***@hgserv//home/hg/repos/test
[snip]
remote: Not trusting file test/.hg/hgrc from untrusted user hgadmin,
group hg
remote: Not trusting file /home/hg/repos/test/.hg/hgrc from untrusted
user hgadmin, group hg

That's it! It's definitely related to the mercurial-server package.
But how? As far as I can tell, that package (in hg-ssh) just calls 'hg'
directly. So maybe it's somehow not reading the various hgrc files? Is
there a setting for that?
Post by Matt Mackall
More info about trust here: http://mercurial.selenic.com/wiki/Trust
That was my starting point. It's definitely good info... albeit a tiny
bit confusing when doing this remotely since all of the examples assume
that everybody is on the same box. Still, it makes sense when you think
about it.
Matt Mackall
2010-07-23 14:34:15 UTC
Permalink
Post by Kurt Granroth
That's it! It's definitely related to the mercurial-server package.
But how? As far as I can tell, that package (in hg-ssh) just calls 'hg'
directly. So maybe it's somehow not reading the various hgrc files? Is
there a setting for that?
I think you'll have to ask them. I couldn't figure it out from poking at
the source for a couple minutes. Perhaps they're setting HGRCPATH
somewhere.
Post by Kurt Granroth
Post by Matt Mackall
More info about trust here: http://mercurial.selenic.com/wiki/Trust
That was my starting point. It's definitely good info... albeit a tiny
bit confusing when doing this remotely since all of the examples assume
that everybody is on the same box. Still, it makes sense when you think
about it.
I added a section about ssh.
--
Mathematics is the supreme nostalgia of our time.
Loading...