author | Paul Crowley <paul@lshift.net> |
Fri, 20 Feb 2009 14:29:48 +0000 | |
changeset 51 | d87eeeae29a5 |
parent 50 | 77d97aa18f29 |
child 57 | fdf8f5f0c283 |
permissions | -rw-r--r-- |
36
b3237aabd0fe
Change the name to mercurial-server
Paul Crowley <paul@lshift.net>
parents:
30
diff
changeset
|
1 |
mercurial-server |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
2 |
|
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
3 |
A set of tools for managing authorization and access control for |
12 | 4 |
ssh-based Mercurial repositories |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
5 |
|
50
77d97aa18f29
update dates and copyright notices
Paul Crowley <paul@lshift.net>
parents:
49
diff
changeset
|
6 |
Paul Crowley, paul@lshift.net, 2008-2009 |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
7 |
|
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
8 |
This software may be used and distributed according to the terms |
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
9 |
of the GNU General Public License, incorporated herein by reference. |
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
10 |
|
12 | 11 |
WHAT IT GIVES YOU |
12 |
||
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
13 |
These tools make it easier to provide a centralized repository host |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
14 |
with read/write access to many repositories for many developers. |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
15 |
|
49 | 16 |
All of the repositories controlled by these tools are owned by a single user |
17 |
(the "hg" user in what follows), but many remote users can act on them, and |
|
18 |
different users can have different permissions. We don't use file permissions to |
|
19 |
achieve that - instead, developers log in as the "hg" user when they connect to |
|
20 |
the repository host using ssh, using ssh URLs of the form |
|
21 |
"ssh://hg@repository-host/repository-name". A restricted shell prevents them |
|
22 |
from using this access for unauthorized purposes. Developers are authenticated |
|
23 |
only using SSH keys; no other form of authentication is supported. |
|
12 | 24 |
|
49 | 25 |
To give a user access to the repository, place their key in an |
26 |
appropriately-named subdirectory of "/etc/mercurial-server/keys" and run |
|
27 |
"/etc/mercurial-server/refresh-auth". You can then control what access they have |
|
28 |
to what repositories by editing the control file |
|
29 |
"/etc/mercurial-server/access.conf", which can match the names of these keys |
|
30 |
against a glob pattern. |
|
31 |
||
32 |
For convenient remote control of access, you can instead (if you have the |
|
33 |
privileges) make changes to a special repository called "hgadmin", which |
|
34 |
contains its own "access.conf" file and "keys" directory. Changes pushed to this |
|
35 |
repository take effect immediately. The two "access.conf" files are |
|
36 |
concatenated, and the keys directories merged. |
|
12 | 37 |
|
28
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
38 |
QUICK START |
12 | 39 |
|
49 | 40 |
You and all developers using this system will need an SSH public key, and will |
41 |
almost certainly want to be running ssh-agent (or its equivalent, eg Pageant |
|
42 |
under Windows). If you're not familiar with ssh-agent, you should learn about |
|
43 |
that before using this. |
|
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
44 |
|
49 | 45 |
In what follows, certain operations (eg installing mercurial-server itself) have |
46 |
to be done on the repository server (which we call "repository-host"), but any |
|
47 |
operation that involves checking in or out of Mercurial can be done wherever is |
|
48 |
most convenient to you; the most usual arrangment would be that you'd do these |
|
49 |
things at the machine you sit at, and on which you run ssh-agent, which is what |
|
50 |
authenticates you when you talk to the repository server. |
|
51 |
||
52 |
Ensure there is no user called "hg" on the repository host, and run "./install". |
|
53 |
This installs the mercurial-server files and control files, and creates and sets |
|
54 |
up the "hg" user. |
|
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
55 |
|
49 | 56 |
Place your SSH public key in the directory "/etc/mercurial-server/keys/root". I |
57 |
suggest creating yourself a directory and naming the key after your hostname (ie |
|
58 |
the file is called something like |
|
59 |
"/etc/mercurial-server/keys/root/yourname/yourhostname") so that you can easily |
|
60 |
manage users who have a different key on each host they use. Then run |
|
61 |
"/etc/mercurial-server/refresh-auth". |
|
62 |
||
63 |
The repository is now ready to use, and you are now the sole user able to change |
|
64 |
and create repositories on this repository host. |
|
65 |
||
66 |
CREATING REPOSITORIES |
|
67 |
||
68 |
To create a new repository, you clone a local repository onto the remote server. |
|
69 |
So if you want a new empty repository called "myproject", you can do (as |
|
70 |
yourself): |
|
71 |
||
72 |
hg init myproject |
|
73 |
hg clone myproject ssh://hg@repository-host/myproject |
|
74 |
||
75 |
ADDING OTHER USERS |
|
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
76 |
|
49 | 77 |
Because your key is in the "keys/root" subdirectory, you have the equivalent of |
78 |
"root privileges" over mercurial-server (not the whole computer, just |
|
79 |
mercurial-server). You can add other root users by putting their keys next to |
|
80 |
yours, or you can make less privileged users by putting their keys in the |
|
81 |
"keys/users" subdirectory - these users will be able to read and write to any |
|
82 |
repository (except one - see below) but will not be able to create new |
|
83 |
repositories. As always, when you change "/etc/mercurial-server/keys" you need |
|
84 |
to re-run "/etc/mercurial-server/refresh-auth". |
|
85 |
||
86 |
USING HGADMIN |
|
87 |
||
88 |
It can be inconvenient to log on to the repository server, become root, copy |
|
89 |
keys around, and run "refresh-auth" every time you want to change user |
|
90 |
privileges. This is where mercurial-server shines :-) Suppose you have another |
|
91 |
user's SSH public key in the file "/tmp/theirkey" (on the machine you sit at, |
|
92 |
not necessarily the repository server) and you want to give them user-level |
|
93 |
access to the repository server. Run these commands: |
|
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
94 |
|
49 | 95 |
hg clone ssh://hg@repository-server/hgadmin |
96 |
cd hgadmin |
|
97 |
mkdir keys/user/thatuser |
|
98 |
cp /tmp/theirkey keys/user/thatuser/theirhostname |
|
99 |
hg add |
|
100 |
hg commit -m "Added key for thatuser" |
|
101 |
hg push |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
102 |
|
49 | 103 |
In other words, hgadmin is a version controlled version of |
104 |
"/etc/mercurial-server/keys", and changes to it take effect immediately. Only |
|
105 |
"keys/root" users can act on "hgadmin" - those with keys in "keys/users" are |
|
106 |
locked out. Multiple admins can use Mercurial's version control to cooperate on |
|
107 |
controlling access to the repository server in a natural way. You can also add |
|
108 |
"root" users by putting their key in the "keys/root" directory in just the same |
|
109 |
way - these users will now be able to control hgadmin and create new |
|
110 |
repositories just as you can. |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
111 |
|
49 | 112 |
ACCESS.CONF |
13 | 113 |
|
49 | 114 |
Out of the box, there are just two kinds of users: the ones with keys in |
115 |
"keys/root" and those in "keys/users". However, you can change this by editing |
|
116 |
"access.conf". There are two "access.conf" files, one in "/etc/mercurial-server" |
|
117 |
and one in "hgadmin"; the two are simply concatenated before being read. |
|
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
118 |
|
49 | 119 |
Each line of access.conf has the following syntax: |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
120 |
|
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
121 |
<rule> <condition> <condition> ... |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
122 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
123 |
Rule is one of |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
124 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
125 |
init - allow any operation, including the creation of new repositories |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
126 |
write - allow reads and writes to this file in this repository |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
127 |
read - allow the repo to be read but reject matching writes |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
128 |
deny - deny all requests |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
129 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
130 |
A condition is a globpattern matched against a relative path, one of: |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
131 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
132 |
user=<globpattern> - user's key |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
133 |
repo=<globpattern> - repo (as the user supplies it) |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
134 |
file=<globpattern> - file in the repo |
20
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
135 |
branch=<globpattern> - name of the branch |
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
136 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
137 |
The first rule in the file which has all its conditions satisfied is |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
138 |
used to determine whether an action is allowed. |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
139 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
140 |
Paths cannot contain any special characters except "/"; glob patterns |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
141 |
cannot contain any special characters except "/" and "*". "*" matches |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
142 |
zero or more characters not including "/" while "**" matches zero or |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
143 |
more characters including "/". |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
144 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
145 |
Blank lines and lines that start with "#" are ignored. |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
146 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
147 |
FILE CONDITIONS |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
148 |
|
49 | 149 |
mercurial-server supports file and branch conditions, which restrict an |
150 |
operation depending on what files it modifies and what branch the work is on. |
|
151 |
However, the way these conditions work is subtle and can be counterintuitive - |
|
152 |
if you want to keep things simple, stick to user and repo conditions, and then |
|
153 |
things are likely to work the way you would expect. |
|
154 |
||
20
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
155 |
The rules file is used to make four decisions: |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
156 |
|
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
157 |
- Whether to allow a repository to be created |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
158 |
- Whether to allow access to a repository |
20
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
159 |
- Whether to allow a changeset on a particular branch at all |
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
160 |
- Whether to allow a changeset to change a particular file |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
161 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
162 |
When the first two of these decisions are being made, nothing is known |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
163 |
about what files might be changed, and so all file conditions |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
164 |
automatically succeed for the purpose of such decisions. This means |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
165 |
that doing tricky things with file conditions can have |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
166 |
counterintuitive consequences: |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
167 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
168 |
- You cannot limit read access to a subset of a repository with a |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
169 |
"read" rule and a file condition: any user who has access to a |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
170 |
repository can read all of it and its full history. Such a rule can |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
171 |
only have the effect of masking a later "write" rule, as in this |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
172 |
example: |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
173 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
174 |
read repo=specialrepo file=dontwritethis |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
175 |
write repo=specialrepo |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
176 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
177 |
allows all users to read specialrepo, and to write to all files |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
178 |
*except* that any changeset which writes to "dontwritethis" will be |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
179 |
rejected. |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
180 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
181 |
- For similar reasons, don't give "init" rules file conditions. |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
182 |
|
26
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
183 |
- Don't try to deny write access to a particular file on a particular |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
184 |
branch - a developer can write to the file on another branch and then |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
185 |
merge it in. Either deny all writes to the branch from that user, or |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
186 |
allow them to write to all the files they can write to on any branch. |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
187 |
In other words, something like this will have the intended effect |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
188 |
|
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
189 |
write user=docs/* branch=docs file=docs/* |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
190 |
|
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
191 |
But something like this will not have the intended effect; it will |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
192 |
effectively allow these users to write to any file on any branch, by |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
193 |
writing it to "docs" first: |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
194 |
|
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
195 |
write user=docs/* branch=docs |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
196 |
write user=docs/* file=docs/* |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
197 |
read user=docs/* |
2c4f499ea12f
Explain limitations of branch/file rule combination
Paul Crowley <paul@lshift.net>
parents:
20
diff
changeset
|
198 |
|
28
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
199 |
HOW IT WORKS |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
200 |
|
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
201 |
When a developer attempts to connect to a repository via ssh, the SSH |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
202 |
daemon searches for a match for that user's key in |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
203 |
~hg/.ssh/authorized_keys. If the developer is authorised to connect |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
204 |
to the repository they will have an entry in this file. The entry |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
205 |
includes a "command" prefix which specifies that the restricted shell |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
206 |
should be used; this shell is passed an argument identifying the |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
207 |
developer. The shell parses the command the developer is trying to |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
208 |
execute, and consults a rules file to see if that developer is allowed |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
209 |
to perform that action on that repository. The bulk of the work of |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
210 |
the restricted shell is done by the Python program "hg-ssh", but the |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
211 |
shell script "hg-ssh-wrapper" sets up some configuration so that you |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
212 |
can change it to suit your local installation. |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
213 |
|
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
214 |
The file ~hg/.ssh/authorized_keys is generated by "refresh-auth", |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
215 |
which recurses through a directory of files containing SSH keys and |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
216 |
generates an entry in authorized_keys for each one, using the name of |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
217 |
the key file as the identifier for the developer. These keys will |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
218 |
live in the "keys" subdirectory of a repository called "hgadmin". A |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
219 |
hook in this repository re-runs "refresh-auth" on the most recent |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
220 |
version after every push. |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
221 |
|
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
222 |
Finally, a hook in an extension is run for each changeset that is |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
223 |
remotely committed, which uses the rules file to determine whether to |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
224 |
allow the changeset. |
583ed103e021
update README to reflect new scripted installer
Paul Crowley <paul@ciphergoth.org>
parents:
26
diff
changeset
|
225 |
|
49 | 226 |
LOCKED OUT? |
20
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
227 |
|
49 | 228 |
Once you're working with "hgadmin", it can be convenient to remove all the keys |
229 |
in "/etc/mercurial-server/keys" and all the entries in |
|
230 |
"/etc/mercurial-server/access.conf" and use hgadmin to control everything. If |
|
231 |
you find yourself locked out, you can get back in again by restoring some of the |
|
232 |
entries you removed from these files - remember, |
|
233 |
"/etc/mercurial-server/access.conf" takes precedence over the "access.conf" in |
|
234 |
"hgadmin". |
|
20
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
235 |
|
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
236 |
THANKS |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
237 |
|
36
b3237aabd0fe
Change the name to mercurial-server
Paul Crowley <paul@lshift.net>
parents:
30
diff
changeset
|
238 |
Thanks for reading this far. If you use mercurial-server, please tell |
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
239 |
me about it. |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
240 |
|
50
77d97aa18f29
update dates and copyright notices
Paul Crowley <paul@lshift.net>
parents:
49
diff
changeset
|
241 |
Paul Crowley, 2009 |
77d97aa18f29
update dates and copyright notices
Paul Crowley <paul@lshift.net>
parents:
49
diff
changeset
|
242 |