Table of Contents
- How It Works
- The words used here
- The pieces, and how they talk
- The data folder
- The record
- The door
- Signed requests
- The request
- What the door checks
- Requests in the record
- Erasing, and requests
- Build nodes sign what they hand in
- What the site does by itself names what authorised it
- Not signed
- The life of a project
- 1. The site is told where the project lives
- 2. Importing
- 3. Packaging
- 4. The queue
- 5. A build node builds it
- 6. Verified builds (optional)
- 7. Publishing
- 8. The pages
- Writing back to the forge (optional)
- The site's key
- The site's SSH keys
- Mail (optional)
- Who trusts whom
- The timed jobs
- The programs
How It Works
This page explains what a Folio site is made of, how the parts talk to each other, and what happens to a project from the moment the site hears of it to the moment someone installs it with apt. The other pages say how to do things; this one says why they work the way they do.
The words used here
| Word | What it is |
|---|---|
| forge | a website that hosts git repositories, such as a Forgejo or a Gitea (https://forge.example.org in these pages). The projects live there. |
| site | one Folio installation: a server with a web address (https://dur.example.org) and a door for SSH (folio@dur.example.org). It packages and builds projects from the forge and offers the result. |
| data folder | the one folder on the server that holds everything the site has (/srv/folio). |
| record | the part of the data folder that holds every fact: accounts, packages, votes, settings. It is a git repository; every change is a signed commit. |
| account | a person known to the site, with one or more SSH keys, one GPG key and a role (member, maintainer, administrator, owner). See Home. |
| door | the program folio-door. sshd runs it for every SSH connection to the user folio; it is the only way to change anything on the site from outside the server. |
| signed request | a change asked for in a few lines of text, signed with the GPG key of the account that asks. The door takes no change without one (see Signed requests). |
| build node | a computer that builds packages for the site. It runs folio-node, which comes in through a smaller door of its own, folio-node-door. |
| build | one attempt to build one version of one package, for one release and one kind of processor. |
| release | a release the site builds for, such as excalibur: of Devuan, or of another distribution made the same way (distribution-RELEASE). Each release gets its own build. |
| apt archive | the folder of packages and signed package lists that apt reads (https://dur.example.org/apt). |
| part | the archive has two: main, the reviewed part, and unsafe, the unreviewed part. See Home. |
| site's key | the site's own PGP key, in three parts: a master, which only vouches for signing keys and stays on the owner's computer, and two signing keys under it, one for the apt archive's lists and one for every change in the record (see The site's key). |
| keyring package | a package in the site's own archive, WORD-archive-keyring, that holds the site's public key on people's computers and is updated like any other package. |
The pieces, and how they talk
+-----------------------------+
| the forge |
| forge.example.org |
| the projects' repositories |
+-----------------------------+
| ^ |
new commits (git, read | | a copy of | the source of a
over https) | | the site | build (git, read)
v | (git, ssh) v
+----------+ ssh +--------------------+ ssh +--------------+
| people |-------->| the site |<-------| build nodes |
| (keys) | (door) | dur.example.org | (node | folio-node |
+----------+ | data: /srv/folio | door) +--------------+
+--------------------+
|
| plain files over https, from nginx
v
+--------------------+
| browsers and apt |
+--------------------+
The arrows show which way things flow. The site never opens a connection to a person or to a build node: they come to it. The forge never opens a connection either: the site and the nodes go to it.
| From | To | How | What for |
|---|---|---|---|
| a person | the site | SSH as the user folio, with a key that belongs to their account |
one command per connection: look something up with plain ssh; change something with a request signed with their GPG key (the folio command or the desktop program makes it) |
| a build node | the site | SSH as folio, with the node's own key |
take a build, say it is still at it, hand in the result (the taking and the handing in signed with the node's GPG key) |
| the site | the forge | git over https only, read only; the forge's web API over https, read only |
import projects; ask which repositories an account or the whole forge holds |
| a build node | the forge | git over https only, read only |
fetch the project's source at the exact commit to build |
| a build node | the site's web address | https | the site's SSH keys (ssh-host-keys), before it connects; the site's archive key and file lists, when a project needs another project of the same site to build |
the desktop program, the folio command |
the site's web address | https | the site's SSH keys (ssh-host-keys), before it connects |
| the site | the forge | git over SSH, with a key of the site's own; https with an access token (the site's signer holds both, and does the sending) | optional: write a copy of the record, the pages and the archive, and fill the forge's package list |
| browsers and apt | the site | https, served by nginx | read the pages and the archive. The only program a visitor can start is the search |
| the site | the mail system | the system's sendmail |
optional: notifications people asked for |
A site has no web login, no passwords and no database server. Nothing a visitor does in a browser can change it.
The data folder
Everything the site has is in one folder, /srv/folio unless the setup
was told otherwise. The user folio owns it.
| Folder | What is in it |
|---|---|
record/ |
every fact the site knows, as a git repository (see The record) |
site/ |
the web pages folio-generate writes, the stylesheets and pictures (static/), a source download per package (packages/NAME/NAME_VERSION.tar.gz) and the search's list. nginx serves this folder as the website |
apt/ |
the apt archive. nginx serves it at /apt/ |
builds/NUMBER/ |
one folder per build: its facts (job), its log (log) and what it built (files/). Builds are not in the record: they are large and can be made again |
source/NAME/ |
the packaging files and the list of files of each package's newest import, for the package's Source page |
cache/ |
working files the site keeps: the imported repositories (fetched/NAME.git), projects found on a watched forge (found/), the list the Changes page is made from, what the home page shows of the site's key (site-key), and what each built package needs to run |
guides/ |
the guides the site shows under Help |
private/ |
readable by folio only, never sent anywhere: the site's public key (gnupg/; on a site of the older kind, its signing keys too), where a change of signing key stands (key-state), the keyring package (keyring/), sshd's keys file (sshd/authorized_keys), the archive tool's own files (reprepro/), the forge's confirmed SSH host key (forge/; on an older site also its key and token, which are otherwise the signer's), mail addresses (mail/) and waiting mail (outbox/), imports that were turned down (refused/), the counts for the hourly limits (rate/), every signed request the site took (requests/NONCE and NONCE.asc), the nonces seen in the last 20 minutes (nonces/), the activity log (activity.log, and activity.log.1 before it) and the lock (lock.flock, and rate.lock for the hourly counts) |
The site's signing keys, the forge key and the token are not in this
folder: the site's signer keeps them in a folder of its own,
/var/lib/folio-sign (see The site's key).
The settings that tell the programs where this folder is are in
/etc/folio/folio.conf (see
Settings Reference).
What must be backed up is in Backup and Restore.
The record
The record is the folder /srv/folio/record. It holds small text files
of key = value lines, and it is a git repository.
| File | What it says |
|---|---|
accounts/NAME/account |
the role, the day they joined, who vouched for them, whether they are in the vouching group (voucher = yes; the owner and administrators may vouch by their role in any case), their real name if given, the forge account they have the site watch, their PGP key's fingerprint, and whether and why they are suspended |
accounts/NAME/ssh/keyN.pub |
their SSH keys, one per file |
accounts/NAME/pgp.asc |
their GPG (PGP) public key. Every change they ask for is checked against it, and so are their commits' signatures |
packages/NAME/meta |
the maintainer and co-maintainers, the part (component), where the project lives (source), its releases, keywords, a flag, who brought it in |
packages/NAME/upload |
the newest import: version, commit, source format, whether the site wrote the packaging, who brought it in and when, the commit's signature, and which commit was approved by whom |
packages/NAME/binaries/BINARY |
each installable package it builds: version, kind of processor, description, what it needs |
packages/NAME/votes/ACCOUNT |
one empty file per vote |
packages/NAME/comments/*, requests/* |
one small file per comment and per open request |
nodes/NAME/node, nodes/NAME/ssh.pub, nodes/NAME/pgp.asc |
a build node: whether it is switched on, its kinds of processor, who let it in, its GPG key's fingerprint; its SSH key; its GPG public key, which its claims and results are checked against |
mirrors/NAME |
a listed mirror: its address, who added it |
settings/site |
the site's settings (Settings Reference) |
erasures/* |
that something was erased from the history: when, by whom, why |
verify/key-changes, verify/site-key.asc |
every change of the site's key, one line each, and the site's public key as it is now |
verify/accepted |
the changes the owner accepted with admin verify accept |
Every change is one commit. The commit's author is the account that
acted, and its note has a line Acted-by: NAME. After it comes the signed
request that asked for the change, byte for byte (see
Signed requests). The site signs the commit with its
own signing key, never with anyone's personal key. That gives four things:
- a history anyone can read: the Changes page lists the newest 300;
- undo:
admin undo CHANGEadds a commit that reverses one earlier commit; - a check that nothing was altered afterwards:
admin verifycounts the commits whose signature holds (also those signed by an earlier signing key of the site while it counted), lists any that do not (also those signed with a key after it was revoked or ran out), and lists apart those signed with a key the server does not have (which it cannot check, such as the old key after a restore from the forge alone) and those signed with a key later revoked as stolen, before it was revoked (which may be the thief's, dated back). It fails while any signature does not hold, and while any change of the last kind waits for the owner. The owner compares each such change with an older copy of the record and, if it is the site's own, accepts it (admin verify accept CODE..., the owner only). The acceptance is written in the record too, inverify/accepted, signed with the signing key that signs now; - proof of who asked: anyone with a copy of the record can check each change's request against the asker's GPG key, which is in the record too.
Nothing is recorded unsigned. While the site's signing key cannot sign
(it ran out before it was renewed, or was revoked with no new one), the
site takes no change at all: every command that would change the record is
refused before it changes anything, and the timed import brings nothing
in. Reading still works. Once the owner renews the key on their own
computer (folio-site-key renew), or makes new ones after a revocation
(folio-site-key emergency), and brings the bundle to the server
(folio-key import BUNDLE), changes are taken again.
One change at a time. Before it changes anything, a program takes the
site's lock: the kernel's lock (flock) on the file private/lock.flock,
held for as long as the program runs or until it is done. Two programs
can never both hold it, only the one that took it holds it, and the kernel
lets go of it when that program ends, however it ends, so it is never left
behind. A command that finds the lock taken waits up to 30 seconds and
then answers folio: the site is busy; try again in a moment. A build
node's request and an import wait up to a minute. The timed import skips a
repository it cannot lock and tries again on its next round. A client
that goes away in the middle does not stop a change: it is finished and
recorded, and only its answer is lost. A change stopped on the server, or
refused while it holds the lock, puts the record's files back as they
were.
The door
The server has one system user for the site, folio, with no password.
sshd lets that user in with keys only, gives no terminal and allows no
forwarding (/etc/ssh/sshd_config.d/folio.conf, written by the guided
setup). The keys file it reads, private/sshd/authorized_keys, has one
line per key, and each line ties the key to one fixed program and one
name:
command="/usr/lib/folio/folio-door NAME",restrict ssh-ed25519 AAAA...
command="/usr/lib/folio/folio-node-door NODE",restrict ssh-ed25519 AAAA...
The program folio-keys writes this file from the record: a line for
every key of every account that is not suspended, and for every build
node that is switched on.
What happens when someone types folio vote hello:
- The folio command (on their computer) sees that
votechanges something. It asks the site forrequest-info, makes a request forvote hello, hasgpgsign it with the person's GPG key, and sends it over ssh assigned REQUEST SIGNATURE. - sshd (on the server) finds the key in the keys file and runs
folio-door NAME, with the words sent after the address inSSH_ORIGINAL_COMMAND. Whatever was sent, this program runs and nothing else.restricttakes away the terminal and forwarding. - The door refuses at once if the account is suspended. It splits
the words and looks the first up in its one table of commands: one
that only looks, one that must be signed, or
signed. The words are never run. A command that must be signed and came with plain ssh is refused here. A signed request is checked, every part of it, before anything else happens (see Signed requests); then the door goes on with exactly the signed words. - It writes into
private/activity.log: the time, the account and the command, and for a signed request the key that signed it and the request's nonce. (Never the text of a comment.) Each entry is one line of at most 500 bytes, with every control character written out as text; a command typed over plain ssh longer than 4096 bytes is refused and noted by its size alone. Past 5 MB the log is kept asactivity.log.1and a new one is started. - It counts the hourly limits, for every account but administrators and the owner (Settings Reference), and the command checks the account's role.
- If the command changes something, it takes the lock, changes the files
in the record, makes one commit with the request in it, signed with
the site's key, updates the list for the Changes page, and runs
folio-generateto write the pages again. - If accounts, keys or nodes changed, it runs
folio-keysto write the keys file again. - It prints the answer. A refusal is one line starting with
folio:, and it is noted in the activity log with its reason.
Build nodes come in the same way, to folio-node-door, which knows these
commands: help, request-info, claim, alive NUMBER and result NUMBER STATE. It cannot change the record. A claim and a result must
come signed with the node's own GPG key (see
Build nodes sign what they hand in).
The site hosts no git repositories. Someone who tries git push to it is
told:
folio: this site hosts no repositories. Put your project on your forge, then: watch https://forge.example.org/you (or, for one repository: follow ADDRESS)
Signed requests
The rule is "verify, then trust". Every command that changes anything is refused unless it comes as a request signed with the GPG key recorded for the account that comes in. Commands that only look still work with plain ssh.
It takes both keys at once:
- the SSH key says which account came in;
- the signature says that account's person asked for exactly this command, at this site, now, with exactly this standard input.
A stolen SSH key alone changes nothing: the thief cannot sign. A stolen GPG key alone gets nobody in: the thief has no SSH key the site knows.
The request
A request is seven lines of text, each ending in a line end:
folio-request 1
site: 5A2C...E91F
account: alice
command: vote hello
input: none
time: 1795600000
nonce: 3f9c0d6e1b2a4c5d8e7f6a5b4c3d2e1f
| Line | What it holds |
|---|---|
site: |
the fingerprint of the site's own key. A request made for one site is of no use at another |
account: |
who asks |
command: |
the command, its words split at blanks and joined by one space. No control characters, at most 4000 bytes |
input: |
sha256 HEX, the sha256 of what comes on standard input (a comment, a key), or none |
time: |
when it was signed, in seconds since 1970 (UTC) |
nonce: |
32 random hexadecimal digits. Each counts once |
The signature is an armored, detached OpenPGP signature of those bytes
(gpg --armor --detach-sign). The folio command and the desktop program
send both, each in base64 on one word, as the command
signed REQUEST SIGNATURE, with the command's input on standard input.
They learn what to put in the first lines from the read-only command
request-info, which prints site: FPR, account: NAME,
time: SECONDS and pgp: FPR (the account's GPG key, or none).
What the door checks
Before it does anything, the door checks, in this order, and refuses at the first that does not hold, with nothing changed:
- the request is seven lines exactly. The door builds the text again from what it read and compares the two byte for byte, so nothing can hide in it;
- the account in it is the account whose SSH key came in;
- the site in it is this site;
- its time is within five minutes of the site's clock, either way;
- the account has a GPG key;
- the signature is one good signature by the account's key
(
accounts/NAME/pgp.asc), checked in a keyring of its own that is thrown away afterwards. A key that ran out or was revoked is refused, and so is any other key; - what came on standard input (all of it, at most 300000 bytes) has the sha256 the request names;
- the nonce was not seen before. It is kept for 20 minutes in
private/nonces/, longer than any request stays within the time window.
Then it runs exactly the signed words, with exactly the signed input.
Every request it takes is also kept in private/requests/NONCE and
NONCE.asc.
The folio command and the desktop program sort commands with the same
table as the door (the test suite checks that the three agree). Before
they send anything, both check that the account has a GPG key on the site
and that it is the key they would sign with. The folio command also
checks that the computer's clock is no more than four minutes off the
site's.
Requests in the record
Every change the door commits keeps its request in the commit's message,
after Acted-by: NAME:
Acted-by: alice
Request: 3f9c0d6e1b2a4c5d8e7f6a5b4c3d2e1f
-----BEGIN FOLIO REQUEST-----
folio-request 1
site: 5A2C...E91F
...
-----END FOLIO REQUEST-----
-----BEGIN PGP SIGNATURE-----
...
-----END PGP SIGNATURE-----
The commit is made with --cleanup=verbatim, so git keeps every byte. The
site's key still signs each commit, which binds the request to the change
it made.
So anyone with a copy of the record can check who asked for each change,
with gpgv and public keys alone: the asker's key is
accounts/NAME/pgp.asc in the tree of the commit before. folio-audit
does exactly that, and more (see Auditing a Site).
| Change | Where its request is kept |
|---|---|
| a change of the record | in the commit's message |
an import a request caused (follow, watch, fetch, admit) |
in the import's commits |
a build a request queued (rebuild) |
request = NONCE in the build's job, and the files builds/NUMBER/request and request.asc |
| a build node's claim and result | beside the build: claim-request, result-request (with .asc), and result.tar, the archive the result signed; in its job: claim-request = NONCE, result-request = NONCE, result-signer = node NAME FPR |
every request the site took, also those that change nothing in the record (mail, decline, admin registry-token, admin build remove, admin publish-now) |
private/requests/NONCE and NONCE.asc, on the server |
Erasing, and requests
A request that names what is erased (the erased account's name, as a
word) or came with it (an erased comment, known by its sha256) can neither
stay in the history nor be changed: its signature would no longer hold.
When the owner erases (admin erase, see the
Owner and Administrator Guide), such a
request's whole block is replaced by one line:
Request-erased: it named what was erased (see erasures/)
Every other request stays byte for byte and still checks. The erasure's
own note in erasures/ says how many went (requests-erased = N). The
owner's own admin erase account request names the account, so it is not
written into the record: that commit says
Request: NONCE (withheld: it names what was erased; the site keeps it).
The copies kept in private/requests/ and beside builds that name what
was erased are deleted too.
Build nodes sign what they hand in
A build node has a GPG key of its own, as a person has (admin node add
takes both its keys; admin node key sets a new one). Its claim and
result come as signed requests with the account node:NAME, and
folio-node-door checks them as the door checks a person's. A result's
input is the sha256 of the tar archive the node sends, checked before
anything of it is unpacked. Unsigned, or signed by anything but that
node's key, they are refused, and the result counts as not handed in.
alive is not signed: it only says the node is still at its build.
What the site does by itself names what authorised it
The site makes some changes without anyone asking at that moment. Each names, in lines of its own (trailers), the signed request or the record line that authorised it:
| The site's own change | Its trailers |
|---|---|
the timed import of a new commit (upload NAME VERSION, follow NAME at URL) |
Authorised-by: request NONCE: the follow, admit or watch request in the record that set up importing that package from that address. And Source-commit: HASH signed-by FPR: the forge commit it took, and the primary key of the maintainer's key that signed it (unsigned or signed-by-unknown KEYID only where the site does not require signatures) |
| publishing a build | beside the build, in its job: published-result = build NUMBER request NONCE node NAME FPR, the node's signed result. A build without a signed result is not published |
the switch to a new signing key (the site's key: the signing key FPR signs from now on, after OLD) |
Authorised-by: key-change FPR: the record's earlier line a new signing key, FPR, is published (folio-site-key new-signing-key, brought with folio-key import) |
sending to the forge (folio-mirror, a commit in SHORT-site) |
Authorised-by: request NONCE: the admin publish-to ADDRESS FINGERPRINT request in the record that confirmed the forge's host key |
a waiting build queued again (builds_wake) |
in its job: woken-by = build NUMBER, the published build it waited for |
An import made by a person's request (follow, fetch, admit, watch)
carries that request itself, and Source-commit: too. A package followed
before requests were signed has no request in the record that set it up,
and its timed imports name none (folio-audit then reports them); a
maintainer's signed follow URL NAME records one.
Not signed
Some changes carry no signed request. Each is still signed with the
site's key, and folio-audit lists each apart, with its reason:
- The first change,
a new site, owned by NAME, whichfolio-setupmakes before any account exists to sign. - The owner's key on the server.
folio-setup --owner-pgp KEY.asc DATA-FOLDERsets the owner's GPG key without a request, for an owner who lost theirs or a site made before keys were needed. Only the owner can reach the server. The record saysthe owner's GPG key, set on the server. - Changes of the site's key brought to the server with
folio-key(folio-key import BUNDLE, or anotherfolio-keystep there:the site's key: ...). They change onlyverify/key-changesandverify/site-key.asc.
The weak points that remain are listed in the design notes
(doc/design.md).
The life of a project
This is what happens, in order, from the moment the site is told about a project until a package can be installed. The program named in each step does the work; The programs lists them all.
1. The site is told where the project lives
A project stays in its own repository on the forge. Somebody tells the site where it is, in one of three ways:
| Command | Who may | What happens |
|---|---|---|
follow ADDRESS [NAME] |
a member | that one repository is imported now, and followed from then on. The package's name is the repository's name unless one is given |
watch ADDRESS-OF-AN-ACCOUNT |
a member | the site asks the forge for that account's repositories (at most 300) and imports each. Repositories added there later are imported too |
admin watch-forge ADDRESS-OF-THE-FORGE |
an administrator | the site asks the forge for all its public repositories and lists them on the page "Found on the forge". Nothing is fetched or built until a maintainer or administrator lets one in with admit OWNER/PROJECT, or turns it down with decline |
A site can limit the places it imports from with the setting sources
(Settings Reference).
From then on a timed job (folio-fetch --all) runs every two minutes. It
asks each followed repository for its newest commit (git ls-remote),
and imports again when that is not the commit the site has. It also asks
each watched account and the watched forge what is new there. The site's
own packages come first; of the repositories new to the site, one pass
imports at most import-per-pass (5) and begins none after ten minutes,
the rest waiting for the next pass by turns between accounts. The site's
lock is let go of after each repository, and one pass runs at a time.
2. Importing
folio-fetch brings the source in, and folio-upload-check judges it.
Both run on the server, as the user folio.
- The site fetches the repository's default branch into a copy of its
own,
cache/fetched/NAME.git. Nobody else can reach that copy. A repository is followed only at anhttps://address (http://andgit://are refused whenfolloworwatchis typed); git is never allowed to ask a question, a fetch gives up on a forge sending less than 1000 bytes a second for a minute, and a fetch is stopped after ten minutes: the site has no password or key to show a private repository. If the repository has nothing new, the answer isNAME: nothing new at ADDRESS. An address stored before https was required (http://orgit://) is no longer fetched: the import stops withNAME follows an insecure address (ADDRESS), and only https is accepted now; set it again: follow https://... NAME, andimportstells its maintainers the same. - A repository larger than the setting
source-limit-mb(2000 MB if it is not set) is not kept. The fetch itself may write no file larger than that (what comes in is kept as one pack), so a larger one is stopped while it comes in, and the site's copy is removed. - The project is checked, before any of it is unpacked, and only as far
as its limits: the newest commit's own text (author, message,
signature) at most 1 MB; then its signature, from the commit alone,
so that where signatures are required an unsigned commit, or one
signed by a key of nobody who may push it, is refused before any of
its tree is listed or read; its tree at most
source-limit-filesfiles, links and folders (50,000) andsource-limit-mbmegabytes unpacked; no path longer than 4096 characters. The tree is listed by git, and the listing is read only up to the limits, then stopped: a tiny repository can name millions of files, by naming one folder many times. Everything the site reads of a commit, listing, unpacking, packaging, download, takes at mostsource-limit-seconds(300). What reads the unpacked files (tar,folio-debianize,dpkg-parsechangelog) runs in a sandbox, as a build node's steps do (no network, the system read-only, only the project's folder writable, limits on file size, memory and processes); where the server cannot make one, the project is refused and nothing of it is read, unless the owner setimport-sandbox = off(then the activity log says each time that it was read without one, and the limits above still hold). Every file must be a plain file or a folder (no submodules), none larger than 20 MB, and files indebian/(and the folder itself) must not be links. A link elsewhere must point inside the project. Where it points is worked out from the link's words alone, never by following it: it must be a relative path, each../goes up one folder from the link's own folder, and every../must come first (ina/../b,acould itself be a link to somewhere else). Otherwise the project is refused withPATH is a link that points outside the project (TARGET); links may only point inside itorPATH is a link with ../ after a folder's name (TARGET); put every ../ at the start. Links inside the project stay links: in the source download, and in the source package a node makes. The site itself reads no link at all (see step 3 below). - The packaging is read, or written (step 3 below). This also gives the version.
- The newest commit's signature is checked against the PGP keys of the
person importing and of the package's maintainers. The result is kept
as one of
signed by a maintainer's key,signed by a key of none of its maintainersorunsigned. A signature that does not hold is refused. On a site withsignatures = required(a new site has it), only a maintainer's signature is accepted, also when the import every few minutes brings the commit in: it imports in the maintainer's name, under the same rule, andimportsshows the refusal. - If everything holds, the facts are written into the record:
meta,uploadandbinaries/. A new package gets the importer as its maintainer. It starts in the reviewed partmainif the importer is a maintainer, administrator or owner, and inunsafeotherwise. A project let in from a watched forge has no maintainer and starts inunsafe, whoever let it in. - The packaging files and the file list go to
source/NAME/, and a download of the source tosite/packages/NAME/NAME_VERSION.tar.gz. - All of this is one commit in the record,
upload NAME VERSION. Then the builds are queued (step 4) and the pages written again. - The answer says what was found, for example
hello 1.2 accepted: a new package, and you are its maintainer., then the signature, what the site worked out about the packaging, andbuilds queued for: RELEASES.
If the project is refused, nothing in the record changes. The answer is
one line starting with folio: that gives the reason. The reason is
also kept in private/refused/NAME, where the command imports shows
it, and the timed job does not try that commit again. A new commit, or
the command fetch PACKAGE, tries again.
3. Packaging
A Debian package needs more than the source: a version, a description,
how to build and install the program, and which packages the build
needs. Those are written in a folder called debian/.
If the project has a debian/ folder, it is used as it is. It must
hold control, changelog, rules and source/format; the format
must be 3.0 (native) or 3.0 (quilt); and the name in control and
changelog must be the package's name on the site. The version is the
one in debian/changelog; it may not be lower than the one the site has
(this would be version 1.1, but the site already has 1.2: raise the version in the source), and the same version on a new commit is taken
with a warning.
If it has none, the site writes one for itself with folio-debianize,
into a temporary copy. Nothing is written into the project. It works out
the version, how the project is built and installed, its description and
its licence from the project's own files. It reads only real files:
a file it looks for that is a link, or that is in a folder that is a
link, is taken as absent, and the answer says so
(README.md is a link, so it was not read (only the project's real files are)).
If the only file that says how the project is built is a link, the
project is refused
(Makefile is a link, and the site reads only the project's real files (a link could lead outside the project): make it a real file).
A project can settle what
cannot be guessed in a file of its own, .folio
(Settings Reference), and
Member Guide says what
to do when the site cannot tell. Which packages the build needs is
worked out later, by the build node, for each release separately. A
debian/ folder without a control file is refused.
The version, when the site writes the packaging
The site looks for the version the project states, in this order: the
.folio file, a VERSION file, the Makefile (VERSION = or
PACKAGE_VERSION =), meson.build, CMakeLists.txt, configure.ac,
pyproject.toml, and a #define NAME_VERSION "1.2" in the source. If
none states one, the version is 0, and every import of it gets the
longer form below (0+r57.gabc1234).
- The first import of a version is exactly that version:
1.2. - A later import of a commit that did not raise it gets a longer
version:
1.2+r57.gabc1234, where57is the number of commits in the project's history andabc1234the start of the commit's name. So every import is newer than the one before, which apt needs to offer it as an update. - An import whose version would be lower than the one the site has is
refused:
this would be version 1.1, but the site already has 1.2: raise the version in the source.
4. The queue
The site queues one build for each release and each kind of processor:
- the releases are the ones the project asks for (the field
X-Folio-Releasesin itsdebian/control, or for a project without packaging the linereleases = ...in its.folio), or else every release in the settingreleases. A name the site does not build for is refused at import:X-Folio-Releases: unknown 'hurd' (this site builds for: daedalus excalibur freia ceres)(from.folio:.folio releases: unknown 'hurd' (...)); - the kinds of processor are the ones in the setting
architectures(amd64if it is not set).
Each build is a folder builds/NUMBER/ with a file job of facts:
package, version, commit, release, kind of processor, state, who brought
it in (pushed-by; a build made again keeps it, and adds rebuilt-by
for who asked), how many attempts at it ended without a result (tries),
and the times. A build of the same package, release and processor
that had not finished yet is no longer wanted: it becomes superseded.
| State | Means |
|---|---|
queued |
waiting for a build node |
building |
a node has taken it |
succeeded |
it built |
failed |
the project did not build, its source package could not be made, or the commit is no longer on the forge. Or it can never build for that release: it needs something the release does not have (needs libwpewebkit-2.0-dev, which daedalus does not have, or before the build needs wpe-webkit-2.0.pc, which daedalus does not provide), or has but cannot install (needs NAME, which daedalus has but cannot install (apt: ...)). The log says why. A build is failed too when it was tried 3 times without a result: its note then says tried 3 times without a result; last: ... |
waiting |
it needs a package that one of this site's own projects builds, and that is not published for that release yet: waiting for nslib, from this site, to be published for daedalus in main; it is built again once it is. When that package is published where the build may use it, the build is queued again by itself (built again: nslib is published for daedalus now). rebuild NUMBER builds it again at once |
superseded |
a newer import replaced it before it finished |
5. A build node builds it
A build node is another computer, or another user on any computer, that
runs folio-node run (see Build Node Guide). An
administrator lets it in with admin node add NAME, which takes the
node's SSH key and its GPG key.
- The node asks for work. It asks the site for
request-info, then sends aclaimsigned with its GPG key, over ssh tofolio@dur.example.org, trusting only the site's published SSH keys. While it has nothing to do, it asks once a minute. - The site picks a build. First it puts back into the queue every
build whose node has not been heard from for 15 minutes (an attempt
without a result, see below), and any build this node still held (it
must have restarted; that does not count as an attempt). Then it takes the
oldest
queuedbuild for a kind of processor this node builds for, marks itbuildingby this node, and answers with its facts: the build's number, the package, version, commit, release, where the project lives, and what the site adds to the version for that release. If there is nothing, the answer isnothing. - The node fetches the source from the forge, at exactly that
commit. The site hands out no source of its own. A forge that cannot
be reached is the node's trouble (
error, see below); a commit that is not in the repository is the project's (failed). A forge that takes the connection and then sends nothing is the node's trouble too: the fetch is given up when it gets less than 1000 bytes a second for a minute, or has not finished after half an hour (fetching the source from ADDRESS timed out after 1800 seconds). The fetch, and steps 4 to 6, each run in a throwaway sandbox of their own (unshare: new user, mount, process, IPC and host-name namespaces). A step sees/usrand/etcread-only, its own folder/work, a/tmpand nothing else of the node: not its keys, its keyring, its settings, its cache or other builds. Only the fetch anduscanhave the network, over https only. A link indebian/still makes the buildfailed(debian/FILE is a link; files in debian/ must be real files), assbuildreads the source package outside its own sandbox, and the node writes packaging, as the site does, without reading links. The Build Node Guide has the table of what each step is given. - If the project has no packaging, the node writes it, as the site
did, now with the list of every file in every package of the release
(the
Contentsfile of Devuan's archive, kept for a week) and of the site's own archive. In those lists it looks up which packages provide thepkg-configmodules the build asks for, the libraries it links and the headers it includes. So the build's needs are right for each release, and one project can build against another of the same site. Apkg-configmodule the build cannot do without, which no package of the release has and none of the site's, means it cannot build there: the build isfailedbeforesbuildruns, withneeds wpe-webkit-2.0.pc, which daedalus does not provide. A module counts as one it cannot do without only where nothing suggests the build goes on without it (not inside a Makefile'sifeq, not asked for with--existsor with its complaint sent to/dev/null, not a meson dependency withrequired:, a fallback or a method, not a CMake one withoutREQUIRED, not an indented line, and so on). Headers and-llibraries are not counted: they are often only for some systems, or the project's own. If the release's list of files, or the site's, cannot be fetched, that is the node'serror(the list of files in daedalus could not be fetched from MIRROR). - It gives the version the release's addition, from the site's
settings
suffix-RELEASE:1.2becomes1.2+devuan6. Each release's package then has a version of its own. The new changelog entry takes its date from the package's own newest entry, so that two nodes build the very same files. - It makes the source package with
dpkg-source(for3.0 (quilt),uscanfirst fetches the original source; adebian/watchthat names an address that is nothttps://makes the buildfailed, anduscancannot follow a redirect to plain http or ftp either). - It builds with
sbuild, inside a small Devuan system made withmmdebstrapfor the purpose (made again after a week; deleted when not made again for two weeks, that is when not used for more than a week) and unpacked fresh for each build. Everything runs as the node's ordinary user, never as root, and the build cannot touch the node itself. The site's archive is added as a source of packages, checked with the keys apt on people's computers checks it with (apt/archive-keyring.gpg, the master and the archive's signing keys, never the record's), and only if that key's master is the one the node's settings name (site-key-fpr). An archive that cannot be reached, or a key with another master, is the node'serror: the build never goes on as if the site had no packages. A package inmainbuilds with packages frommainonly, one inunsafewith both parts. Limits. The whole build, steps 3 to 7, is held to the node's limits, from its settings file: time (limit-time, 4 hours unless set otherwise, withtimeout), the memory of each program (limit-memory, 4 GB, withprlimit), processes at once (limit-processes, 1024) and the disk its folder may hold (limit-disk, 20 GB, measured every 10 seconds). A build that reaches one isfailed, saying which (the build took longer than 4 hours); that is the package's trouble, so it is not an attempt counted against the node and is not tried again. Ifsbuildcannot install what the build needs, the node reads apt's own words about it (the lines of sbuild's stand-in packagesbuild-build-depends-main-dummy, asDepends: libwpewebkit-2.0-dev but it is not installable), looks each name up in the release's list of packages (fetched from the mirror, kept for a week), and hands inwaitingwith a filemissing: a line for each thing,absent:NAME(the release has no such package, and none provides it) orpresent:NAME. The site decides (see below). - It says it is still there once a minute (
alive NUMBER), but not once the build's time is up. If the site answersstop, because a newer import replaced the build or the build was given to another node, the node drops it. - It hands in the result with a signed
result NUMBER STATE, whose input is the sha256 of one tar archive with the packages, the.changesand.buildinfofiles, the source package, and the full log. The archive comes on standard input. The site checks its sha256 before it unpacks anything, and takes plain files only, with ordinary names, 2 GB at most. The node prints what the site answered: the state it took,back in the queue, or that the build is no longer wanted and nothing was taken. A result that could not be handed in is the node's own trouble.
The state a node reports is succeeded, failed or waiting, or
error when the trouble was the node's own (the forge could not be
reached or stopped answering, its build system could not be made, or a
list it needs from the mirror or the site could not be fetched, for
example). A list that could not be fetched is never taken as "the release
does not have it".
What the site makes of waiting with a list of what was missing (a
waiting without the file missing, or with nothing usable in it, cannot
say what to wait for: it counts as the node's error, tried again up to
three times, with the note NODE could not build it: it handed the build in as waiting without saying what is missing (...)):
- Something no package of this site builds for that release, and the
release does not have:
failed,needs NAME, which RELEASE does not have(several are named together). It can never build there, so it does not wait, even if it needs one of the site's packages too. - Otherwise, something one of this site's packages builds for that
release:
waiting. The job keeps what it waits for (waiting-for), and which build of that package the archive held. Each timefolio-publishruns, a waiting build whose package now has another build in the archive, in a part it may use, goes back toqueued. If that package was published while the build was being made, it is queued again at once (built again: NAME was published while it was being built). - Otherwise (the release has it, but it cannot be installed):
failed, with what the node found.
A node that sends waiting without that list (an older one) is taken at
its word, as before. An error build goes back into the queue for
any node to try; the node that had it waits five minutes before it asks
again.
Such an attempt without a result (an error, or no word from the node
for 15 minutes) is counted in the build's tries. A build that always
ends so (its repository is gone for good, or it stops the node) would
otherwise be taken again and again, before every newer build for that
kind of processor. So the third such attempt makes the build failed,
with the note tried 3 times without a result; last: REASON, and its
people are told as for any failed build. Until then the note says how
many are left: (attempt 1 of 3 without a result; 2 left). A node that
is switched off, or starts again while it holds a build, gives the build
back without its counting. rebuild makes a new build, which starts at
none.
When a result comes in, the site keeps the log and the files in
builds/NUMBER/, notes what each built package needs to run (for the
package's page), mails the uploader if the build failed and they asked
for mail (and, for a build made again, whoever asked for it, with the
line It was built again, asked for by NAME.), queues a check build if the site verifies (below), runs
folio-publish, and writes the pages again.
6. Verified builds (optional)
With the setting verify = yes or verify = required, every build that
succeeded is queued a second time, marked as a check of the first. Only a
different node may take the check. When it succeeds, the site
compares the two sets of .deb files: their names and their SHA-256
sums. The first build is then marked verified or not reproducible on
the Builds page, and the uploader is mailed if they differ. A check build
is never published itself.
- With
verify = yes, a build is published as soon as it may be, and the check follows. - With
verify = required, only a verified build is published. A site with one build node never publishes anything this way.
7. Publishing
folio-publish puts finished builds into the apt archive. It runs on the
server after each successful result, after each approve and admin move, after admin set of name, short-name, address, releases
or architectures, after each change of the site's key (folio-key),
and from the timed job when a new signing key takes over; it looks at
every build that is not published yet. A build is published only when
all of these hold:
-
it succeeded, and it is not a check build;
-
its build node signed its result (a build handed in before nodes signed their results is not published; build it again with
rebuild); -
no newer build of the same package, release and processor has succeeded or is still queued or building;
-
its commit is still the package's newest import;
-
its part allows it:
The package is in It is published unsafe, the unreviewed partat once main, the reviewed partwhen the owner imported it, or an administrator did to a package that is not the owner's (an administrator's import to the owner's package waits for the owner's approval), or when that very commit was approved ( approve PACKAGE) by the owner, or by an administrator if the package is not the owner's. Who imported and who approved are looked at as they are now: the approval of someone who is no longer an administrator counts for nothing. A maintainer cannot approve. Who asked for a build again (rebuild) does not count -
it is for a release and a kind of processor the settings still name;
-
on a site with
verify = required, it is verified.
Publishing means: the program reprepro takes the older version of the
package out of that release, in whichever part it was, and puts the new
one into the package's part. The build is marked published with the
date. reprepro then writes the archive's lists and signs them with the
site's signing key: the one that signs now, and no other. If that key
cannot sign (it ran out, or was revoked with no new one), nothing is
published, and folio-publish says so. The archive has lists of built
packages only, for each release, part and kind of processor: no lists of
source packages (each package's source is a download on its page
instead). After publishing, folio-publish queues again every waiting
build whose package of this site it now holds where that build may use
it.
An archive made by an earlier Folio also had empty lists of source
packages, and reprepro kept a table for each in its database.
folio-publish takes those out the first time it runs, also in an
archive restored from an older backup: it lets reprepro clear those
tables and nothing else, then removes the empty source folders from
apt/dists/. If the database holds anything Folio does not make, it
changes nothing and says so.
A release or kind of processor taken out of the settings (admin set releases, admin set architectures, which first say which packages go)
is taken out of the archive at once, in the same careful way: reprepro is
given a description of exactly the tables that stay and told to clear the
rest; its database is copied first, and put back unless exactly those
tables are left. Then the release's folder in apt/dists/ (or the
binary-... folders of that kind of processor) goes, and its builds are
no longer marked published; its builds that had not started are not
made. Named again, a release gets back what was built for it that is still
the newest. A release or kind of processor added to the settings gets every
package's newest upload queued for it at once (except where a build of it
is there already), each asked for by whoever changed the setting, with
their signed request.
Once a day the timed job asks each distribution's mirror what its
releases are (folio-releases): which is stable, testing and so on, and
whether the releases the site builds are still there. A new release, a
change, and a release that has gone are mailed once to the owner and the
administrators, with the command to type; nothing changes until someone
types it. admin releases shows the last check.
admin move PACKAGE main|unsafe changes the part a package belongs to.
What the archive holds of it moves along, as soon as it may be published
in its new part: into unsafe at once; into main once its upload is
approved, or at once if the owner imported it, or an administrator did to a package that is not the owner's. reprepro takes it
out of the release and puts the same files in again, in the new part.
The archive is plain files in apt/, served by the web server. Next to
the packages are the site's public key (archive-keyring.gpg and
archive-keyring.asc) and setup.sh, a short script that adds the site
to apt on someone's computer. Among the packages, in main, is the
site's keyring package, WORD-archive-keyring (for example
dur-archive-keyring): it holds the same public key, as
/usr/share/keyrings/folio-WORD-archive-keyring.gpg. folio-publish
makes it itself whenever the key changed, with a higher version each time.
setup.sh fetches the key and checks that its fingerprint is the one
written into the script (that takes gpg: without it the script stops,
unless it is given --no-check). It removes the files an earlier
setup.sh of the same site wrote under an older short name or address (it
knows them by their first line, # Added by setup.sh of and the site's
address, or by the site's key). It takes the computer's release from the
suite the computer's own apt uses, and else from /etc/os-release: the
first of those the site builds for (the site writes its releases into the
script), or --release NAME. It writes those lines and one deb line
that tells apt where the archive is and to check it with that key (no
deb-src line: the builds are published from binary-only .changes
files, so the archive holds no source packages). Then it installs the
keyring package and points the deb line at the package's key file
(Public Guide). From then on apt
checks every list from the site against that key, and refuses anything
that was changed on the way, whether it came from the site or from a
mirror. And apt keeps the keyring package up to date like any other
package, so the computer learns of the site's new signing keys, and of
revoked ones, by itself.
The archive carries two marks for apt. NotAutomatic means apt takes a
package from it only when asked for that package. ButAutomaticUpgrades
means apt keeps what was installed from it up to date. Adding the site
to apt therefore never replaces a package someone already has from
Devuan, and a new version of the keyring package arrives with a plain
apt upgrade.
8. The pages
After every change (a command, an import, a build taken or handed in),
the program folio-generate reads the record and the builds and writes
every page again into site/: the home page, a page per package,
per person and per build, the lists, the Changes page, the guides, a news
feed (feed.xml, the newest 20 imports), a file for programs
(packages.json), and the server's SSH keys (ssh-host-keys, see
The site's SSH keys). It is written in C and takes
a fraction of a second.
The pages are plain HTML files. No page carries a script, and the web server serves them as files. Two things look as if they needed a program; one of them does:
- Themes. Every page loads its colours from one address,
static/theme.css. A theme link (/theme/NAME) is answered by nginx itself: it stores the choice in a cookie and sends the visitor back to the page they came from. Forstatic/theme.cssnginx looks at the cookie and hands out that theme's file. No program runs. - Search. If the site has
search = yes, the address/search/findstartsfolio-search, a small read-only C program (throughfcgiwrap). It looks through a listfolio-generatewrote (site/search/index.tsv) and puts the matches into the search page. It writes nothing. It is the only program a visitor's request starts.
Writing back to the forge (optional)
If an administrator set it up (admin publish-to, admin registry-to;
see Forge Setup), the timed job runs folio-mirror every
two minutes, right after the import. It sends only to a forge server
that shows the SSH host key an administrator confirmed (ssh with
StrictHostKeyChecking=yes, the confirmed key as its only known host),
and sends what changed, with a key of the site's own. The site's signer
holds that key (/var/lib/folio-sign/forge/key) and the token, and does
the sending itself; on a site of the older kind the key is
private/forge/key:
| What | Where |
|---|---|
| the record, with its whole signed history | the repository SHORT-record (for a site whose short name is DUR: dur-record) |
| every page, the whole apt archive, and a README listing the packages | the repository SHORT-site, one new commit whenever something changed |
| each newly published package file | the forge's own package list, if the site was given an access token |
That makes the site browsable on the forge and keeps a copy of most of it there. The private folder and the signer's folder are never sent: the signing keys, the mail addresses and the token stay on the server.
The site's key
The site has one PGP key of its own. Its owner makes it on their own
computer before the site is set up (folio-site-key init, package
folio-client). It signs the apt archive's lists and every commit in the
record. Its public half is in the archive, as
https://dur.example.org/apt/archive-keyring.asc (the whole key) and
archive-keyring.gpg (what apt is given), and in the record, as
verify/site-key.asc.
The key has three parts. The master only says "these signing keys are
mine"; it stays on the owner's computer and never comes to the server. A
signing key for the archive signs the apt archive and nothing else,
and a signing key for the record signs the record and the site's copy
on the forge and nothing else: the master writes which into each (the
notation use@folio.invalid). apt is given the archive's signing keys
only (the keyring package and archive-keyring.gpg leave the record's
out), so the record's cannot sign an archive apt takes; admin verify and
folio-audit count a change of the record signed with the archive's key
as not holding. Each signing key runs out after signing-key-lifetime
days (365 if it is not set) unless the owner renews it (folio-site-key renew). The timed job mails the owner when renewal is due. (A site made
by an older Folio has one signing key for both, until its next change of
signing keys.)
Who holds what on the server. The secret parts of the signing keys
are held by the site's signer, a user of its own (folio-sign, its
folder /var/lib/folio-sign, which folio cannot read). Everything that
reads what comes from outside (the doors, the imports, reprepro, the
page generator) runs as folio, which holds no key and can only ask the
signer, through one sudo rule, to sign: an apt Release file, with the
archive's key, and a git commit object whose tree and parents are in the
record or the site's copy, with the record's key. The signer writes every
signature into sign.log (when, what, its sha256, the key), which
folio can read and not change. It also holds the forge key and token,
and sends to the forge itself, only to the address the record names and
with the host key it confirms. reprepro never runs with a keyring that
holds a key. So a break-in as folio can ask for signatures while it
lasts, but cannot carry a key away, and revoking and starting again is a
clean recovery. A site made by an older Folio, whose folio holds every
key, goes on so until its owner moves them (folio-install --migrate).
People's computers know the key through the keyring package. Every
change of the key is made with the master on the owner's computer
(folio-site-key), written into a bundle (the public key, and the secret
parts of new signing keys, never the master's), and brought to the server
(folio-key import BUNDLE). New signing keys come in three steps, so
that no computer ever stops being able to check the archive: they are
made and published in the keyring package while the old ones still sign
(folio-site-key new-signing-key); signing-key-overlap days later (14
if it is not set) they start to sign (by itself, from the timed job, or at
once with folio-key switch, which needs no master); then the old ones
are revoked, and a keyring package that says so is published
(folio-site-key revoke-old). Which signing keys sign, and how far a
change has come, is kept in private/key-state.
If the server is ever broken into, the owner revokes every signing key
it held, as stolen, and makes new ones, on their own computer
(folio-site-key emergency): no secret on the server is needed, and the
site stays the same site for everyone who saved its key. Their copy of
the key knows only the stolen archive key, so news of the revocation can
reach them only in an archive signed with it. So the signer keeps a copy
of the stolen key's secret part from before the revocation, and for 90
days (or until that key runs out, if sooner) signs the archive with it
beside the new key, in one block. A computer that upgrades in that time
takes the keyring package with the revocation, and refuses the stolen key
from then on. A computer that does not, or every computer when the site
was set up again without the signer's part (the stolen key's secret is
then gone), cannot update from the site until its setup.sh is run
again. Every
change of the key is written in the record (verify/key-changes), signed
with the record's signing key that signs afterwards. See
Owner and Administrator Guide.
The site's SSH keys
Everyone who reaches the site over SSH must know that the server they
reached is the site, and not someone in between. ssh tells by the
server's own keys (its host keys, in /etc/ssh). The first time, a plain
ssh command cannot know them and asks.
The site publishes them on its pages instead. folio-generate reads
sshd's /etc/ssh/ssh_host_ed25519_key.pub, ssh_host_ecdsa_key.pub and
ssh_host_rsa_key.pub (every user may read them) and writes
site/ssh-host-keys, one line per key in the form of known_hosts:
[dur.example.org]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA...
(the host and port the pages show; the host alone for port 22). The home
page and the guides show the keys' fingerprints, as ssh-keygen -l
prints them (SHA256:...). https vouches for the file as it does for the
pages.
- The desktop program and the
foliocommand fetch it withcurl --proto =https(trusting the system's certificate authorities, or a site's own alone if the person gave it one, with its fingerprint confirmed), keep the keys in~/.config/folio/trust/NAME/hosts/HOSTfor that site alone, and run ssh withStrictHostKeyChecking=yesand that file as its only known hosts. - A build node does the same, from the
web = https://...line of its settings, into~/.cache/folio-node/known_hosts. Without that line it does not start. - A person with plain ssh compares the fingerprint ssh shows with the
home page, or adds the file to
~/.ssh/known_hostsfirst (see the Member Guide).
A server that shows another key is refused before anything is sent.
Nothing that connects to the site trusts a key the first time it sees
one. Once kept, the keys are not replaced by themselves: when a server
shows a key they do not hold, the list is fetched again, and if the
site's pages list other keys now (the owner changed them, after a
break-in or a move), the folio command and the desktop program show
the fingerprints trusted until now and the ones listed now and ask
(folio --site NAME --host-keys without a terminal), and a build node
stops until its owner runs folio-node trust-host-keys. Nor does the site, when it writes a copy to the forge: it sends only
to a forge server whose SSH host key an administrator confirmed by its
fingerprint (admin publish-to ADDRESS, then admin publish-to ADDRESS FINGERPRINT; see Forge Setup, B1).
Mail (optional)
When something happens that concerns a person (a failed build, a
request about their package, an approval), the site writes a small file
into private/outbox, but only if that person gave a mail address and
confirmed it with the code the site mailed them, and only if someone
else caused it. Every five minutes a timed job (folio-mail) hands the
waiting files to the system's sendmail. Without a mail program they
wait, a week at most. Addresses are kept in private/mail, never in the
record.
Who trusts whom
| Who | Trusts | Because |
|---|---|---|
| the site | a person's SSH key, to say who came in | someone already there vouched for it |
| the site | a change | it comes as a request signed with the GPG key recorded for the account whose SSH key came in |
| the site | a project on a forge | a member brought it in, or a maintainer let it in; on a site with signatures = required, each commit it imports is signed with the GPG key of the person importing it or of one of the package's maintainers |
| the site | a build node | an administrator let its SSH key and GPG key in. The node can only take builds and hand in results, each signed with its GPG key. With verification, a second node checks it |
| apt, on someone's computer | the site's archive | its lists are signed with the site's key, whose fingerprint setup.sh checked once, and which the keyring package keeps up to date |
the desktop program, the folio command, a build node |
that the SSH server is the site's | it shows one of the keys the site's pages publish over https (ssh-host-keys) |
| the site | the forge's SSH server, when it writes a copy there | it shows the host key an administrator confirmed after comparing its fingerprint with the server's own (the record's publish-host-key; the key in private/forge/known_hosts) |
| someone reading the record | that it was not altered | every change is signed with the site's key |
| someone reading the record | that a person asked for a change | its request is in the commit, signed with that person's GPG key, which is in the record |
| nobody | the forge to hold secrets | the signing keys, mail addresses and tokens never leave the server |
The timed jobs
The guided setup writes /etc/cron.d/folio. Both jobs run as the user
folio.
| Every | What |
|---|---|
| 2 minutes | folio-fetch --all: look at every followed repository, every watched account and the watched forge, and import what is new (nothing while the signing key cannot sign). It also looks after the site's key: it mails the owner when the signing key is due to be renewed or has run out, and lets a new signing key take over when its day has come. Then folio-mirror: send what changed to the forge, if the site publishes to one |
| 5 minutes | folio-mail: send waiting mail |
Builds whose node went quiet are put back into the queue when the next node asks for work, not by a timed job.
The programs
| Program | Runs where, and when | Does |
|---|---|---|
folio-door |
the server, for each person's SSH command | every command a person can type |
folio-node-door |
the server, for each build node's SSH command | the node's commands: claim, alive, result |
folio-keys |
the server, when accounts, keys or nodes change | writes sshd's keys file |
folio-fetch |
the server, on the timer and from the door | imports from forges |
folio-upload-check |
the server, at each import | judges a project, writes its facts, queues builds |
folio-debianize |
the server at import; a build node at each build | writes packaging for a project that has none |
folio-publish |
the server, when a build succeeds, an upload is approved or a package moved, a setting the archive shows changes, or the site's key changes | puts builds into the apt archive, makes the keyring package, writes setup.sh |
folio-generate |
the server, after every change | writes every page |
folio-search |
the server, started by nginx for each search | the search |
folio-mirror |
the server, on the timer and from the door | writes to the forge |
folio-mail |
the server, on the timer | sends mail |
folio-key, folio-backup |
the server, by hand, as the user folio, or as root to hand signing keys to the signer (folio-key import) or take the signer's keys into a backup |
the site's key on the server; backups |
folio-signer |
the server, as the user folio-sign, through one sudo rule, whenever folio needs a signature or a sending to the forge |
holds the signing keys, the forge key and the token; signs apt Release files and the record's commits, and sends to the forge |
folio-sign-git |
the server, run by git in place of gpg | hands a commit of the record to the signer to be signed |
folio-erase |
the server, from the door (admin erase, the owner) |
erasing from the history |
folio-install, folio-setup |
the server, as root: once, and folio-install again after each upgrade |
setting a site up, and bringing what it wrote outside the site up to date (Owner Install Guide); folio-install --migrate gives a site of the older kind its signer |
folio-node |
a build node | asks for builds and does them |
folio, folio-mykeys, folio-audit (package folio-client) |
a person's computer | the site's commands, every change signed with the person's GPG key; making keys; checking a copy of the record (Auditing a Site) |
folio-site-key (package folio-client) |
the owner's computer | the site's master: makes the site's key, and every change of it, each as a bundle for folio-key import |
folio-desktop |
a person's computer | buttons for the commands, every change signed the same way (Desktop Program) |
Every command, with its words, is in Command Reference.
Using a site
Setting one up
Running one
- Owner and Administrator Guide
- Backup and Restore
- Settings Reference
- Command Reference
- Troubleshooting
Checking one