about summary refs log tree commit diff
path: root/genenetwork/services/container-ssh.scm
AgeCommit message (Collapse)Author
11 dayscontainers: write the banner to /var/log/container-banner.log as wellPjotr
The boot banner was displayed to stdout, which at boot is shepherd's own port and reaches nobody: measured, the container's /var/log/messages gains "Service container-banner has been started" but not the banner text, and `herd start container-banner` prints it only because the client is attached to the socket. So the text is now also written to a file the container owns, /var/log/container-banner.log, which the daemon's LOG verb reads back through /proc/<pid>/root (run-guix-container a18ac68). Verified on a rebuilt cgit container: the file appears four seconds after start with the full text.
11 dayscontainers: name themselves, on boot, over ssh and in the logPjotr
A store path is a hash, so /gnu/store/…-run-container cannot say which container it builds, and neither can a pid from the daemon's --list. cgit is the worked example of the three places that fix it, all fed from one Scheme string: * `(issue %cgit-banner)' in the operating-system: /etc/issue, which is what a console and nsenter show. * `#:banner %cgit-banner' to container-ssh-service: sshd_config gains `Banner /etc/issue.net', so the name appears BEFORE authentication -- you learn which container you are entering before you are in it -- and /etc/issue.net and /etc/motd are written with the same text for after login. The keyword is optional and defaults to off, so the other containers keep their current behaviour until they opt in. * a one-shot container-banner shepherd service that displays the same string at boot, so the daemon's log starts by naming the container instead of beginning with raw boot noise. Verified on the built container rather than by reading the source: the system's /etc/issue, /etc/issue.net and /etc/motd all carry the text, sshd's config for port 2224 has `extra-content: "Banner /etc/issue.net\n"', and the compiled shepherd.conf lists a shepherd-container-banner.go whose payload contains the banner string. Also documented in skills/guix-containers/SKILL.md, together with the fourth half of the same problem: name the store item itself with a GC root (guix build --root=$HOME/containers/<name>), which both pins it against a gc and gives a human a name for the hash. --root refuses to replace an existing root, so the symlink has to go first.
2026-10-04cgit: use the stock nginx-service-type with nginx-server-configuration recordsPjotr
Replace the hand-rolled nginx.conf string builder and the custom foreground-nginx shepherd service with upstream machinery, as requested upstream: * services/cgit.scm: drop cgit-nginx-conf-file (string concatenation) and the nginx shepherd/activation/accounts services. The cgit sites are now nginx-server-configuration records (locations as nginx-location-configuration / nginx-named-location-configuration) contributed to the stock nginx-service-type via a service extension; the rate-limit zone travels as %cgit-rate-limit-http-directives (http-context extra-content of the OS's nginx-configuration). The fcgiwrap shepherd service stays (the stock fcgiwrap-service-type cannot pass CGIT_CONFIG or a worker count). * containers/cgit-container.scm: instantiate nginx-service-type; shepherd/container-signals: patch shepherd 1.0.9 to prefer its self-pipe signal mechanism (SHEPHERD_DISABLE_SIGNALFD) and run it as PID 1 via the essential-services shepherd-configuration. In this daemon's nested-container sandbox the signalfd wake-up never fires, so every start method that waits for a child's exit status (the stock nginx 'nginx -t' one-shot, invoke-based starts) blocks forever; the self-pipe fallback works. Tests are disabled for the patched build (the upstream suite does not survive the build sandbox); the container's own suite covers the deployment. * services/container-ssh.scm: keep /var/empty root-owned/read-only in activation -- the stock nginx-service-type gives its system user /var/empty as the home directory and on a minimal container that would break sshd's privilege separation. Verified live (anubis? #f test deployment): stock nginx shepherd starts (nginx-init + nginx), suite 18/19 (t17 Anubis challenge not applicable in the plain-variant test deployment), including t19 rate limiting through the records-rendered conf. The anubis? #t conf (public/internal server split) verified statically through the service-extension machinery and by nginx -t on the rendered file.
2026-10-02typo - grrrPjotr Prins
2026-10-02remarksPjotr Prins
2026-10-02cgit: fold cgit-README.md into the container file headerPjotr
Move the cgit-README.md content into the header comment of genenetwork/containers/cgit-container.scm and drop the separate file, like bnw-README before it. Updated to current reality on the way in: - the container does not seed a demo repository (repos are host-side, see the bind-mount section) - the SSH knobs table now documents container-ssh-service (the shared module) instead of the removed inline ssh-host-key/openssh fields - drop the stale e716b771 fingerprint example (auto-detected today) - test count updated to 18 including the Anubis tests Cross-references to cgit-README.md in container-ssh.scm, both test runners/scripts and bnw-container.scm now point at the Keys / bind-mount sections of the container file header. bnw.service style systemd instructions do not apply to cgit (there is no cgit.service). Pure comment change: guix system container resolves to the same store path (zga020ym4y3...); cgit test cycle re-run with unchanged results (Anubis + tool checks green, t01-t16 still gated on host-side /srv/git provisioning).
2026-10-01container-ssh: factor the container SSH setup out of the containersPjotr
bnw-container.scm and cgit-container.scm carried identical SSH code (openssh with password-less root login via hello-container-key, the pinned ECDSA host key installed into /etc/ssh, and the /var/empty + /var/run/sshd fix), differing only in the port. Move it into the new (genanetwork services container-ssh) module as container-ssh-service, a service PROCEDURE returning the list of services, parameterized by port-number (and optionally host key / authorized key). It is a procedure rather than a service-type on purpose: openssh-service-type has no extension point that merges configurations, so a wrapping service-type would have to re-implement sshd's shepherd, activation and account services. Both containers now splice (container-ssh-service #:port-number N) into their services with append. Behavior-preserving by construction and verified by content: guix system container resolves to the exact same store paths as before the refactor (bnw 3jiirryqwjb..., cgit zga020ym4y3...), and both containers re-tested green (bnw suite 13/13 including the ssh tool check; cgit ssh login, host key, /var/empty and services all verified over ssh).