Plan step 17: run on a dedicated unix user, and cap the unit's resources
Hostsharing recommends assigning domains to separate domain admins rather than to the package admin, and all their service guides (Mattermost, Tomcat, Nextcloud) run the daemon as its own user. For GitTally the argument is stronger: it checks out foreign commits and executes their build scripts, so running as the package admin would undo the sandbox rationale of this step. The service user has to be named when ordering the daemon port anyway. Also records a trap found on the way: the RAM contingent is a package slice, not a per-user quota, so a dedicated user buys isolation but no extra memory — a runaway Gradle build could starve the whole webspace. The unit from `init --systemd` sets neither MemoryMax nor TasksMax today, so adding them (configurable, empty = unset) becomes part of step 17. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,21 @@ Three platform-side prerequisites, none of them code:
|
|||||||
3. **Let's Encrypt** is a domain option ticked in HSAdmin (free, automatic, includes the wildcard subdomain; requires the domain's nameservers to be delegated to Hostsharing), so TLS terminates in the managed Apache.
|
3. **Let's Encrypt** is a domain option ticked in HSAdmin (free, automatic, includes the wildcard subdomain; requires the domain's nameservers to be delegated to Hostsharing), so TLS terminates in the managed Apache.
|
||||||
Source: [TLS](https://www.hostsharing.net/doc/managed-operations-platform/tls/).
|
Source: [TLS](https://www.hostsharing.net/doc/managed-operations-platform/tls/).
|
||||||
|
|
||||||
|
### User model: a dedicated unix user, not the package admin
|
||||||
|
|
||||||
|
GitTally runs as its own unix user, e.g. `xyz00-gittally`, with the domain assigned to that same user (`domain.add({set:{name:'…',user:'xyz00-gittally'}})`), so the service, its repository checkout and `~/doms/<domain>/htdocs-ssl/` share one home directory.
|
||||||
|
That is what every Hostsharing service guide does (`xyz00-chat` for Mattermost, `xyz00-tomcat`, `xyz00-cloud` for Nextcloud) and what their user documentation recommends: a domain *can* run under the package admin, but "aus Sicherheitsgründen empfiehlt es sich aber Domains auf separate Domain-Admins aufzuschalten", so a compromise stays inside one home instead of reaching the whole package.
|
||||||
|
Here the argument is stronger than usual, because GitTally checks out foreign commits and executes their build scripts — running that as the package admin would undo the sandbox rationale of this very step.
|
||||||
|
The service user is named when ordering the daemon port anyway.
|
||||||
|
Sources: [Benutzer](https://www.hostsharing.net/doc/managed-operations-platform/benutzer/), [HSAdmin domain](https://www.hostsharing.net/doc/managed-operations-platform/hsadmin/domain/).
|
||||||
|
|
||||||
|
Consequences:
|
||||||
|
|
||||||
|
- The package admin is needed **once**: create the user, set its login shell to `/bin/bash` (this is what enables systemd lingering — `loginctl enable-linger` is not called by hand), assign the domain, order port and RAM. Day-to-day operation needs no admin rights.
|
||||||
|
- The RAM contingent is a **package** slice (`pacs-<account>.slice`), not a per-user quota, so a dedicated user gets no extra memory: a runaway Gradle build can starve everything else in the webspace.
|
||||||
|
The unit generated by `init --systemd` therefore needs `MemoryMax` and `TasksMax` on this platform — `SystemdServiceFiles.unitFileContent` currently sets neither, so add them (configurable, empty = unset) as part of this step.
|
||||||
|
- Unverified, check on the target system: whether the port reservation is technically bound to that uid or merely organisational, and whether a non-admin user may read `systemctl status pacs-<account>.slice`.
|
||||||
|
|
||||||
The proxy itself is one `.htaccess` in `~/doms/<domain>/htdocs-ssl/`, following Hostsharing's own Mattermost and Tomcat guides:
|
The proxy itself is one `.htaccess` in `~/doms/<domain>/htdocs-ssl/`, following Hostsharing's own Mattermost and Tomcat guides:
|
||||||
|
|
||||||
```apache
|
```apache
|
||||||
|
|||||||
Reference in New Issue
Block a user