Expand description
The shell scripts run as root (Linux), and the pieces of those that download something and
trust it only once it is checked: a fresh private work directory, gpg with a keyring of its own
there, and the check of a downloaded signing key against the fingerprints pinned for it. The
vendors’ apt repositories an install sets up (super::linux) go through the same check, and so
can an embedder’s own root scripts.
Structs§
- Root
Script - A shell script run as root (through pkexec on Linux, or
sudo -nunattended). The only way to make one isRootScript::new, which starts it withPRELUDE: no root script can miss stopping at its first failure, its private work directory, apt’s wait for the dpkg lock, or the C locale its output is read in. The step that runs a script as root takes this type, never aString.
Constants§
- NEED_
CURL - curl, installed first where a bare system has none (Debian’s minimal image): every vendor install downloads with it, and without it the repository checks read as “no packages”. Through apt where it is, else dnf (Fedora and the distributions built on it).
- NEED_
GPG - gpg, for the vendors’ signing keys (Debian’s minimal installs have only gpgv), and a private keyring folder for it in the work directory, so root’s own keyring is never read or changed.
- NEED_
UNZIP - unzip, for Amazon’s AWS CLI bundle, through apt where it is, else dnf.
- PRELUDE
- What every
RootScriptstarts with: the private work directory (set -e,$d, apt’s lock wait), then the C locale, so a tool’s output the script reads (apt-cache policy’sCandidate:) is the same words on every system: pkexec keeps the user’sLANG, and apt translates its labels.
Functions§
- check_
keys - Stops the script unless
"$d/key", a vendor’s signing key (or keyring) just downloaded, holds exactly the keys pinned here (fingerprints, 40 hex digits each, their primary keys), no more and no fewer. TLS alone trusted whatever the vendor’s server sent the first time; a swapped key would sign the packages apt then installs as root. Runs afterNEED_GPG.