Debian (APT)
Install, upload and sign Debian packages for apt on Debian and Ubuntu, and set up the repositories and keys they use.
On this page
Configure APT
A source names the repository's address, <base URL>/api/deb/<project>/<repository>/, a suite such as stable and a component such as main. Set up client renders, for apt 2.4 to 3.0:
# example: the repository deb-local of the project web, suite stable
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL -u quader:"${QUADER_TOKEN}" https://quader.example.com/api/deb/web/deb-local/signing-key.asc \
| sudo tee /etc/apt/keyrings/quader-web-deb-local.asc >/dev/null
sudo tee /etc/apt/sources.list.d/quader-web-deb-local.sources >/dev/null <<'SOURCES'
Types: deb
URIs: https://quader.example.com/api/deb/web/deb-local/
Suites: stable
Components: main
Signed-By: /etc/apt/keyrings/quader-web-deb-local.asc
SOURCES
sudo install -m 0600 /dev/null /etc/apt/auth.conf.d/quader-web-deb-local.conf
printf 'machine %s\nlogin %s\npassword %s\n' quader.example.com/api/deb/web/deb-local/ quader "${QUADER_TOKEN}" \
| sudo tee /etc/apt/auth.conf.d/quader-web-deb-local.conf >/dev/null
| File | Holds |
|---|---|
/etc/apt/keyrings/quader-<project>-<repository>.asc |
the repository's public keys, from signing-key.asc |
/etc/apt/sources.list.d/quader-<project>-<repository>.sources |
the source, Signed-By that key file only |
/etc/apt/auth.conf.d/quader-<project>-<repository>.conf |
the token, readable by root only |
The token never goes into the source line, which logs and world-readable files show; nothing turns verification off. A Public repository needs no credential file. A one-line .list form is a fold of the step. Compare the key's fingerprints with Signing keys in the repository's settings before you trust it. The index lists every package of a suite, so a token narrowed to some package names cannot use the repository as a source (404 on InRelease).
Upload and install
curl -fsS -u quader:"${QUADER_TOKEN}" --upload-file ./hello_2.10-3_amd64.deb \
'https://quader.example.com/api/deb/web/deb-local/upload/hello_2.10-3_amd64.deb?distribution=stable&component=main' # example
sudo apt-get update && sudo apt-get install hello=2.10-3
distributionis required,componentdefaults tomain; each may name up to 16, and the file is listed in every combination.- Name, version and architecture come from the package's control file, never from the request; Quader names the pool path itself.
201stores a new file,200finds the same bytes and only adds the suites. Other bytes for the same name, version and architecture answer409 deb_version_exists.- The index is built by a job a few seconds after the answer. A script waits with
GET …/deb/index?waitFor=<suite>:<changeSeq>, the number the upload answered (API). - Uploading needs deploy, deleting (
DELETEof the pool path) delete, both with the package's ownership; the first upload of a name makes you its owner.
The suites and components of a stored file, its coordinates, change through the API without a new upload, which moves a package from testing to stable. A repository holds at most 64 suites; a suite exists while a file is listed in it. A package of architecture all is listed under every architecture. APT installs the highest version among all its sources.
| Class | What APT meets |
|---|---|
| Local | Indexes Quader builds and signs with the repository's own key; a key no other repository shares |
| Remote | The archive's own release files, byte for byte, which the archive's key verifies; Quader signs nothing of a remote. Any suite of the archive works, also a flat one (./) |
| Virtual | One index per suite merged from its members, signed with the virtual repository's own key: install that key, never a member's |
Through a remote, the delivery rules refuse package files but pass the signed indexes, so APT lists a refused package and fails its download with 403 and no reason (Curating a remote repository). A virtual repository over the remote lists only what is delivered. Reading a virtual index needs read on every member (403 deb_members_unreadable); a new upload reaches it within deb.virtual_index_interval. Through a Bastion the snippets name its address; it passes the signed files unchanged.
Keys and clocks
Every Release is dated a minute behind the database's clock. A client whose clock trails by about a minute or more fails with not valid yet or a failed signature check: keep clients on synchronized time.
APT cannot learn a new key from a repository, so a rotation has an overlap:
| Key state | Signs | In signing-key.asc |
|---|---|---|
| Primary, Next | yes | yes |
| Withheld (only after a restore) | no | no |
| Retired: the private key is erased | no | no |
Quader cannot tell which clients replaced their key file: announce a promotion. Import a key takes an Ed25519 key, or RSA of at least 3,072 bits, without expiry, as the next key; send it with curl to keep the secret key out of a browser. Private keys are sealed in the database with the stored-secret key ring and leave it only for signing. Whoever holds the key ring and a copy of the database can sign for every Debian repository: guard both.
Settings
- Who
- the project's Owner, and holders of
repositories:write-config; the signing keys need manage on the repository
A local or virtual repository gets its first key when it is created. Its sections Signing keys and Indexes show the keys and each suite's state: current, pending or failed with a reason, such as no_signing_key after a restore. Rebuild all indexes rebuilds every suite from the stored rows. The format's own settings are in Debian (APT) settings:
| Class | Setting | Default | What it does |
|---|---|---|---|
| Local, virtual | Architectures | amd64, arm64 |
Indexes built for each; stored files add theirs |
| Local, virtual | Compression, Origin, Label | none, quader, the key |
xz beside gzip; the Origin and Label of every Release |
| Virtual | Suites, Components | none, main |
Suites served besides those of the local members; the components merged |
| Remote | Upstream keys | the archive's, for a preset | The archive's public keys; with them Quader verifies every release before it stores it |
| Remote | Suites, Components, Architectures, Translations, Source packages | none, main, amd64, en, off |
What a mirror copies; Suites is required |
A remote offers Debian (the default), Debian security updates, Ubuntu, Ubuntu security updates and Ubuntu ports; each brings its archive keys. A remote of another archive verifies nothing until you paste its keys as a PGP PUBLIC KEY BLOCK, and cannot be a mirror or a virtual member without them:
gpg --no-default-keyring --keyring /usr/share/keyrings/example-archive-keyring.gpg --export --armor > archive.asc # example: the archive's keyring
Compare the fingerprints the repository shows with the ones the archive publishes. When the archive adds a signing key, add it first: a release no key verifies answers 502. The cache periods are 600 seconds for metadata and 300 for "not found".
In the mode Mirror (Mirror) a remote copies the named suites, components and architectures, so apt-get works while the archive is away. Name what your clients ask for: Contents, dep11, installer indexes and .udeb files stay pull-through. A mirror of deb.debian.org needs package patterns that start with a literal part, or a storage limit. The installation's timings are the keys of deb.
After a restore, a package file deleted or a key retired since the restore point is withheld until an administrator reinstates it or confirms the deletion (Backup and restore).
Not available
- Source packages cannot be uploaded;
deb-srcworks through a remote. Nodput,.udebor debug-symbol packages. - No nested virtual repositories, snapshots, copies between repositories, or mirror of a flat repository.
- No
Valid-Untilin Quader's releases, no external key service, no vulnerability matching of Debian packages. - An endpoint with exposure rules serves no Debian repository; a Bastion does.