Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/scripts/pi5-8/install_owner_tools.sh # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / scripts / pi5-8 / install_owner_tools.sh` 60 lines ยท 4033 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2026 Drake Stapleton (AIEN / aien-dev) 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # install_owner_tools.sh -- PI5-8 Q2: install the YubiKey tools the owner-key ceremony needs. Host only; never touches a YubiKey. 18 # 19 # scripts/pi5-8/install_owner_tools.sh 20 # 21 # Why not the Ubuntu packages: Ubuntu 24.04 ships yubico-piv-tool 2.2.0 and yubikey-manager 5.2.1. PIV Ed25519 keys need 22 # yubico-piv-tool >= 2.5.0 (its NEWS: "Add support for ED25519 and X25519 key types. Available in firmware 5.7.0 and newer") 23 # and a YubiKey with firmware >= 5.7. This script builds the newest released yubico-piv-tool from Yubico's official source tarball 24 # and installs yubikey-manager (ykman, read-only status and checks) into a private virtual environment. 25 # 26 # Checks before anything is built: the tarball sha256 is pinned below, and the detached OpenPGP signature must verify against 27 # Yubico's signing key (primary key 1D73 08B0 055F 5AEF 3694 4A8F 27A9 C24D 9588 EA0F, listed on 28 # https://developers.yubico.com/Software_Projects/Software_Signing.html), fetched from keys.openpgp.org into a throw-away keyring. 29 # Needs (apt): pcscd libpcsclite-dev libssl-dev cmake gcc pkg-config check zlib1g-dev gengetopt help2man swig python3-venv gnupg. 30 # The smart card daemon also needs a polkit rule when you run from a non-graphical login; see docs/native/PI5-8-OWNER-CEREMONY.md. 31 set -euo pipefail 32 ver=2.7.3 33 url="https://developers.yubico.com/yubico-piv-tool/Releases/yubico-piv-tool-${ver}.tar.gz" 34 sha=`fcb25c42f54298ece8b20684fb3c581ed9195a162cbc55180a4161501be93181` 35 primary=1D7308B0055F5AEF36944A8F27A9C24D9588EA0F 36 ykman_ver=5.9.2 37 ykman_whl_sha=`19a1173106b104bea37722e61ce748fb2d39c87a02880c1964461837ddaa7fba` 38 prefix="${AIENOS_OWNER_TOOLS:-$HOME/.local}" 39 work="$(mktemp -d)"; trap 'rm -rf "${work}"' EXIT 40 mkdir -p "${work}/dl" "${work}/src" "${work}/build" "${work}/gnupg"; chmod 700 "${work}/gnupg" 41 curl -fsSL -o "${work}/dl/t.tar.gz" "${url}" 42 curl -fsSL -o "${work}/dl/t.tar.gz.sig" "${url}.sig" 43 [ "$(sha256sum < "${work}/dl/t.tar.gz" | cut -d' ' -f1)" = "${sha}" ] || { echo "REFUSED: tarball sha256 differs from the pinned value" >&2; exit 1; } 44 export GNUPGHOME="${work}/gnupg" 45 gpg --batch --quiet --keyserver hkps://keys.openpgp.org --recv-keys "${primary}" 46 st="$(gpg --batch --status-fd 1 --verify "${work}/dl/t.tar.gz.sig" "${work}/dl/t.tar.gz" 2>/dev/null || true)" 47 grep -q '^\[GNUPG:\] GOODSIG' <<<"${st}" && grep -q "^\[GNUPG:\] VALIDSIG .* ${primary}\$" <<<"${st}" \ 48 || { echo "REFUSED: signature does not verify against Yubico's key ${primary}" >&2; exit 1; } 49 echo "tarball sha256 and Yubico OpenPGP signature verified (${ver})" 50 tar -xzf "${work}/dl/t.tar.gz" -C "${work}/src" 51 cmake -S "${work}/src/yubico-piv-tool-${ver}" -B "${work}/build" -DCMAKE_INSTALL_PREFIX="${prefix}/yubico-piv-tool" >/dev/null 52 make -C "${work}/build" -j"$(nproc)" >/dev/null 53 make -C "${work}/build" install >/dev/null 54 python3 -m venv "${prefix}/ykman-venv" 55 "${prefix}/ykman-venv/bin/pip" download -q --no-deps "yubikey-manager==${ykman_ver}" -d "${work}/dl" 56 [ "$(sha256sum < "${work}/dl/yubikey_manager-${ykman_ver}-py3-none-any.whl" | cut -d' ' -f1)" = "${ykman_whl_sha}" ] \ 57 || { echo "REFUSED: ykman wheel sha256 differs from the pinned value" >&2; exit 1; } 58 "${prefix}/ykman-venv/bin/pip" install -q "yubikey-manager==${ykman_ver}" 59 LD_LIBRARY_PATH="${prefix}/yubico-piv-tool/lib" "${prefix}/yubico-piv-tool/bin/yubico-piv-tool" --version 60 "${prefix}/ykman-venv/bin/ykman" --version