author | Paul Crowley <paul@ciphergoth.org> |
Tue, 22 Apr 2008 10:27:43 +0100 | |
changeset 22 | 578555227599 |
parent 20 | f4daa224dc7e |
child 26 | 2c4f499ea12f |
permissions | -rw-r--r-- |
13 | 1 |
hg-admin-tools |
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 |
|
12 | 6 |
Paul Crowley, paul@lshift.net, 2008 |
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 |
Access control is managed with a special repository on the server |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
16 |
called "hgadmin"; pushes to this repository immediately change the |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
17 |
rules that are in effect. |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
18 |
|
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
19 |
Inside "hgadmin" is a "keys" directory containing the SSH keys of all |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
20 |
developers who have access, and a file "hg-ssh-access.conf" which |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
21 |
gives a set of rules defining who can do what to what. |
12 | 22 |
|
23 |
HOW IT WORKS |
|
24 |
||
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
25 |
All of the repositories controlled by these tools are owned by a |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
26 |
single user (the "hg" user in what follows), but many remote users can |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
27 |
act on them. We don't use file permissions to achieve that - instead, |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
28 |
developers log in as the "hg" user when they connect to the repository |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
29 |
host using ssh, using ssh URLs of the form |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
30 |
"ssh://hg@repository-host/repository-name". A restricted shell |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
31 |
prevents them from using this access for unauthorized purposes. |
12 | 32 |
|
33 |
Developers are authenticated only using SSH keys; no other form of |
|
34 |
authentication is supported. When a developer attempts to connect to |
|
35 |
a repository via ssh, the SSH daemon searches for a match for that |
|
36 |
user's key in ~hg/.ssh/authorized_keys. If the developer is |
|
37 |
authorised to connect to the repository they will have an entry in |
|
38 |
this file. The entry includes a "command" prefix which specifies that |
|
39 |
the restricted shell should be used; this shell is passed an argument |
|
40 |
identifying the developer. The shell parses the command the developer |
|
41 |
is trying to execute, and consults a rules file to see if that |
|
42 |
developer is allowed to perform that action on that repository. The |
|
43 |
bulk of the work of the restricted shell is done by the Python program |
|
44 |
"hg-ssh", but the shell script "hg-ssh-wrapper" sets up some |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
45 |
configuration so that you can change it to suit your local |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
46 |
installation. |
12 | 47 |
|
48 |
The file ~hg/.ssh/authorized_keys is generated by "refresh-auth", |
|
49 |
which recurses through a directory of files containing SSH keys and |
|
50 |
generates an entry in authorized_keys for each one, using the name of |
|
51 |
the key file as the identifier for the developer. These keys will |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
52 |
live in the "keys" subdirectory of a repository called "hgadmin". A |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
53 |
hook in this repository re-runs "refresh-auth" on the most recent |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
54 |
version after every push. |
12 | 55 |
|
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
56 |
Finally, a hook in an extension is run for each changeset that is |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
57 |
remotely committed, which uses the rules file to determine whether to |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
58 |
allow the changeset. |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
59 |
|
13 | 60 |
GETTING STARTED |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
61 |
|
10 | 62 |
This is only one setup - it can be tweaked in many ways, and is as |
63 |
specific as it is only in the interests of brevity. |
|
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
64 |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
65 |
You, and all users of this repository host, will need SSH public key |
10 | 66 |
authentication set up, preferably working with ssh-agent so you don't |
67 |
have to type in your passphrase all the time. I assume you've done |
|
68 |
that in what follows, so if you've done something different you'll |
|
69 |
need to change it appropriately. |
|
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
70 |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
71 |
Issue these commands to get the repository host started. These are |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
72 |
written out here rather than encapsulated in a script because many of |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
73 |
them may need to be different for your local setup. You will need |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
74 |
root access on the repository host, because you need to create a new |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
75 |
user. |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
76 |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
77 |
ssh -A repository-host |
13 | 78 |
ssh-add -L >> /tmp/my-ssh-public-key |
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
79 |
sudo adduser --system --shell /bin/sh --group --disabled-password \ |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
80 |
--gecos "Mercurial repositories" hg |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
81 |
sudo -u hg -H -s |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
82 |
cd |
15
f3654416d178
minor changes to README and script
Hubert Plociniczak <hubert@lshift.net>
parents:
14
diff
changeset
|
83 |
mkdir -p admin repos/hgadmin/keys/admin .ssh |
12 | 84 |
cd admin |
13 | 85 |
hg clone http://hg.opensource.lshift.net/hg-admin-tools |
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
86 |
cp hg-admin-tools/hg-ssh-wrapper hg-admin-tools/remote-hgrc ~ |
12 | 87 |
cd ../repos/hgadmin |
88 |
hg init . |
|
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
89 |
echo "init user=admin/*" > hg-ssh-access.conf |
12 | 90 |
cp /tmp/my-ssh-public-key keys/admin/myname |
13 | 91 |
hg add |
15
f3654416d178
minor changes to README and script
Hubert Plociniczak <hubert@lshift.net>
parents:
14
diff
changeset
|
92 |
hg commit -m "initial commit" |
12 | 93 |
cp ~/admin/hg-admin-tools/hgadmin-hgrc .hg/hgrc |
15
f3654416d178
minor changes to README and script
Hubert Plociniczak <hubert@lshift.net>
parents:
14
diff
changeset
|
94 |
../../admin/hg-admin-tools/refresh-auth ./hg-ssh-wrapper |
12 | 95 |
exit |
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
96 |
exit |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
97 |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
98 |
You are now the sole user able to change and create repositories on |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
99 |
this repository host. To administer these controls (and test your |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
100 |
access), check out hgadmin: |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
101 |
|
12 | 102 |
mkdir ~/hg |
103 |
cd ~/hg |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
104 |
hg clone ssh://hg@repository-host/hgadmin |
12 | 105 |
cd hgadmin |
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
106 |
|
10 | 107 |
You can now add other users by putting their keys in an appropriate |
108 |
subdirectory of the "keys" directory, and control their access by |
|
109 |
editing hg-ssh-access.conf. Changes will take effect as soon as you |
|
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
110 |
push them to "ssh://hg@repository-host/hgadmin". |
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
111 |
|
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
112 |
Users authorized to do so can now also create new repositories on this |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
113 |
host with "clone": |
14
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
114 |
|
e7d5254cd0ca
fix repo confusion in README per Matthias's comments
Paul Crowley <paul@ciphergoth.org>
parents:
13
diff
changeset
|
115 |
hg clone . ssh://hg@repository-host/my-project-name |
13 | 116 |
|
117 |
HG-SSH-ACCESS.CONF |
|
2
a69f7bea408c
added a README to describe how this works.
Paul Crowley <paul@lshift.net>
parents:
diff
changeset
|
118 |
|
10 | 119 |
Each line of hg-ssh-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 |
|
20
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
149 |
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
|
150 |
|
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
151 |
- 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
|
152 |
- 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
|
153 |
- 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
|
154 |
- 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
|
155 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
156 |
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
|
157 |
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
|
158 |
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
|
159 |
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
|
160 |
counterintuitive consequences: |
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 |
- 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
|
163 |
"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
|
164 |
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
|
165 |
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
|
166 |
example: |
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 |
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
|
169 |
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
|
170 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
171 |
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
|
172 |
*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
|
173 |
rejected. |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
174 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
175 |
- 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
|
176 |
|
20
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
177 |
LOCKING YOURSELF OUT |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
178 |
|
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
179 |
If you find yourself "locked out" - that is, that you no longer have |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
180 |
the permissions needed in hgadmin - you can break back in again if |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
181 |
you're able to become the "hg" user on the repository host. Once you |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
182 |
are that user, delete ~hg/.ssh/authorized_keys (to stop any user who |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
183 |
might have access but shouldn't from using the repository while you |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
184 |
fix things). Then go into ~hg/repos/hgadmin, do an "hg update", edit |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
185 |
things to your satisfaction, and commit the change. Finally, run |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
186 |
~/admin/hg-admin-tools/refresh-auth to regenerate |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
187 |
~hg/.ssh/authorized_keys. |
f4daa224dc7e
Add support for locking by branch, and document breaking in.
Paul Crowley <paul@ciphergoth.org>
parents:
18
diff
changeset
|
188 |
|
18
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
189 |
THANKS |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
190 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
191 |
Thanks for reading this far. If you use hg-admin-tools, please tell |
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
192 |
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
|
193 |
|
538d6b198f4a
Big change to support file conditions; format of hg-ssh-access.conf
Paul Crowley <paul@lshift.net>
parents:
15
diff
changeset
|
194 |
Paul Crowley, 2008 |