Blob
- Date:
- Message:
- introduce gotd(8), a Git repository server reachable via ssh(1) This is an initial barebones implementation which provides the absolute minimum of functionality required to serve got(1) and git(1) clients. Basic fetch/send functionality has been tested and seems to work here, but this server is not yet expected to be stable. More testing is welcome. See the man pages for setup instructions. The current design uses one reader and one writer process per repository, which will have to be extended to N readers and N writers in the future. At startup, each process will chroot(2) into its assigned repository. This works because gotd(8) can only be started as root, and will then fork+exec, chroot, and privdrop. At present the parent process runs with the following pledge(2) promises: "stdio rpath wpath cpath proc getpw sendfd recvfd fattr flock unix unveil" The parent is the only process able to modify the repository in a way that becomes visible to Git clients. The parent uses unveil(2) to restrict its view of the filesystem to /tmp and the repositories listed in the configuration file gotd.conf(5). Per-repository chroot(2) processes use "stdio rpath sendfd recvfd". The writer defers to the parent for modifying references in the repository to point at newly uploaded commits. The reader is fine without such help, because Git repositories can be read without having to create any lock-files. gotd(8) requires a dedicated user ID, which should own repositories on the filesystem, and a separate secondary group, which should not have filesystem-level repository access, and must be allowed access to the gotd(8) socket. To obtain Git repository access, users must be members of this secondary group, and must have their login shell set to gotsh(1). gotsh(1) connects to the gotd(8) socket and speaks Git-protocol towards the client on the other end of the SSH connection. gotsh(1) is not an interactive command shell. At present, authenticated clients are granted read/write access to all repositories and all references (except for the "refs/got/" and the "refs/remotes/" namespaces, which are already being protected from modification). While complicated access control mechanism are not a design goal, making it possible to safely offer anonymous Git repository access over ssh(1) is on the road map.
- Actions:
- History | Blame | Raw File
1 .\"2 .\" Copyright (c) 2022 Stefan Sperling <stsp@openbsd.org>3 .\"4 .\" Permission to use, copy, modify, and distribute this software for any5 .\" purpose with or without fee is hereby granted, provided that the above6 .\" copyright notice and this permission notice appear in all copies.7 .\"8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF14 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.15 .\"16 .Dd $Mdocdate$17 .Dt GOTD.CONF 518 .Os19 .Sh NAME20 .Nm gotd.conf21 .Nd gotd configuration file22 .Sh DESCRIPTION23 .Nm24 is the run-time configuration file for25 .Xr gotd 8 .26 .Pp27 The file format is line-based, with one configuration directive per line.28 Any lines beginning with a29 .Sq #30 are treated as comments and ignored.31 .Sh GLOBAL CONFIGURATION32 The available global configuration directives are as follows:33 .Bl -tag -width Ds34 .It Ic unix_socket Ar path35 Set the path to the unix socket which36 .Xr gotd 837 should listen on.38 If not specified, the path39 .Pa /var/run/gotd.sock40 will be used.41 .It Ic unix_group Ar group42 Set the43 .Ar group ,44 defined in the45 .Xr group 546 file, which is allowed to access47 .Xr gotd 848 via49 .Xr gotsh 1 .50 The51 .Xr gotd 852 user must be a secondary member of this group.53 If not specified, the group _gotsh will be used.54 .It Ic user Ar user55 Set the56 .Ar user57 which will run58 .Xr gotd 8 .59 Initially,60 .Xr gotd 861 requires root privileges in order to create its unix socket and start62 child processes in a63 .Xr chroot 264 environment.65 Afterwards,66 .Xr gotd 867 drops privileges to the specified68 .Ar user .69 If not specified, the user _gotd will be used.70 .El71 .Sh REPOSITORY CONFIGURATION72 At least one repository context must exist for73 .Xr gotd 874 to function.75 .Pp76 A repository context is declared with a unique77 .Ar name ,78 followed by repository-specific configuration directives inside curly braces:79 .Pp80 .Ic repository Ar name Brq ...81 .Pp82 .Xr got 183 and84 .Xr git 185 clients can connect to a repository by including the repository's unique86 .Ar name87 in the request URL.88 Clients appending the string89 .Dq .git90 to the91 .Ar name92 will also be accepted.93 .Pp94 If desired, the95 .Ar name96 may contain path-separators,97 .Dq / ,98 to expose repositories as part of a virtual client-visible directory hierarchy.99 .Pp100 The available repository configuration directives are as follows:101 .Bl -tag -width Ds102 .It Ic path Ar path103 Set the path to the Git repository.104 .EL105 .Sh FILES106 .Bl -tag -width Ds -compact107 .It Pa /etc/gotd.conf108 Location of the109 .Nm110 configuration file.111 .El112 .Sh EXAMPLES113 .Bd -literal -offset indent114 # Default unix_group and user values:115 unix_group _gotsh116 user _gotd118 # This repository can be accessed via ssh://user@example.com/src119 repository "src" {120 path "/var/git/src.git"121 }123 # This repository can be accessed via124 # ssh://user@example.com/openbsd/ports125 repository "openbsd/ports" {126 path "/var/git/ports.git"127 }128 .Ed129 .Sh SEE ALSO130 .Xr got 1 ,131 .Xr gotsh 1 ,132 .Xr group 5 ,133 .Xr gotd 8