Fix permissions/ownership for push-hosted projects
[girocco.git] / README
blobff908cbc29016bcd44b88b221f7f1063c319e055
1 This is the duct tape that ties repo.or.cz together. You will find
2 some hardcoded paths inside, and some other kludgy stuff.
4 The user interface is kept in the cgi/ subdirectory (repo.or.cz/m/ is symlink
5 to that).
7 There are two modes of operation for each project: hosting and mirroring.
10 Hosting mode
11 ------------
13 (All uids and gids are allocated from range 65536..infty. All passwords are
14 stored in DES crypt(3) format because Apache is moronic.)
16 (This is vaporware: No such thing exists yet. But workin' on it.)
19 This is how the push access is provided:
21 The whole setup is confined in a chroot with its own instance of sshd running.
22 The chroot looks like:
24         /bin/sh
25         /bin/git-shell
26         /bin/git-upload-pack
27         /bin/git-receive-pack
28         /bin/git-rev-list
29         /bin/git-pack-objects
30         /bin/git-unpack-objects
31         /bin/git-update-server-info
32         /bin/git-repack
33         /sbin/sshd
34         /dev/randomstuff
35         /lib/randomstuff
36         /var/empty
37         /srv/git/...
38         /etc/group
39         /etc/passwd
40         /etc/sshkeys/*
41         /etc/ssh/randomstuff
43 There is a (non-chroot) system user 'repo' and a group of the same name (the
44 webserver is member of the group; TODO: suexec). The files in /etc are owned
45 by repo.repo and group-writable, as well as all files in /srv/git/*/ but
46 refs/**, info/**, and objects/** which are repo.project.
49 When you register a project, it will get a gid allocation and you will set a
50 password for it. The triple is stored in a group(5) file (but containing just
51 the project groups):
53         projname:crypt:gid:list,of,users
55 When you register a user, it will get a uid allocation and you will upload
56 an ssh public key for it. The user is stored in a passwd(5) file (but
57 containing just the repo.or.cz users; 65534 is nogroup):
59         username:x:uid:65534:email:/:/bin/git-shell
61 The authorized keys are stored in /etc/sshkeys/username.
63 When you (un)assign user to a project, you just manipulate the list of users
64 for the project in /etc/group. The web interface for the project administration
65 is protected by the group password; chroot/etc/group is used as the htpasswd
66 file here.
68 Since Apache is not in the project groups, there is a special cronjob run
69 every minute to fix up the permissions for the refs/, info/, and objects/
70 project directories, under the root user.
73 Mirror mode
74 -----------
76 To keep things safe and neat, repo.or.cz is job-controlled: the only thing the
77 cgi script does is scheduling a clone job (by creating a directory with some
78 files at a magic location) and then the clonecheck.sh script is invoked every
79 minute by cron (under more reasonable uid) to check if there are any jobs
80 scheduled, and calls clone.sh to do the clone itself, notifying the user about
81 the results.
83 The script that keeps repositories up-to-date is updatecheck.sh, being run
84 by cron every hour and calling update.sh for all the relevant repositories.
86 updateglibc.sh stands somewhat out of the crowd and keeps the Git mirror of
87 the glibc CVS repository up-to-date, so it's probably not interesting for
88 anyone.
90 To make sure a project is not pushable when in mirror mode, the last colon
91 in the /etc/group entry for the project is doubled.