Documentation
¶
Overview ¶
Package mounthelper is gitd-mount: the one process that may mount, so that gitd needs no privilege at all. It runs as root, answers on a Unix socket only the user its configuration names, and does two things only — mount an overlay workspace and unmount one — inside directories that configuration fixes. The configuration is root's: gitd cannot widen what it may ask for.
Every directory is opened with openat2(RESOLVE_NO_SYMLINKS) and the mount made through that descriptor, so a directory swapped for a symbolic link between the checks and the mount changes nothing: what was checked is what is mounted.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Answer ¶
type Answer struct {
Error string `json:"error,omitempty"`
}
Answer is the outcome: empty Error when done.
type Client ¶
type Client struct {
Socket string
}
Client is gitd's side: a strategy.Mounter that asks gitd-mount on its socket.
func (Client) MountOverlay ¶
MountOverlay asks for target to be mounted as the overlay of upper on lowers, the topmost first, which travel as one field joined by colons, as overlayfs names them.
type Config ¶
Config is who may ask, and where: templates are the only lower layers, layers the only place for upper and work directories, and roots the only places a workspace is mounted. Each may be given more than once: a gitd with tenants has templates, layers and roots for each.
func Load ¶
Load reads the configuration at path, which must be root's and writable by root only: whoever could write it could mount anywhere.
user gitd templates /var/lib/gitd/templates layers /var/lib/gitd/layers root /var/lib/gitd/workspaces
So must every directory above it, or whoever could write one could put another file in its place. The file is opened once, without following a link, and checked as opened.
type Request ¶
type Request struct {
Op string `json:"op"`
Lower string `json:"lower,omitempty"`
Upper string `json:"upper,omitempty"`
Work string `json:"work,omitempty"`
Target string `json:"target"`
}
Request is what gitd asks: Op "mount", with all four directories, or "unmount", with the target only. Lower is one template, or a warm layer and its template joined by a colon, the topmost first; each is checked on its own.