102.7. step-cli-0.30.6
The step-cli command — creates a CA for step-ca, and requests, renews and inspects certificates
| Version | 0.30.6, release 1 |
| Shelf | security — Security applications: GnuPG and front-ends, password and secret managers, certificates, scanners, forensics and audit |
| Phase | 41_system (System), 931 of 1047 in build order |
| Licence | Apache-2.0 |
| Homepage | https://smallstep.com/docs/step-cli/ |
| Build time | 0.9 SBU |
| Installed size | 37.3 MiB in 4 files |
| Recipe | ports/core/security/step-cli/kpkgbuild |
About
step-cli is Smallstep’s command-line tool for a private public-key infrastructure, the program upstream calls step. It creates a certificate authority (step-cli ca init), requests, renews and revokes certificates from a running step-ca, and inspects and converts keys, certificates and JWTs without one. In KDOS it is the setup tool and the client of step-ca: one root, trusted once, that speaks ACME so that a server such as caddy renews its certificates against it with the same configuration it would use for a public CA.
Why it is in KDOS
The comment above step-cli and step-ca in script/phases/41_system/packages.d/security.txt:
Let's Encrypt needs the internet and a self-signed cert per host means a warning per host that people learn to click through. One root, trusted once, speaking ACME so caddy renews against it with its public config.
step-clicreates that CA (step-cli ca init) and is its client.
Sources
step-cli-0.30.6.tar.gz(1.6 MiB)
sha2560c8562b95150cc24bf69ba18fcf9f0bf671f334f5d3ccb39f287692b61531b7c
upstream: https://github.com/smallstep/cli/archive/refs/tags/v0.30.6.tar.gz
archive copy: sources-4/security--step-cli-0.30.6.tar.gzstep-cli-vendor-0.30.6.tar.xz(4.9 MiB)
sha256d3194abd76b1d5190e42ffbaadaf6118fc6c93112fe1a05a7bb033de111c2acf
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-4/security--step-cli-vendor-0.30.6.tar.xz
Dependencies
Depends on: go.
Required by (1): step-ca.
Patches
build.sh applies these; kpkg applies nothing by itself.
command-name.patch— Bind the shell completions to the command name step-cliKDOS installs Smallstep's command as step-cli, so that it does not take /usr/bin/step from KDE Step. Completions bound to the name step would answer for the physics simulator's command and never for this one.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install step-cli'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/security/step-cli.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/security/step-cli
echo '0c8562b95150cc24bf69ba18fcf9f0bf671f334f5d3ccb39f287692b61531b7c step-cli-0.30.6.tar.gz' | sha256sum -c -
echo 'd3194abd76b1d5190e42ffbaadaf6118fc6c93112fe1a05a7bb033de111c2acf step-cli-vendor-0.30.6.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/step-cli
SRC=$SRC_ROOT/step-cli-0.30.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf step-cli-0.30.6.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/command-name.patch"
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export CGO_ENABLED=1
go build -mod=vendor -ldflags "-s -w -X main.Version=$version" -o step-cli ./cmd/step
install -Dm755 step-cli $PKG/usr/bin/step-cli
install -Dm644 autocomplete/bash_autocomplete \
$PKG/usr/share/bash-completion/completions/step-cli
install -Dm644 autocomplete/zsh_autocomplete \
$PKG/usr/share/zsh/site-functions/_step-cli
The switches, and why each is set:
export CGO_ENABLED=1— Build with cgo, which upstream’sMakefileleaves off unless asked (CGO_OVERRIDE). Any C code the build compiles then takes the tree’sCGO_CFLAGSandCGO_LDFLAGS, which the chroot exports.-X main.Version=$version— Stamp the release intostep-cli version. Upstream’sMakefilealso stampsmain.BuildTimewith the date; the recipe leaves it unset, or every build would be a different binary.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/step-cli, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf step-cli-0.30.6-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/step-cli, and runs the triggers its paths call for.
Contents
Installed programs: step-cli.
Installed directories: /usr/share/licenses/step-cli.
Notes
The command is step-cli. Upstream’s name, /usr/bin/step, belongs to KDE’s physics simulator step, whose menu entry runs it, and kpkg refuses a path two packages own. The program’s own help and error messages still say step, because they are compiled in: where they print step ca init, the command to type is step-cli ca init.
The Go modules come from the vendor bundle, step-cli-vendor-<version>.tar.xz, which ports/fetch makes with go mod vendor because the recipe says vendoring = go. build.sh unpacks it into the source tree and builds with -mod=vendor, offline. The bundle carries its own sha256 = line in the recipe, so a regenerated bundle that resolves differently is refused; see Vendoring.
The bash and zsh completions are installed from upstream’s autocomplete/ directory, under the command’s name. command-name.patch binds them to step-cli instead of step; bound to step, they would complete the physics simulator’s command and never this one.