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