diff --git a/tests/tailor-images/README.md b/tests/tailor-images/README.md new file mode 100644 index 0000000000..96018d802d --- /dev/null +++ b/tests/tailor-images/README.md @@ -0,0 +1,64 @@ +# Test images with tailor + +`tests/tailor-images/` is a [tailor](../../tools/tailor/README.md) workspace. +It replaces the legacy `testimages.py` / `builder/` flow, which runs alongside it +for now and is removed in a follow-up cleanup PR. + +## Build from the repo root + +Use the in-tree tailor binary via Cargo: + +```bash +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml matrix trident-installer --format json +``` + +Build examples: + +```bash +# trident-testimage +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml build trident-testimage -s arch=amd64 --output-dir ./artifacts + +# trident-testimage-arm64 +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml build trident-testimage -s arch=arm64 --output-dir ./artifacts + +# trident-direct-streaming-installer-arm64 +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml build trident-installer -s arch=arm64 -s variant=direct-streaming --output-dir ./artifacts + +# trident-container-usrverity-testimage (signed) +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml build trident-verity-testimage -s deployment=container -s mode=usr --output-dir ./artifacts +``` + +## Base images + +The workspace uses a `baseImages:` catalogue in `tests/tailor-images/tailor.yaml`. +For the Azure Linux base slots you can materialize the defaults locally with: + +```bash +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml bases download baremetal core_arm64 core_selinux qemu_guest +``` + +Verify that every referenced base file exists: + +```bash +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml bases verify +``` + +Ubuntu / GB200 direct-streaming inputs still come from the pipeline-managed blob +staging flow; those slots are intentionally catalogued without an in-workspace +remote source. + +## Image families + +The current families are: + +- `azl-installer` +- `azurelinux-direct-streaming-testimage` +- `foreign-direct-streaming-testimage` +- `trident-container-installer` +- `trident-container-testimage` +- `trident-functest` +- `trident-installer` +- `trident-mos` +- `trident-testimage` +- `trident-verity-testimage` +- `trident-vm-testimage` diff --git a/tests/tailor-images/azl-installer/image.yaml b/tests/tailor-images/azl-installer/image.yaml new file mode 100644 index 0000000000..c7ca49d701 --- /dev/null +++ b/tests/tailor-images/azl-installer/image.yaml @@ -0,0 +1,20 @@ +name: azl-installer + +base: + ref: baremetal + +outputs: + - format: iso + +rpmSources: + - ../../../bin/RPMS + - ../../../artifacts/rpm-overrides + +extraDependencies: + - ./installer-iso.yaml + - ./mos + - ./iso + - ../common + +config: + $include: ./installer-iso.yaml diff --git a/tests/tailor-images/azl-installer/installer-iso.yaml b/tests/tailor-images/azl-installer/installer-iso.yaml new file mode 100644 index 0000000000..79fcf0c032 --- /dev/null +++ b/tests/tailor-images/azl-installer/installer-iso.yaml @@ -0,0 +1,95 @@ +storage: + bootType: efi + + disks: + - partitionTableType: gpt + maxSize: 4G + partitions: + - id: esp + type: esp + size: 8M + + - id: rootfs + size: grow + + filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + + - deviceId: rootfs + type: ext4 + mountPoint: + path: / + +os: + hostname: azl-installer + bootloader: + resetType: hard-reset + + selinux: + mode: disabled + + kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=ttyS0 + - rd.info + - log_buf_len=1M + + packages: + install: + - curl + - device-mapper + - dnf + - dosfstools + - efibootmgr + - iproute + - iptables + - jq + - lsof + - mdadm + - nano + - netplan + - openssh-server + - squashfs-tools + - tar + - tpm2-tools + - trident-provisioning + - vim + - veritysetup + # Accessibility packages + - pcaudiolib + + additionalFiles: + # Getty service files for root autologin + - source: ../common/files/getty@.service + destination: /usr/lib/systemd/system/getty@.service + - source: ../common/files/serial-getty@.service + destination: /usr/lib/systemd/system/serial-getty@.service + - source: mos/scripts/installation.sh + destination: /root/installer/installation.sh + +iso: + initramfsType: full-os + + additionalFiles: + - source: iso/images/trident-testimage.cosi + destination: /images/azure-linux-core.cosi + - source: iso/bin/liveinstaller + destination: /installer/liveinstaller + - source: iso/files/config-placeholder.yaml + destination: /installer/trident-config.yaml.tmpl + + kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=tty1 + - console=ttyS0 + - loglevel=6 + +scripts: + postCustomization: + - path: mos/scripts/startup-command.sh diff --git a/tests/tailor-images/azl-installer/iso/.gitignore b/tests/tailor-images/azl-installer/iso/.gitignore new file mode 100644 index 0000000000..6fda09c27e --- /dev/null +++ b/tests/tailor-images/azl-installer/iso/.gitignore @@ -0,0 +1,2 @@ +/images/ +/bin/ \ No newline at end of file diff --git a/tests/tailor-images/azl-installer/iso/files/config-placeholder.yaml b/tests/tailor-images/azl-installer/iso/files/config-placeholder.yaml new file mode 100644 index 0000000000..135e8d6d57 --- /dev/null +++ b/tests/tailor-images/azl-installer/iso/files/config-placeholder.yaml @@ -0,0 +1 @@ +#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/installer/trident-config.yaml.tmpl:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################## diff --git a/tests/tailor-images/azl-installer/mos/scripts/installation.sh b/tests/tailor-images/azl-installer/mos/scripts/installation.sh new file mode 100644 index 0000000000..79289b519b --- /dev/null +++ b/tests/tailor-images/azl-installer/mos/scripts/installation.sh @@ -0,0 +1,51 @@ +#!/bin/bash +set -ex +trap '/bin/bash' ERR + +CDROM_MOUNT="/mnt/cdrom" +WORKING_DIR="/root/installer" +MAGIC_PLACEHOLDER="8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d" + +# Mount CD-ROM using symlink +mkdir -p "$CDROM_MOUNT" +mount /dev/cdrom "$CDROM_MOUNT" + +# CD-ROM paths +LIVEINSTALLER_PATH="$CDROM_MOUNT/installer/liveinstaller" +POSSIBLE_HC_TEMPLATE="$CDROM_MOUNT/installer/trident-config.yaml.tmpl" +IMAGES_DIR="$CDROM_MOUNT/images/" + +# WORKING_DIR paths +LIVEINSTALLER_BIN="$WORKING_DIR/liveinstaller" +TRIDENT_CONFIG_DESTINATION="/etc/trident/config.yaml" +LOG_FILE="$WORKING_DIR/liveinstaller.log" +OUTPUT_LOG="$WORKING_DIR/output_liveinstaller.log" + +# Copy to WORKING_DIR to execute liveinstaller +cp "$LIVEINSTALLER_PATH" "$LIVEINSTALLER_BIN" + +# Check if placeholder magic string is present (ISO not patched) +if grep -q "^#${MAGIC_PLACEHOLDER}:" "$POSSIBLE_HC_TEMPLATE"; then + # Placeholder found - execute attended installation (interactive UI) + cd "$WORKING_DIR" + "$LIVEINSTALLER_BIN" \ + --images-dir="$IMAGES_DIR" \ + --host-config-output="$TRIDENT_CONFIG_DESTINATION" \ + --log-level=trace \ + --log-file="$LOG_FILE" 2>&1 | tee "$OUTPUT_LOG" +else + # Placeholder was replaced by a Host Configuration - execute unattended installation + echo "Pre-configured Host Configuration found. Starting unattended installation..." + # Save template in WORKING_DIR in case of failure + TEMPLATE_FILE="$WORKING_DIR/template.yaml" + cp "$POSSIBLE_HC_TEMPLATE" "$TEMPLATE_FILE" + # Execute liveinstaller (unattended) + cd "$WORKING_DIR" + "$LIVEINSTALLER_BIN" \ + --unattended \ + --template-file="$TEMPLATE_FILE" \ + --log-level=trace \ + --log-file="$LOG_FILE" 2>&1 | tee "$OUTPUT_LOG" +fi + +/bin/bash \ No newline at end of file diff --git a/tests/tailor-images/azl-installer/mos/scripts/startup-command.sh b/tests/tailor-images/azl-installer/mos/scripts/startup-command.sh new file mode 100755 index 0000000000..7502521001 --- /dev/null +++ b/tests/tailor-images/azl-installer/mos/scripts/startup-command.sh @@ -0,0 +1,5 @@ +#!/bin/bash +INSTALLATION="/root/installer/installation.sh" +chmod +x "$INSTALLATION" + +chsh -s "$INSTALLATION" root diff --git a/tests/tailor-images/azurelinux-direct-streaming-testimage/by-arch/arm64.yaml b/tests/tailor-images/azurelinux-direct-streaming-testimage/by-arch/arm64.yaml new file mode 100644 index 0000000000..7ff2d78da3 --- /dev/null +++ b/tests/tailor-images/azurelinux-direct-streaming-testimage/by-arch/arm64.yaml @@ -0,0 +1,2 @@ +base: + $include: ../common/matrix/base-core-arm64.yaml diff --git a/tests/tailor-images/azurelinux-direct-streaming-testimage/image.yaml b/tests/tailor-images/azurelinux-direct-streaming-testimage/image.yaml new file mode 100644 index 0000000000..5249abc246 --- /dev/null +++ b/tests/tailor-images/azurelinux-direct-streaming-testimage/image.yaml @@ -0,0 +1,20 @@ +name: azurelinux-direct-streaming-testimage + +matrix: + arch: [amd64, arm64] + +base: + ref: baremetal + +outputs: + - format: baremetal-image + +rpmSources: + - ../../../bin/RPMS + - ../../../artifacts/rpm-overrides + +extraDependencies: + - ../common + +config: + $include: ./tailor/baseimg.yaml diff --git a/tests/tailor-images/azurelinux-direct-streaming-testimage/tailor/baseimg.yaml b/tests/tailor-images/azurelinux-direct-streaming-testimage/tailor/baseimg.yaml new file mode 100644 index 0000000000..a6af1726ae --- /dev/null +++ b/tests/tailor-images/azurelinux-direct-streaming-testimage/tailor/baseimg.yaml @@ -0,0 +1,68 @@ +storage: + bootType: efi + disks: + - partitionTableType: gpt + maxSize: 15G + partitions: + - id: esp + type: esp + size: 50M + label: esp + - id: root-a + size: 4G + type: root + label: root-a + - id: root-b + size: 4G + type: root + label: root-b + - id: swap + size: 2G + type: swap + label: swap + filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: root-a + type: ext4 + mountPoint: + path: / +os: + bootloader: + resetType: hard-reset + hostname: trident-rawcosi-testimage + selinux: + mode: permissive + kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=ttyS0 + - rd.info + - log_buf_len=1M + packages: + install: + - curl + - dnf + - efibootmgr + - iproute + - iptables + - lsof + - mdadm + - netplan + - openssh-server + - tpm2-tools + - vim + - audit + - device-mapper + - dosfstools + - lvm2 + - veritysetup + - ntfs-3g + - ntfsprogs + - selinux-policy + services: + enable: + - sshd diff --git a/tests/tailor-images/common/files/config-placeholder.yaml b/tests/tailor-images/common/files/config-placeholder.yaml new file mode 100644 index 0000000000..88bb0938cb --- /dev/null +++ b/tests/tailor-images/common/files/config-placeholder.yaml @@ -0,0 +1 @@ +#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/etc/trident/config.yaml:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/tailor-images/common/files/containerd-mmap-fix.cil b/tests/tailor-images/common/files/containerd-mmap-fix.cil new file mode 100644 index 0000000000..f9951716e1 --- /dev/null +++ b/tests/tailor-images/common/files/containerd-mmap-fix.cil @@ -0,0 +1,7 @@ +; Fix for containerd 2.2+ MountManager plugin SELinux denial. +; containerd 2.2 introduces a MountManager that opens a bbolt DB under +; /run/containerd/ using mmap(). The base refpolicy (RELEASE_2_20240226) +; grants manage_file_perms on container_runtime_t:file but that set does +; not include 'map'. Upstream fixed this in commit 7876e51510 (May 2024). +; This module backports the missing permission. +(allow container_engine_system_domain container_runtime_t (file (map))) diff --git a/tests/tailor-images/common/files/getty@.service b/tests/tailor-images/common/files/getty@.service new file mode 100644 index 0000000000..10d3131812 --- /dev/null +++ b/tests/tailor-images/common/files/getty@.service @@ -0,0 +1,58 @@ +# SPDX-License-Identifier: LGPL-2.1+ +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Getty on %I +Documentation=man:agetty(8) man:systemd-getty-generator(8) +Documentation=http://0pointer.de/blog/projects/serial-console.html +After=systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target +After=rc-local.service + +# If additional gettys are spawned during boot then we should make +# sure that this is synchronized before getty.target, even though +# getty.target didn't actually pull it in. +Before=getty.target +IgnoreOnIsolate=yes + +# IgnoreOnIsolate causes issues with sulogin, if someone isolates +# rescue.target or starts rescue.service from multi-user.target or +# graphical.target. +Conflicts=rescue.service +Before=rescue.service + +# On systems without virtual consoles, don't start any getty. Note +# that serial gettys are covered by serial-getty@.service, not this +# unit. +ConditionPathExists=/dev/tty0 + +[Service] +# the VT is cleared by TTYVTDisallocate +# The '-o' option value tells agetty to replace 'login' arguments with an +# option to preserve environment (-p), followed by '--' for safety, and then +# the entered username. +ExecStart=-/sbin/agetty --autologin root --noclear %I linux +Type=idle +Restart=always +RestartSec=0 +UtmpIdentifier=%I +TTYPath=/dev/%I +TTYReset=yes +TTYVHangup=yes +TTYVTDisallocate=yes +KillMode=process +IgnoreSIGPIPE=no +SendSIGHUP=yes + +# Unset locale for the console getty since the console has problems +# displaying some internationalized messages. +UnsetEnvironment=LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION + +[Install] +WantedBy=getty.target +DefaultInstance=tty1 diff --git a/tests/tailor-images/common/files/override-placeholder.conf b/tests/tailor-images/common/files/override-placeholder.conf new file mode 100644 index 0000000000..438677498c --- /dev/null +++ b/tests/tailor-images/common/files/override-placeholder.conf @@ -0,0 +1 @@ +#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/trident-override.conf:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/tailor-images/common/files/serial-getty@.service b/tests/tailor-images/common/files/serial-getty@.service new file mode 100644 index 0000000000..2f65391a8e --- /dev/null +++ b/tests/tailor-images/common/files/serial-getty@.service @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: LGPL-2.1+ +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Serial Getty on %I +Documentation=man:agetty(8) man:systemd-getty-generator(8) +Documentation=http://0pointer.de/blog/projects/serial-console.html +BindsTo=dev-%i.device +After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target +After=rc-local.service + +# If additional gettys are spawned during boot then we should make +# sure that this is synchronized before getty.target, even though +# getty.target didn't actually pull it in. +Before=getty.target +IgnoreOnIsolate=yes + +# IgnoreOnIsolate causes issues with sulogin, if someone isolates +# rescue.target or starts rescue.service from multi-user.target or +# graphical.target. +Conflicts=rescue.service +Before=rescue.service + +[Service] +# The '-o' option value tells agetty to replace 'login' arguments with an +# option to preserve environment (-p), followed by '--' for safety, and then +# the entered username. +ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I screen +Type=idle +Restart=always +UtmpIdentifier=%I +TTYPath=/dev/%I +TTYReset=yes +TTYVHangup=yes +KillMode=process +IgnoreSIGPIPE=no +SendSIGHUP=yes + +[Install] +WantedBy=getty.target diff --git a/tests/tailor-images/common/files/sudoers-wheel b/tests/tailor-images/common/files/sudoers-wheel new file mode 100644 index 0000000000..c8b3629606 --- /dev/null +++ b/tests/tailor-images/common/files/sudoers-wheel @@ -0,0 +1 @@ +%wheel ALL=(ALL:ALL) NOPASSWD: ALL \ No newline at end of file diff --git a/tests/tailor-images/common/files/trident-container.service b/tests/tailor-images/common/files/trident-container.service new file mode 100644 index 0000000000..98ce5f3e40 --- /dev/null +++ b/tests/tailor-images/common/files/trident-container.service @@ -0,0 +1,14 @@ +[Unit] +Description=Trident Agent +Requires=docker.service +After=network.target network-online.target systemd-udev-settle.service docker.service + +[Service] +Type=oneshot +ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then docker load --input /var/lib/trident/trident-container.tar.gz; fi" +ExecStart=docker run --name trident_container --pull=never --rm --privileged -v /etc/trident:/etc/trident -v /var/lib/trident:/var/lib/trident -v /var/log:/var/log -v /:/host -v /dev:/dev -v /run:/run -v /sys:/sys --pid host --ipc host trident/trident:latest commit --verbosity DEBUG +StandardOutput=journal+console +StandardError=journal+console + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/tests/tailor-images/common/files/use-grpc-client-commit.conf b/tests/tailor-images/common/files/use-grpc-client-commit.conf new file mode 100644 index 0000000000..958e0095c3 --- /dev/null +++ b/tests/tailor-images/common/files/use-grpc-client-commit.conf @@ -0,0 +1,5 @@ +[Service] +ExecStart= +ExecStart=trident grpc-client commit +StandardOutput=journal+console +StandardError=journal+console diff --git a/tests/tailor-images/common/matrix/base-core-arm64.yaml b/tests/tailor-images/common/matrix/base-core-arm64.yaml new file mode 100644 index 0000000000..d28ef19157 --- /dev/null +++ b/tests/tailor-images/common/matrix/base-core-arm64.yaml @@ -0,0 +1,2 @@ +$set: + ref: core_arm64 diff --git a/tests/tailor-images/foreign-direct-streaming-testimage/by-arch+source/arm64+ubuntu-2204.yaml b/tests/tailor-images/foreign-direct-streaming-testimage/by-arch+source/arm64+ubuntu-2204.yaml new file mode 100644 index 0000000000..42a5d73548 --- /dev/null +++ b/tests/tailor-images/foreign-direct-streaming-testimage/by-arch+source/arm64+ubuntu-2204.yaml @@ -0,0 +1,7 @@ +base: + $set: + ref: ubuntu_2204_arm64 + +outputs: + $replace: + - format: baremetal-image diff --git a/tests/tailor-images/foreign-direct-streaming-testimage/by-arch+source/arm64+ubuntu-2404.yaml b/tests/tailor-images/foreign-direct-streaming-testimage/by-arch+source/arm64+ubuntu-2404.yaml new file mode 100644 index 0000000000..19c7d4ce27 --- /dev/null +++ b/tests/tailor-images/foreign-direct-streaming-testimage/by-arch+source/arm64+ubuntu-2404.yaml @@ -0,0 +1,7 @@ +base: + $set: + ref: ubuntu_2404_arm64 + +outputs: + $replace: + - format: baremetal-image diff --git a/tests/tailor-images/foreign-direct-streaming-testimage/by-source/gb200-2404.yaml b/tests/tailor-images/foreign-direct-streaming-testimage/by-source/gb200-2404.yaml new file mode 100644 index 0000000000..274d1a2b3e --- /dev/null +++ b/tests/tailor-images/foreign-direct-streaming-testimage/by-source/gb200-2404.yaml @@ -0,0 +1,7 @@ +base: + $set: + ref: gb200_2404_arm64 + +outputs: + $replace: + - format: baremetal-image diff --git a/tests/tailor-images/foreign-direct-streaming-testimage/by-source/ubuntu-2404.yaml b/tests/tailor-images/foreign-direct-streaming-testimage/by-source/ubuntu-2404.yaml new file mode 100644 index 0000000000..888cdf330e --- /dev/null +++ b/tests/tailor-images/foreign-direct-streaming-testimage/by-source/ubuntu-2404.yaml @@ -0,0 +1,7 @@ +base: + $set: + ref: ubuntu_2404_amd64 + +outputs: + $replace: + - format: baremetal-image diff --git a/tests/tailor-images/foreign-direct-streaming-testimage/image.yaml b/tests/tailor-images/foreign-direct-streaming-testimage/image.yaml new file mode 100644 index 0000000000..3d006bffb6 --- /dev/null +++ b/tests/tailor-images/foreign-direct-streaming-testimage/image.yaml @@ -0,0 +1,16 @@ +name: foreign-direct-streaming-testimage +operation: convert + +matrix: + arch: [amd64, arm64] + source: [ubuntu-2204, ubuntu-2404, gb200-2404] + +selectors: + exclude: + - { arch: amd64, source: gb200-2404 } + +base: + ref: ubuntu_2204_amd64 + +outputs: + - format: baremetal-image diff --git a/tests/tailor-images/tailor.yaml b/tests/tailor-images/tailor.yaml new file mode 100644 index 0000000000..66bc741425 --- /dev/null +++ b/tests/tailor-images/tailor.yaml @@ -0,0 +1,77 @@ +schemaVersion: 1 + +previewFeatures: + - signing + +toolchains: + default: ic + entries: + - name: ic + container: mcr.microsoft.com/azurelinux/imagecustomizer + tag: latest + +signing: + default: test-ca + profiles: + test-ca: + backend: local-test-ca + publishCaCert: ./artifacts/ca_cert.pem + +baseImages: + - name: baremetal + path: ../../artifacts/baremetal.vhdx + arch: amd64 + source: + oci: + uri: mcr.microsoft.com/azurelinux/3.0/image/baremetal:latest + platform: linux/amd64 + - name: core_arm64 + path: ../../artifacts/core_arm64.vhdx + arch: arm64 + source: + oci: + uri: mcr.microsoft.com/azurelinux/3.0/image/core_arm64:latest + platform: linux/arm64 + - name: core_selinux + path: ../../artifacts/core_selinux.vhdx + arch: amd64 + source: + oci: + uri: mcr.microsoft.com/azurelinux/3.0/image/core_selinux:latest + platform: linux/amd64 + - name: qemu_guest + path: ../../artifacts/qemu_guest.vhdx + arch: amd64 + source: + oci: + uri: mcr.microsoft.com/azurelinux/3.0/image/qemu_guest:latest + platform: linux/amd64 + - name: ubuntu_2204_amd64 + path: ../../artifacts/ubuntu_2204_amd64.vhdx + arch: amd64 + - name: ubuntu_2204_arm64 + path: ../../artifacts/ubuntu_2204_arm64.vhdx + arch: arm64 + - name: ubuntu_2404_amd64 + path: ../../artifacts/ubuntu_2404_amd64.vhdx + arch: amd64 + - name: ubuntu_2404_arm64 + path: ../../artifacts/ubuntu_2404_arm64.vhdx + arch: arm64 + - name: gb200_2404_arm64 + path: ../../artifacts/gb200_2404_arm64.vhdx + arch: arm64 + +images: + members: + - azl-installer + - azurelinux-direct-streaming-testimage + - foreign-direct-streaming-testimage + - trident-container-installer + - trident-container-testimage + - trident-functest + - trident-installer + - trident-mos + - trident-testimage + - trident-verity-testimage + - trident-vm-testimage diff --git a/tests/tailor-images/trident-container-installer/README.md b/tests/tailor-images/trident-container-installer/README.md new file mode 100644 index 0000000000..ab32274c66 --- /dev/null +++ b/tests/tailor-images/trident-container-installer/README.md @@ -0,0 +1,21 @@ +# Trident Container Installer ISO Test Image + +This image is used in the Trident test pipelines. At startup, it loads a +specified version of a container, which must be provided. Trident runs from +this container. The configuration for Trident can be patched into the ISO by +replacing it with the placeholder file (config-placeholder). + +This image does **not** include Trident RPMs — Trident is loaded from a +container at boot. + +## Building + +From the repo root, run: + +```bash +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml build trident-container-installer --output-dir ./artifacts +``` + +Output is written to `artifacts/trident-container-installer_amd64_iso.iso` by default +(tailor publishes under the cell's slug). +Use `--output-dir ` to change the output location. diff --git a/tests/tailor-images/trident-container-installer/base/files/root.profile b/tests/tailor-images/trident-container-installer/base/files/root.profile new file mode 100644 index 0000000000..14baf5c9e2 --- /dev/null +++ b/tests/tailor-images/trident-container-installer/base/files/root.profile @@ -0,0 +1,2 @@ +# Open journalctl immediately after autologin +journalctl -f --no-tail -u trident-container \ No newline at end of file diff --git a/tests/tailor-images/trident-container-installer/base/files/trident-container.service b/tests/tailor-images/trident-container-installer/base/files/trident-container.service new file mode 100644 index 0000000000..2c93c93962 --- /dev/null +++ b/tests/tailor-images/trident-container-installer/base/files/trident-container.service @@ -0,0 +1,16 @@ +[Unit] +Description=Trident Agent +Requires=docker.service +After=network.target network-online.target systemd-udev-settle.service docker.service + +[Service] +Type=oneshot +ExecStartPre=/bin/bash -c "set -e; mkdir -p /var/lib/trident" +ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then curl $(grep -oP '^\s*phonehome: \\K.*(?=phonehome)' /etc/trident/config.yaml)files/trident-container.tar.gz -o /var/lib/trident/trident-container.tar.gz -f; fi" +ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then docker load --input /var/lib/trident/trident-container.tar.gz; fi" +ExecStart=docker run --name trident_container --pull=never --rm --privileged -v /etc/trident:/etc/trident -v /etc/pki:/etc/pki:ro -v /run/initramfs/live:/trident_cdrom -v /var/lib/trident:/var/lib/trident -v /var/log:/var/log -v /:/host -v /dev:/dev -v /run:/run -v /sys:/sys --pid host --ipc host trident/trident:latest install --verbosity TRACE +StandardOutput=journal+console +StandardError=journal+console + +[Install] +WantedBy=multi-user.target diff --git a/tests/tailor-images/trident-container-installer/base/scripts/load-containerd-selinux-fix.sh b/tests/tailor-images/trident-container-installer/base/scripts/load-containerd-selinux-fix.sh new file mode 100755 index 0000000000..f908b04698 --- /dev/null +++ b/tests/tailor-images/trident-container-installer/base/scripts/load-containerd-selinux-fix.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Load SELinux policy module that grants the 'map' permission on +# container_runtime_t:file for container engines. This fixes containerd +# 2.2+ MountManager bbolt mmap() denials under enforcing mode. +semodule -i /usr/share/selinux/packages/containerd-mmap-fix.cil diff --git a/tests/tailor-images/trident-container-installer/base/scripts/post-install.sh b/tests/tailor-images/trident-container-installer/base/scripts/post-install.sh new file mode 100755 index 0000000000..5b2f4f7ca8 --- /dev/null +++ b/tests/tailor-images/trident-container-installer/base/scripts/post-install.sh @@ -0,0 +1,15 @@ +# Add the necessary directories for the audit logs so that auditd can start +mkdir -p /var/log/audit +# Use more intuitive path for the ISO mount +ln -s -T /run/initramfs/live /trident_cdrom + +# Load the config from the CDROM so that the user can patch it +if [ ! -d /etc/trident ]; then + mkdir /etc/trident +fi +ln -s -T /trident_cdrom/trident-config.yaml /etc/trident/config.yaml + +if [ ! -d /etc/systemd/system/trident-container.service.d ]; then + mkdir /etc/systemd/system/trident-container.service.d +fi +ln -s -T /trident_cdrom/trident-override.conf /etc/systemd/system/trident-container.service.d/override.conf \ No newline at end of file diff --git a/tests/tailor-images/trident-container-installer/image.yaml b/tests/tailor-images/trident-container-installer/image.yaml new file mode 100644 index 0000000000..46126e9637 --- /dev/null +++ b/tests/tailor-images/trident-container-installer/image.yaml @@ -0,0 +1,14 @@ +name: trident-container-installer + +base: + ref: baremetal + +outputs: + - format: iso + +extraDependencies: + - ./base + - ../common + +config: + $include: ./tailor/baseimg.yaml diff --git a/tests/tailor-images/trident-container-installer/tailor/baseimg.yaml b/tests/tailor-images/trident-container-installer/tailor/baseimg.yaml new file mode 100644 index 0000000000..926fc52269 --- /dev/null +++ b/tests/tailor-images/trident-container-installer/tailor/baseimg.yaml @@ -0,0 +1,71 @@ +storage: + bootType: efi + disks: + - partitionTableType: gpt + maxSize: 4G + partitions: + - id: esp + type: esp + size: 8M + - id: rootfs + size: grow + filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: rootfs + type: ext4 + mountPoint: + path: / +os: + bootloader: + resetType: hard-reset + hostname: trident-container-mos-testimg + packages: + install: + - curl + - device-mapper + - dnf + - docker-cli + - iproute + - iptables + - mdadm + - moby-engine + - openssh-server + - selinux-policy + - squashfs-tools + - tar + - vim + additionalFiles: + - source: ../common/files/getty@.service + destination: /usr/lib/systemd/system/getty@.service + - source: ../common/files/serial-getty@.service + destination: /usr/lib/systemd/system/serial-getty@.service + - source: base/files/root.profile + destination: /root/.profile + - source: base/files/trident-container.service + destination: /usr/lib/systemd/system/trident-container.service + - source: ../common/files/containerd-mmap-fix.cil + destination: /usr/share/selinux/packages/containerd-mmap-fix.cil + services: + enable: + - trident-container + - sshd +scripts: + postCustomization: + - path: base/scripts/post-install.sh + - path: base/scripts/load-containerd-selinux-fix.sh +iso: + additionalFiles: + - source: ../common/files/config-placeholder.yaml + destination: /trident-config.yaml + - source: ../common/files/override-placeholder.conf + destination: /trident-override.conf + kernelCommandLine: + extraCommandLine: + - enforcing=0 + - console=tty0 + - console=ttyS0 + - rd.luks=0 diff --git a/tests/tailor-images/trident-container-testimage/README.md b/tests/tailor-images/trident-container-testimage/README.md new file mode 100644 index 0000000000..619c7da2ee --- /dev/null +++ b/tests/tailor-images/trident-container-testimage/README.md @@ -0,0 +1,20 @@ +# Trident Container Test Image + +This image is an extension of the base baremetal image and includes various +helper utilities along with Docker runtime. It also adds openssh-server to +allow for remote access. + +This image does **not** include Trident RPMs — Trident runs from a container +loaded at runtime. + +## Building + +From the repo root, run: + +```bash +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml build trident-container-testimage --output-dir ./artifacts +``` + +Output is written to `artifacts/trident-container-testimage_amd64_cosi.cosi` by default +(tailor publishes under the cell's slug). +Use `--output-dir ` to change the output location. diff --git a/tests/tailor-images/trident-container-testimage/base/files/trident-container.service b/tests/tailor-images/trident-container-testimage/base/files/trident-container.service new file mode 100644 index 0000000000..bba22a9650 --- /dev/null +++ b/tests/tailor-images/trident-container-testimage/base/files/trident-container.service @@ -0,0 +1,16 @@ +[Unit] +Description=Trident Agent +Requires=docker.service +After=network.target network-online.target systemd-udev-settle.service docker.service + +[Service] +Type=oneshot +ExecStartPre=/bin/bash -c "set -e; if ! docker image ls | grep -q 'trident/trident'; then docker load --input /var/lib/trident/trident-container.tar.gz; fi" +# TODO: Remove line to enable SELinux, when bug #9508 is fixed. +ExecStartPre=/bin/bash -c "sudo setenforce 0" +ExecStart=docker run --name trident_container --pull=never --rm --privileged -v /etc/trident:/etc/trident -v /var/lib/trident:/var/lib/trident -v /var/log:/var/log -v /:/host -v /dev:/dev -v /run:/run -v /sys:/sys --pid host --ipc host trident/trident:latest commit --verbosity DEBUG +StandardOutput=journal+console +StandardError=journal+console + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/tests/tailor-images/trident-container-testimage/base/scripts/load-containerd-selinux-fix.sh b/tests/tailor-images/trident-container-testimage/base/scripts/load-containerd-selinux-fix.sh new file mode 100755 index 0000000000..f908b04698 --- /dev/null +++ b/tests/tailor-images/trident-container-testimage/base/scripts/load-containerd-selinux-fix.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Load SELinux policy module that grants the 'map' permission on +# container_runtime_t:file for container engines. This fixes containerd +# 2.2+ MountManager bbolt mmap() denials under enforcing mode. +semodule -i /usr/share/selinux/packages/containerd-mmap-fix.cil diff --git a/tests/tailor-images/trident-container-testimage/base/scripts/post-install.sh b/tests/tailor-images/trident-container-testimage/base/scripts/post-install.sh new file mode 100755 index 0000000000..79da025b3b --- /dev/null +++ b/tests/tailor-images/trident-container-testimage/base/scripts/post-install.sh @@ -0,0 +1,2 @@ +# Add the necessary directories for the audit logs so that auditd can start +mkdir -p /var/log/audit diff --git a/tests/tailor-images/trident-container-testimage/image.yaml b/tests/tailor-images/trident-container-testimage/image.yaml new file mode 100644 index 0000000000..8f08e93d1f --- /dev/null +++ b/tests/tailor-images/trident-container-testimage/image.yaml @@ -0,0 +1,14 @@ +name: trident-container-testimage + +base: + ref: baremetal + +outputs: + - format: cosi + +extraDependencies: + - ./base + - ../common + +config: + $include: ./tailor/baseimg.yaml diff --git a/tests/tailor-images/trident-container-testimage/tailor/baseimg.yaml b/tests/tailor-images/trident-container-testimage/tailor/baseimg.yaml new file mode 100644 index 0000000000..8eb64082e2 --- /dev/null +++ b/tests/tailor-images/trident-container-testimage/tailor/baseimg.yaml @@ -0,0 +1,71 @@ +storage: + bootType: efi + disks: + - partitionTableType: gpt + maxSize: 4G + partitions: + - id: esp + type: esp + size: 8M + - id: rootfs + size: grow + filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: rootfs + type: ext4 + mountPoint: + path: / +os: + bootloader: + resetType: hard-reset + hostname: trident-container-testimg + kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=ttyS0 + - rd.info + - log_buf_len=1M + packages: + remove: + - grub2-efi-binary + install: + - grub2-efi-binary-noprefix + - curl + - dnf + - efibootmgr + - iproute + - iptables + - lsof + - mdadm + - netplan + - openssh-server + - tpm2-tools + - vim + - device-mapper + - dosfstools + - lvm2 + - veritysetup + - ntfs-3g + - ntfsprogs + - docker-cli + - moby-engine + - selinux-policy + - squashfs-tools + - tar + additionalFiles: + - source: base/files/trident-container.service + destination: /usr/lib/systemd/system/trident-container.service + - source: ../common/files/containerd-mmap-fix.cil + destination: /usr/share/selinux/packages/containerd-mmap-fix.cil + services: + enable: + - trident-container + - sshd +scripts: + postCustomization: + - path: base/scripts/post-install.sh + - path: base/scripts/load-containerd-selinux-fix.sh diff --git a/tests/tailor-images/trident-functest/image.yaml b/tests/tailor-images/trident-functest/image.yaml new file mode 100644 index 0000000000..ede199be9e --- /dev/null +++ b/tests/tailor-images/trident-functest/image.yaml @@ -0,0 +1,10 @@ +name: trident-functest + +base: + ref: baremetal + +outputs: + - format: qcow2 + +config: + $include: ./tailor/baseimg.yaml diff --git a/tests/tailor-images/trident-functest/tailor/baseimg.yaml b/tests/tailor-images/trident-functest/tailor/baseimg.yaml new file mode 100644 index 0000000000..c087bee4c6 --- /dev/null +++ b/tests/tailor-images/trident-functest/tailor/baseimg.yaml @@ -0,0 +1,75 @@ +storage: + bootType: efi + disks: + - partitionTableType: gpt + maxSize: 15G + partitions: + - id: esp + type: esp + size: 50M + label: esp + - id: root-a + size: 4G + type: root + label: root-a + - id: root-b + size: 4G + type: root + label: root-b + - id: swap + size: 2G + type: swap + label: swap + - id: trident + size: 100M + type: linux-generic + label: trident + filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: root-a + type: ext4 + mountPoint: + path: / + - deviceId: trident + type: ext4 + mountPoint: + path: /var/lib/trident +os: + bootloader: + resetType: hard-reset + hostname: trident-functest + selinux: + mode: permissive + kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=ttyS0 + - rd.info + - log_buf_len=1M + packages: + install: + - curl + - dnf + - efibootmgr + - iproute + - iptables + - lsof + - mdadm + - netplan + - openssh-server + - tpm2-tools + - vim + - audit + - device-mapper + - dosfstools + - lvm2 + - veritysetup + - ntfs-3g + - ntfsprogs + services: + enable: + - sshd diff --git a/tests/tailor-images/trident-installer/README.md b/tests/tailor-images/trident-installer/README.md new file mode 100644 index 0000000000..cf24a33a60 --- /dev/null +++ b/tests/tailor-images/trident-installer/README.md @@ -0,0 +1,19 @@ +# Trident Installer ISO Test Image + +This image is used by the Trident test pipelines. It contains a copy of Trident that launches at +startup and reads a configuration that can be patched into the ISO. + +## Building + +From the repo root, run: + +```bash +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml build trident-installer -s arch=amd64 -s variant=default --output-dir ./artifacts +``` + +Other legacy variants map to selectors on the same family: + +- `trident-split-installer` → `-s arch=amd64 -s variant=split` +- `trident-direct-streaming-installer-amd64` → `-s arch=amd64 -s variant=direct-streaming` +- `trident-installer-arm64` → `-s arch=arm64 -s variant=default` +- `trident-direct-streaming-installer-arm64` → `-s arch=arm64 -s variant=direct-streaming` diff --git a/tests/tailor-images/trident-installer/base/files/direct-streaming-placeholder.conf b/tests/tailor-images/trident-installer/base/files/direct-streaming-placeholder.conf new file mode 100644 index 0000000000..a215248819 --- /dev/null +++ b/tests/tailor-images/trident-installer/base/files/direct-streaming-placeholder.conf @@ -0,0 +1 @@ +#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/direct-streaming.conf:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/tailor-images/trident-installer/base/files/pre-trident-script.sh b/tests/tailor-images/trident-installer/base/files/pre-trident-script.sh new file mode 100644 index 0000000000..2f58380523 --- /dev/null +++ b/tests/tailor-images/trident-installer/base/files/pre-trident-script.sh @@ -0,0 +1 @@ +#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/pre-trident-script.sh:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/tailor-images/trident-installer/base/files/rcp-agent.yaml b/tests/tailor-images/trident-installer/base/files/rcp-agent.yaml new file mode 100644 index 0000000000..f67f224a79 --- /dev/null +++ b/tests/tailor-images/trident-installer/base/files/rcp-agent.yaml @@ -0,0 +1 @@ +#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/rcp-agent.yaml:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/tailor-images/trident-installer/base/files/root.profile b/tests/tailor-images/trident-installer/base/files/root.profile new file mode 100644 index 0000000000..0042af12a5 --- /dev/null +++ b/tests/tailor-images/trident-installer/base/files/root.profile @@ -0,0 +1,5 @@ +# Add short alias to see trident's logs +alias tridentlog="journalctl -u trident -u trident-network" + +# Open journalctl immediately after autologin +journalctl -f --no-tail -u trident -u trident-network \ No newline at end of file diff --git a/tests/tailor-images/trident-installer/base/files/trident-install.service b/tests/tailor-images/trident-installer/base/files/trident-install.service new file mode 100644 index 0000000000..2057d49dd2 --- /dev/null +++ b/tests/tailor-images/trident-installer/base/files/trident-install.service @@ -0,0 +1,10 @@ +[Unit] +Description=Trident Install Service +After=network.target network-online.target systemd-udev-settle.service + +[Service] +ExecStart=trident install --verbosity DEBUG +Type=oneshot + +[Install] +WantedBy=multi-user.target diff --git a/tests/tailor-images/trident-installer/base/files/trident-split-install.service b/tests/tailor-images/trident-installer/base/files/trident-split-install.service new file mode 100644 index 0000000000..bfb868b857 --- /dev/null +++ b/tests/tailor-images/trident-installer/base/files/trident-split-install.service @@ -0,0 +1,13 @@ +[Unit] +Description=Trident Install Service +After=network.target network-online.target systemd-udev-settle.service + +[Service] +ExecStart=echo stage +ExecStart=trident install --verbosity DEBUG --allowed-operations stage +ExecStart=echo finalize +ExecStart=trident install --verbosity DEBUG --allowed-operations finalize +Type=oneshot + +[Install] +WantedBy=multi-user.target diff --git a/tests/tailor-images/trident-installer/base/post-install.sh b/tests/tailor-images/trident-installer/base/post-install.sh new file mode 100755 index 0000000000..1bfa85174a --- /dev/null +++ b/tests/tailor-images/trident-installer/base/post-install.sh @@ -0,0 +1,31 @@ +# Add the necessary directories for the audit logs so that auditd can start +mkdir -p /var/log/audit + +# Use more intuitive path for the ISO mount +ln -s -T /run/initramfs/live /trident_cdrom + +# Load the config from the CDROM so that the user can patch it +if [ ! -d /etc/trident ]; then + mkdir -p /etc/trident +fi + +if [ "$1" != "stream-image-test" ]; then + ln -s -T /trident_cdrom/trident-config.yaml /etc/trident/config.yaml + + if [ ! -d /etc/systemd/system/trident-install.service.d ]; then + mkdir -p /etc/systemd/system/trident-install.service.d + fi + ln -s -T /trident_cdrom/trident-override.conf /etc/systemd/system/trident-install.service.d/override.conf +else + # The stream image test purposefully does not have /etc/trident/config.yaml, so remove + # this condition from the systemd service to avoid it failing to start + sed -i 's|ConditionPathExists=/etc/trident/config.yaml||' /usr/lib/systemd/system/trident-install.service +fi + +# Ensure /etc/rcp-agent/ exists +if [ ! -d /etc/rcp-agent ]; then + mkdir -p /etc/rcp-agent +fi + +# Link rcp-agent config from the ISO +ln -s -T /trident_cdrom/rcp-agent.yaml /etc/rcp-agent/config.yaml \ No newline at end of file diff --git a/tests/tailor-images/trident-installer/by-arch/arm64.yaml b/tests/tailor-images/trident-installer/by-arch/arm64.yaml new file mode 100644 index 0000000000..02f51548c7 --- /dev/null +++ b/tests/tailor-images/trident-installer/by-arch/arm64.yaml @@ -0,0 +1,6 @@ +base: + $include: ../common/matrix/base-core-arm64.yaml + +outputs: + $replace: + - format: iso diff --git a/tests/tailor-images/trident-installer/by-variant/direct-streaming.yaml b/tests/tailor-images/trident-installer/by-variant/direct-streaming.yaml new file mode 100644 index 0000000000..aa8dd57e6e --- /dev/null +++ b/tests/tailor-images/trident-installer/by-variant/direct-streaming.yaml @@ -0,0 +1,58 @@ +outputs: + $replace: + - format: iso + +config: + os: + hostname: + $set: trident-direct-streaming-mos-testimage + packages: + update: + - systemd + install: + $remove: + - trident-static-pcrlock-files + - selinux-policy + - audit + $append: + - setools-console + - trident-selinux + - trident-install-service + services: + enable: + $remove: + - trident-install + $append: + - rcp-agent + disable: + - trident-install + additionalFiles: + $remove: + - source: base/files/trident-install.service + destination: /usr/lib/systemd/system/trident-install.service + $append: + - source: ../../../artifacts/rcp-agent + destination: /usr/bin/rcp-agent + - source: ../../../artifacts/rcp-agent.service + destination: /usr/lib/systemd/system/rcp-agent.service + scripts: + postCustomization: + $replace: + - path: base/post-install.sh + arguments: + - stream-image-test + iso: + additionalFiles: + $replace: + - source: base/files/pre-trident-script.sh + destination: /pre-trident-script.sh + - source: base/files/rcp-agent.yaml + destination: /rcp-agent.yaml + kernelCommandLine: + extraCommandLine: + $append: + - selinux=1 + +extraDependencies: + - ../../../artifacts/rcp-agent + - ../../../artifacts/rcp-agent.service diff --git a/tests/tailor-images/trident-installer/by-variant/split.yaml b/tests/tailor-images/trident-installer/by-variant/split.yaml new file mode 100644 index 0000000000..65614b47f1 --- /dev/null +++ b/tests/tailor-images/trident-installer/by-variant/split.yaml @@ -0,0 +1,26 @@ +outputs: + $replace: + - format: iso + +config: + os: + packages: + install: + $remove: + - binutils + - trident-static-pcrlock-files + - selinux-policy + - selinux-policy-devel + - audit + additionalFiles: + $remove: + - source: base/files/trident-install.service + destination: /usr/lib/systemd/system/trident-install.service + $append: + - source: base/files/trident-split-install.service + destination: /usr/lib/systemd/system/trident-install.service + iso: + additionalFiles: + $remove: + - source: ../common/files/override-placeholder.conf + destination: /trident-override.conf diff --git a/tests/tailor-images/trident-installer/image.yaml b/tests/tailor-images/trident-installer/image.yaml new file mode 100644 index 0000000000..dc7bc48d07 --- /dev/null +++ b/tests/tailor-images/trident-installer/image.yaml @@ -0,0 +1,62 @@ +name: trident-installer + +matrix: + arch: [amd64, arm64] + variant: [default, split, direct-streaming] + +selectors: + exclude: + - { arch: arm64, variant: split } + +base: + ref: baremetal + +outputs: + - format: iso + +rpmSources: + - ../../../bin/RPMS + - ../../../artifacts/rpm-overrides + +extraDependencies: + - ./base + - ../common + +config: + storage: + $include: ./include/storage.yaml + os: + bootloader: + resetType: hard-reset + hostname: trident-mos-testimage + packages: + install: + - $include: ./include/common-packages.yaml + - binutils + - trident-static-pcrlock-files + - selinux-policy + - selinux-policy-devel + - audit + services: + enable: + - sshd + - trident-install + - tridentd.socket + additionalFiles: + - $include: ./include/common-files.yaml + - source: base/files/trident-install.service + destination: /usr/lib/systemd/system/trident-install.service + selinux: + mode: enforcing + scripts: + postCustomization: + - path: base/post-install.sh + iso: + additionalFiles: + - source: ../common/files/config-placeholder.yaml + destination: /trident-config.yaml + - source: ../common/files/override-placeholder.conf + destination: /trident-override.conf + kernelCommandLine: + extraCommandLine: + - $include: ./include/kernel-args.yaml diff --git a/tests/tailor-images/trident-installer/include/common-files.yaml b/tests/tailor-images/trident-installer/include/common-files.yaml new file mode 100644 index 0000000000..8c72875d36 --- /dev/null +++ b/tests/tailor-images/trident-installer/include/common-files.yaml @@ -0,0 +1,6 @@ +- source: ../common/files/getty@.service + destination: /usr/lib/systemd/system/getty@.service +- source: ../common/files/serial-getty@.service + destination: /usr/lib/systemd/system/serial-getty@.service +- source: base/files/root.profile + destination: /root/.profile diff --git a/tests/tailor-images/trident-installer/include/common-packages.yaml b/tests/tailor-images/trident-installer/include/common-packages.yaml new file mode 100644 index 0000000000..82b2d430e0 --- /dev/null +++ b/tests/tailor-images/trident-installer/include/common-packages.yaml @@ -0,0 +1,19 @@ +- curl +- device-mapper +- dnf +- dosfstools +- efibootmgr +- iproute +- iptables +- lsof +- mdadm +- netplan +- ntfs-3g +- ntfsprogs +- openssh-server +- squashfs-tools +- tar +- tpm2-tools +- trident +- vim +- veritysetup diff --git a/tests/tailor-images/trident-installer/include/kernel-args.yaml b/tests/tailor-images/trident-installer/include/kernel-args.yaml new file mode 100644 index 0000000000..9b4f24cc61 --- /dev/null +++ b/tests/tailor-images/trident-installer/include/kernel-args.yaml @@ -0,0 +1,3 @@ +- console=tty0 +- console=ttyS0 +- rd.luks=0 diff --git a/tests/tailor-images/trident-installer/include/storage.yaml b/tests/tailor-images/trident-installer/include/storage.yaml new file mode 100644 index 0000000000..28c45f83e1 --- /dev/null +++ b/tests/tailor-images/trident-installer/include/storage.yaml @@ -0,0 +1,20 @@ +bootType: efi +disks: + - partitionTableType: gpt + maxSize: 4G + partitions: + - id: esp + type: esp + size: 8M + - id: rootfs + size: grow +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: rootfs + type: ext4 + mountPoint: + path: / diff --git a/tests/tailor-images/trident-mos/files/pre-trident-script.sh b/tests/tailor-images/trident-mos/files/pre-trident-script.sh new file mode 100644 index 0000000000..2f58380523 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/pre-trident-script.sh @@ -0,0 +1 @@ +#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/pre-trident-script.sh:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/tailor-images/trident-mos/files/rcp-agent.service b/tests/tailor-images/trident-mos/files/rcp-agent.service new file mode 100644 index 0000000000..1522e80f9d --- /dev/null +++ b/tests/tailor-images/trident-mos/files/rcp-agent.service @@ -0,0 +1,14 @@ +[Unit] +Description=Netlaunch RCP proxy +After=network.target network-online.target +Before=tridentd.service + +[Service] +Type=simple +ExecStart=/usr/bin/rcp-agent +Restart=on-failure +StandardOutput=journal+console +StandardError=journal+console + +[Install] +WantedBy=multi-user.target tridentd.service diff --git a/tests/tailor-images/trident-mos/files/rcp-agent.yaml b/tests/tailor-images/trident-mos/files/rcp-agent.yaml new file mode 100644 index 0000000000..f67f224a79 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/rcp-agent.yaml @@ -0,0 +1 @@ +#8505c8ab802dd717290331acd0592804c4e413b030150c53f5018ac998b7831d:/trident_cdrom/rcp-agent.yaml:############################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################ diff --git a/tests/tailor-images/trident-mos/files/root.profile b/tests/tailor-images/trident-mos/files/root.profile new file mode 100644 index 0000000000..0e0a03dc66 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/root.profile @@ -0,0 +1,2 @@ +# Open journalctl immediately after autologin +journalctl -f --no-tail -u trident-install.service -p emerg..info \ No newline at end of file diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/350-action-efi-application.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/350-action-efi-application.pcrlock new file mode 100644 index 0000000000..2baaa9ceb1 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/350-action-efi-application.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":4,"digests":[{"hashAlg":"sha1","digest":"cd0fdb4531a6ec41be2753ba042637d6e5f7f256"},{"hashAlg":"sha256","digest":"3d6772b4f84ed47595d72a2c4c5ffd15f5bb72c7507fe26f2aaee2c69d5633ba"},{"hashAlg":"sha384","digest":"77a0dab2312b4e1e57a84d865a21e5b2ee8d677a21012ada819d0a98988078d3d740f6346bfe0abaa938ca20439a8d71"},{"hashAlg":"sha512","digest":"03020279c5ea3676d6630c82a9931343225e8eab81529b65c786aeb6a445d3852a34dd193178f938b6b47345a72d4b647df309c971f7c02f0ede296a136a1086"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/400-secureboot-separator.pcrlock.d/300-0x00000000.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/400-secureboot-separator.pcrlock.d/300-0x00000000.pcrlock new file mode 100644 index 0000000000..c577c9874b --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/400-secureboot-separator.pcrlock.d/300-0x00000000.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":7,"digests":[{"hashAlg":"sha1","digest":"9069ca78e7450a285173431b3e52c5c25299e473"},{"hashAlg":"sha256","digest":"df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119"},{"hashAlg":"sha384","digest":"394341b7182cd227c5c6b07ef8000cdfd86136c4292b8e576573ad7ed9ae41019f5818b4b971c9effc60e1ad9f1289f0"},{"hashAlg":"sha512","digest":"ec2d57691d9b2d40182ac565032054b7d784ba96b18bcb5be0bb4e70e3fb041eff582c8af66ee50256539f2181d7f9e53627c0189da7e75a4d5ef10ea93b20b3"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/400-secureboot-separator.pcrlock.d/600-0xffffffff.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/400-secureboot-separator.pcrlock.d/600-0xffffffff.pcrlock new file mode 100644 index 0000000000..2e86898c99 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/400-secureboot-separator.pcrlock.d/600-0xffffffff.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":7,"digests":[{"hashAlg":"sha1","digest":"d9be6524a5f5047db5866813acf3277892a7a30a"},{"hashAlg":"sha256","digest":"ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e"},{"hashAlg":"sha384","digest":"4a06b879c7eedbe01c945d46b5bd785b59203dce81ea6a1206c28091ca285365f760d9167778f0dc1763d4854aafd40a"},{"hashAlg":"sha512","digest":"ea71bb243b0b2db729b9eb88e3c55a3f490fbff23457825051224a1fe6e6d3f480590cfa3a4a6b12c622d6ac366feb03cd17004ed004cb3f0d52731626946679"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/500-separator.pcrlock.d/300-0x00000000.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/500-separator.pcrlock.d/300-0x00000000.pcrlock new file mode 100644 index 0000000000..f1e473f1a3 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/500-separator.pcrlock.d/300-0x00000000.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":0,"digests":[{"hashAlg":"sha1","digest":"9069ca78e7450a285173431b3e52c5c25299e473"},{"hashAlg":"sha256","digest":"df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119"},{"hashAlg":"sha384","digest":"394341b7182cd227c5c6b07ef8000cdfd86136c4292b8e576573ad7ed9ae41019f5818b4b971c9effc60e1ad9f1289f0"},{"hashAlg":"sha512","digest":"ec2d57691d9b2d40182ac565032054b7d784ba96b18bcb5be0bb4e70e3fb041eff582c8af66ee50256539f2181d7f9e53627c0189da7e75a4d5ef10ea93b20b3"}]},{"pcr":1,"digests":[{"hashAlg":"sha1","digest":"9069ca78e7450a285173431b3e52c5c25299e473"},{"hashAlg":"sha256","digest":"df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119"},{"hashAlg":"sha384","digest":"394341b7182cd227c5c6b07ef8000cdfd86136c4292b8e576573ad7ed9ae41019f5818b4b971c9effc60e1ad9f1289f0"},{"hashAlg":"sha512","digest":"ec2d57691d9b2d40182ac565032054b7d784ba96b18bcb5be0bb4e70e3fb041eff582c8af66ee50256539f2181d7f9e53627c0189da7e75a4d5ef10ea93b20b3"}]},{"pcr":2,"digests":[{"hashAlg":"sha1","digest":"9069ca78e7450a285173431b3e52c5c25299e473"},{"hashAlg":"sha256","digest":"df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119"},{"hashAlg":"sha384","digest":"394341b7182cd227c5c6b07ef8000cdfd86136c4292b8e576573ad7ed9ae41019f5818b4b971c9effc60e1ad9f1289f0"},{"hashAlg":"sha512","digest":"ec2d57691d9b2d40182ac565032054b7d784ba96b18bcb5be0bb4e70e3fb041eff582c8af66ee50256539f2181d7f9e53627c0189da7e75a4d5ef10ea93b20b3"}]},{"pcr":3,"digests":[{"hashAlg":"sha1","digest":"9069ca78e7450a285173431b3e52c5c25299e473"},{"hashAlg":"sha256","digest":"df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119"},{"hashAlg":"sha384","digest":"394341b7182cd227c5c6b07ef8000cdfd86136c4292b8e576573ad7ed9ae41019f5818b4b971c9effc60e1ad9f1289f0"},{"hashAlg":"sha512","digest":"ec2d57691d9b2d40182ac565032054b7d784ba96b18bcb5be0bb4e70e3fb041eff582c8af66ee50256539f2181d7f9e53627c0189da7e75a4d5ef10ea93b20b3"}]},{"pcr":4,"digests":[{"hashAlg":"sha1","digest":"9069ca78e7450a285173431b3e52c5c25299e473"},{"hashAlg":"sha256","digest":"df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119"},{"hashAlg":"sha384","digest":"394341b7182cd227c5c6b07ef8000cdfd86136c4292b8e576573ad7ed9ae41019f5818b4b971c9effc60e1ad9f1289f0"},{"hashAlg":"sha512","digest":"ec2d57691d9b2d40182ac565032054b7d784ba96b18bcb5be0bb4e70e3fb041eff582c8af66ee50256539f2181d7f9e53627c0189da7e75a4d5ef10ea93b20b3"}]},{"pcr":5,"digests":[{"hashAlg":"sha1","digest":"9069ca78e7450a285173431b3e52c5c25299e473"},{"hashAlg":"sha256","digest":"df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119"},{"hashAlg":"sha384","digest":"394341b7182cd227c5c6b07ef8000cdfd86136c4292b8e576573ad7ed9ae41019f5818b4b971c9effc60e1ad9f1289f0"},{"hashAlg":"sha512","digest":"ec2d57691d9b2d40182ac565032054b7d784ba96b18bcb5be0bb4e70e3fb041eff582c8af66ee50256539f2181d7f9e53627c0189da7e75a4d5ef10ea93b20b3"}]},{"pcr":6,"digests":[{"hashAlg":"sha1","digest":"9069ca78e7450a285173431b3e52c5c25299e473"},{"hashAlg":"sha256","digest":"df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119"},{"hashAlg":"sha384","digest":"394341b7182cd227c5c6b07ef8000cdfd86136c4292b8e576573ad7ed9ae41019f5818b4b971c9effc60e1ad9f1289f0"},{"hashAlg":"sha512","digest":"ec2d57691d9b2d40182ac565032054b7d784ba96b18bcb5be0bb4e70e3fb041eff582c8af66ee50256539f2181d7f9e53627c0189da7e75a4d5ef10ea93b20b3"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/500-separator.pcrlock.d/600-0xffffffff.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/500-separator.pcrlock.d/600-0xffffffff.pcrlock new file mode 100644 index 0000000000..0b8d20b9c0 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/500-separator.pcrlock.d/600-0xffffffff.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":0,"digests":[{"hashAlg":"sha1","digest":"d9be6524a5f5047db5866813acf3277892a7a30a"},{"hashAlg":"sha256","digest":"ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e"},{"hashAlg":"sha384","digest":"4a06b879c7eedbe01c945d46b5bd785b59203dce81ea6a1206c28091ca285365f760d9167778f0dc1763d4854aafd40a"},{"hashAlg":"sha512","digest":"ea71bb243b0b2db729b9eb88e3c55a3f490fbff23457825051224a1fe6e6d3f480590cfa3a4a6b12c622d6ac366feb03cd17004ed004cb3f0d52731626946679"}]},{"pcr":1,"digests":[{"hashAlg":"sha1","digest":"d9be6524a5f5047db5866813acf3277892a7a30a"},{"hashAlg":"sha256","digest":"ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e"},{"hashAlg":"sha384","digest":"4a06b879c7eedbe01c945d46b5bd785b59203dce81ea6a1206c28091ca285365f760d9167778f0dc1763d4854aafd40a"},{"hashAlg":"sha512","digest":"ea71bb243b0b2db729b9eb88e3c55a3f490fbff23457825051224a1fe6e6d3f480590cfa3a4a6b12c622d6ac366feb03cd17004ed004cb3f0d52731626946679"}]},{"pcr":2,"digests":[{"hashAlg":"sha1","digest":"d9be6524a5f5047db5866813acf3277892a7a30a"},{"hashAlg":"sha256","digest":"ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e"},{"hashAlg":"sha384","digest":"4a06b879c7eedbe01c945d46b5bd785b59203dce81ea6a1206c28091ca285365f760d9167778f0dc1763d4854aafd40a"},{"hashAlg":"sha512","digest":"ea71bb243b0b2db729b9eb88e3c55a3f490fbff23457825051224a1fe6e6d3f480590cfa3a4a6b12c622d6ac366feb03cd17004ed004cb3f0d52731626946679"}]},{"pcr":3,"digests":[{"hashAlg":"sha1","digest":"d9be6524a5f5047db5866813acf3277892a7a30a"},{"hashAlg":"sha256","digest":"ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e"},{"hashAlg":"sha384","digest":"4a06b879c7eedbe01c945d46b5bd785b59203dce81ea6a1206c28091ca285365f760d9167778f0dc1763d4854aafd40a"},{"hashAlg":"sha512","digest":"ea71bb243b0b2db729b9eb88e3c55a3f490fbff23457825051224a1fe6e6d3f480590cfa3a4a6b12c622d6ac366feb03cd17004ed004cb3f0d52731626946679"}]},{"pcr":4,"digests":[{"hashAlg":"sha1","digest":"d9be6524a5f5047db5866813acf3277892a7a30a"},{"hashAlg":"sha256","digest":"ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e"},{"hashAlg":"sha384","digest":"4a06b879c7eedbe01c945d46b5bd785b59203dce81ea6a1206c28091ca285365f760d9167778f0dc1763d4854aafd40a"},{"hashAlg":"sha512","digest":"ea71bb243b0b2db729b9eb88e3c55a3f490fbff23457825051224a1fe6e6d3f480590cfa3a4a6b12c622d6ac366feb03cd17004ed004cb3f0d52731626946679"}]},{"pcr":5,"digests":[{"hashAlg":"sha1","digest":"d9be6524a5f5047db5866813acf3277892a7a30a"},{"hashAlg":"sha256","digest":"ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e"},{"hashAlg":"sha384","digest":"4a06b879c7eedbe01c945d46b5bd785b59203dce81ea6a1206c28091ca285365f760d9167778f0dc1763d4854aafd40a"},{"hashAlg":"sha512","digest":"ea71bb243b0b2db729b9eb88e3c55a3f490fbff23457825051224a1fe6e6d3f480590cfa3a4a6b12c622d6ac366feb03cd17004ed004cb3f0d52731626946679"}]},{"pcr":6,"digests":[{"hashAlg":"sha1","digest":"d9be6524a5f5047db5866813acf3277892a7a30a"},{"hashAlg":"sha256","digest":"ad95131bc0b799c0b1af477fb14fcf26a6a9f76079e48bf090acb7e8367bfd0e"},{"hashAlg":"sha384","digest":"4a06b879c7eedbe01c945d46b5bd785b59203dce81ea6a1206c28091ca285365f760d9167778f0dc1763d4854aafd40a"},{"hashAlg":"sha512","digest":"ea71bb243b0b2db729b9eb88e3c55a3f490fbff23457825051224a1fe6e6d3f480590cfa3a4a6b12c622d6ac366feb03cd17004ed004cb3f0d52731626946679"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/700-action-efi-exit-boot-services.pcrlock.d/300-present.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/700-action-efi-exit-boot-services.pcrlock.d/300-present.pcrlock new file mode 100644 index 0000000000..d7012df2e7 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/700-action-efi-exit-boot-services.pcrlock.d/300-present.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":5,"digests":[{"hashAlg":"sha1","digest":"443a6b7b82b7af564f2e393cd9d5a388b7fa4a98"},{"hashAlg":"sha256","digest":"d8043d6b7b85ad358eb3b6ae6a873ab7ef23a26352c5dc4faa5aeedacf5eb41b"},{"hashAlg":"sha384","digest":"214b0bef1379756011344877743fdc2a5382bac6e70362d624ccf3f654407c1b4badf7d8f9295dd3dabdef65b27677e0"},{"hashAlg":"sha512","digest":"0fed3a4c9552021436534d27f3adb481e22b50b29e4b37a63f518540a651a174f149b69f500b0bdb2cb3bf4e0e21e0781451090af33e88f6bee4cbebd15c1668"}]},{"pcr":5,"digests":[{"hashAlg":"sha1","digest":"475545ddc978d7bfd036facc7e2e987f48189f0d"},{"hashAlg":"sha256","digest":"b54f7542cbd872a81a9d9dea839b2b8d747c7ebd5ea6615c40f42f44a6dbeba0"},{"hashAlg":"sha384","digest":"0a2e01c85deae718a530ad8c6d20a84009babe6c8989269e950d8cf440c6e997695e64d455c4174a652cd080f6230b74"},{"hashAlg":"sha512","digest":"1bb30cdbd6da78fe2a8a161ef51176e22d64dce305b40b47243673af64a2b16fca6182116433e3891be94773f6d7d411275721d5bf7d40ea51a274d5c891637c"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/700-action-efi-exit-boot-services.pcrlock.d/600-absent.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/700-action-efi-exit-boot-services.pcrlock.d/600-absent.pcrlock new file mode 100644 index 0000000000..a16142b6e9 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/700-action-efi-exit-boot-services.pcrlock.d/600-absent.pcrlock @@ -0,0 +1 @@ +{"records":[]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/750-enter-initrd.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/750-enter-initrd.pcrlock new file mode 100644 index 0000000000..a2332dc324 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/750-enter-initrd.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":11,"digests":[{"hashAlg":"sha1","digest":"b1b01d5f73f321eb70e76f8a0e241ac0a3fa4a6e"},{"hashAlg":"sha256","digest":"51e6b92f405d1f98d96e3de343d61d420ad6923b25de21d766f9298192f14fed"},{"hashAlg":"sha384","digest":"687eef3a3a8c716439b5ed583657e8668401630c321f2f35d19b953ddf20b68a96474d0c2e5f0e1757bfa5ba70b9fc32"},{"hashAlg":"sha512","digest":"ab0ddfdabe43f1d06b3e58fbe17439a0f7f552e9e228d85665d485ececf7e733bae4cd7e0a17e5456e2ee7e412f5a0f37de05a782cce781e173ee26958de7f30"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/800-leave-initrd.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/800-leave-initrd.pcrlock new file mode 100644 index 0000000000..bd8f436a7e --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/800-leave-initrd.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":11,"digests":[{"hashAlg":"sha1","digest":"865e1ff2cc5b8db815313b23fe3d8b561212f5d1"},{"hashAlg":"sha256","digest":"3be261aff7db92bf507eae947f4003ffa2bcad0bffe3524601d62d0bc8be7135"},{"hashAlg":"sha384","digest":"9c0743b7a2e1ee06c70b7137b763cd2205c26ced274149959b05bd5a51bfa96b4fedaa4f87398b5c88986d1ff0879910"},{"hashAlg":"sha512","digest":"01b8ca86b9f8fac967f383380aff7cdffd2ef0c496574517c25398f7c74aa611821dd469ba021b2aa9b9a7232865708ca45c79368f2e7fffda3dd6b308264008"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/850-sysinit.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/850-sysinit.pcrlock new file mode 100644 index 0000000000..3bae4452f6 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/850-sysinit.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":11,"digests":[{"hashAlg":"sha1","digest":"aeabcf402223916e804cce79778a55d5a9276983"},{"hashAlg":"sha256","digest":"730bb5a583ba880c277e656d2dc8aba1a314a11b14d25b05153d2bab82567a48"},{"hashAlg":"sha384","digest":"955cc8939f81d862b3119aabe612fd36bf91668bb62397f5e4126085d79ba6d7cbfa4e3a2345747f0b476ce4b1cbc2c9"},{"hashAlg":"sha512","digest":"a9eb62cdd1cd8292b6325a8ee3770d6f1b613426a749e17ffba8f90bdd6c41806468fb79d01276de7cc791877dfebae165d4ed07585154acf96652c6db92acc1"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/900-ready.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/900-ready.pcrlock new file mode 100644 index 0000000000..9a0e82f6e5 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/900-ready.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":11,"digests":[{"hashAlg":"sha1","digest":"75c0533730caf1f78561c0883fb87bc8d98ef04b"},{"hashAlg":"sha256","digest":"b24d6d33736ecd5604a4b17bc9c6481039fac362bb7df044ef1c10a2bfd21db6"},{"hashAlg":"sha384","digest":"23ed5781da39fe6dc17f79478aeeb9eb2bca1d776061da188e10f9c85f7933fb39cfdba50f39af8aed24e5b45b80d006"},{"hashAlg":"sha512","digest":"ca6616f94a209e53f6fdc526b473172eb4b2157cf4809c31e36ad52db614ed352e68407be53c238ba17a561c4fde43f4a859aa8711f9781a0c934296d4d7571b"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/950-shutdown.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/950-shutdown.pcrlock new file mode 100644 index 0000000000..1bc3f76e0a --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/950-shutdown.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":11,"digests":[{"hashAlg":"sha1","digest":"53669f193b2174641c72654b5c3e5b67950334ae"},{"hashAlg":"sha256","digest":"08434ba9cdf55a02284e2913400586cd289878e0f055f7bb0b07ce392caeb989"},{"hashAlg":"sha384","digest":"186e2d6603b9755221b7ef894dd52b1154b48ef4786aec06ab6f7709e639715e89bd59fa80736bb45f0ca88583c212c1"},{"hashAlg":"sha512","digest":"9e5549deb36fc48768cb80e03bc91c36cf549ff5921e05bab5b68faefda7fac8c8a0755db783cbf1c1b98c80dc22ef06ff3f4a0a16704749f5cd4acf40e42a94"}]}]} diff --git a/tests/tailor-images/trident-mos/files/static-pcrlock-files/990-final.pcrlock b/tests/tailor-images/trident-mos/files/static-pcrlock-files/990-final.pcrlock new file mode 100644 index 0000000000..77081ae754 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/static-pcrlock-files/990-final.pcrlock @@ -0,0 +1 @@ +{"records":[{"pcr":11,"digests":[{"hashAlg":"sha1","digest":"d594c2cc0a53025004791399d80e20852af4c988"},{"hashAlg":"sha256","digest":"2443630b4620165c8b173e7265e17526fe2787ae594364dd6d839ad58f2fc007"},{"hashAlg":"sha384","digest":"90697eec39ed47f2b7ed278aa6fe6a1c073fcc7f3af54299fb95ac8a18c771acbac71e25b5a5639554943bfdfab76737"},{"hashAlg":"sha512","digest":"b3d9598ca0aa5da28be1c97a45d53cc5c72a80e61c439c8bf3e89c5c0661f49df8fa34019a21cd5e31261ae3a3a87ef4592d8010aad6a5ecdc9dbaae38cd1470"}]}]} diff --git a/tests/tailor-images/trident-mos/files/trident-install.service b/tests/tailor-images/trident-mos/files/trident-install.service new file mode 100644 index 0000000000..9b2b3c16d3 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/trident-install.service @@ -0,0 +1,11 @@ +[Unit] +Description=Trident Provisioning Service +After=network.target network-online.target systemd-udev-settle.service trident-network.service +ConditionPathExists=/etc/trident/config.yaml + +[Service] +ExecStart=trident install +Type=oneshot + +[Install] +WantedBy=multi-user.target diff --git a/tests/tailor-images/trident-mos/files/trident.fc b/tests/tailor-images/trident-mos/files/trident.fc new file mode 100644 index 0000000000..1fe2cea996 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/trident.fc @@ -0,0 +1,3 @@ +/usr/bin/trident -- gen_context(system_u:object_r:trident_exec_t,s0) + +/var/lib/trident(/.*)? gen_context(system_u:object_r:trident_var_lib_t,s0) \ No newline at end of file diff --git a/tests/tailor-images/trident-mos/files/trident.if b/tests/tailor-images/trident-mos/files/trident.if new file mode 100644 index 0000000000..0d5a5cf707 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/trident.if @@ -0,0 +1,163 @@ + +## policy for trident + +######################################## +## +## Execute trident_exec_t in the trident domain. +## +## +## +## Domain allowed to transition. +## +## +# +interface(`trident_domtrans',` + gen_require(` + type trident_t, trident_exec_t; + ') + + corecmd_search_bin($1) + domtrans_pattern($1, trident_exec_t, trident_t) +') + +###################################### +## +## Execute trident in the caller domain. +## +## +## +## Domain allowed access. +## +## +# +interface(`trident_exec',` + gen_require(` + type trident_exec_t; + ') + + corecmd_search_bin($1) + can_exec($1, trident_exec_t) +') + +######################################## +## +## Search trident lib directories. +## +## +## +## Domain allowed access. +## +## +# +interface(`trident_search_lib',` + gen_require(` + type trident_var_lib_t; + ') + + allow $1 trident_var_lib_t:dir search_dir_perms; + files_search_var_lib($1) +') + +######################################## +## +## Read trident lib files. +## +## +## +## Domain allowed access. +## +## +# +interface(`trident_read_lib_files',` + gen_require(` + type trident_var_lib_t; + ') + + files_search_var_lib($1) + read_files_pattern($1, trident_var_lib_t, trident_var_lib_t) +') + +######################################## +## +## Manage trident lib files. +## +## +## +## Domain allowed access. +## +## +# +interface(`trident_manage_lib_files',` + gen_require(` + type trident_var_lib_t; + ') + + files_search_var_lib($1) + manage_files_pattern($1, trident_var_lib_t, trident_var_lib_t) +') + +######################################## +## +## Manage trident lib directories. +## +## +## +## Domain allowed access. +## +## +# +interface(`trident_manage_lib_dirs',` + gen_require(` + type trident_var_lib_t; + ') + + files_search_var_lib($1) + manage_dirs_pattern($1, trident_var_lib_t, trident_var_lib_t) +') + + +######################################## +## +## All of the rules required to administrate +## an trident environment +## +## +## +## Domain allowed access. +## +## +## +## +## Role allowed access. +## +## +## +# +interface(`trident_admin',` + gen_require(` + type trident_t; + type trident_var_lib_t; + ') + + allow $1 trident_t:process { signal_perms }; + ps_process_pattern($1, trident_t) + + optional_policy(` + tunable_policy(`allow_ptrace',` + allow $1 trident_t:process ptrace; + ') + ') + + optional_policy(` + tunable_policy(`deny_ptrace',` + allow $1 trident_t:process ptrace; + ') + ') + + files_search_var_lib($1) + admin_pattern($1, trident_var_lib_t) + optional_policy(` + systemd_passwd_agent_exec($1) + systemd_read_fifo_file_passwd_run($1) + ') +') diff --git a/tests/tailor-images/trident-mos/files/trident.te b/tests/tailor-images/trident-mos/files/trident.te new file mode 100644 index 0000000000..740c1e263f --- /dev/null +++ b/tests/tailor-images/trident-mos/files/trident.te @@ -0,0 +1,1339 @@ +policy_module(trident, 1.0.0) + +######################################## +# +# Platform compatibility (AZL3 refpolicy vs AZL4 Fedora policy) +# +# AZL3 uses refpolicy 2.20240226: types named *_runtime_t, interfaces named *_runtime_* +# AZL4 uses Fedora selinux-policy 43.4: types named *_var_run_t, interfaces named *_pid_* +# +# We use a sentinel interface (raid_manage_mdadm_runtime_files) that exists only in +# refpolicy to detect the platform at m4 preprocessing time, then define type-name +# macros accordingly. Interface calls use per-call ifdef. +# +ifdef(`raid_manage_mdadm_runtime_files',` + define(`INIT_RUNTIME_T',`init_runtime_t') + define(`LVM_RUNTIME_T',`lvm_runtime_t') + define(`SYSLOGD_RUNTIME_T',`syslogd_runtime_t') + define(`SYSTEMD_NETWORKD_RUNTIME_T',`systemd_networkd_runtime_t') + define(`MDADM_RUNTIME_T',`mdadm_runtime_t') + define(`MOUNT_RUNTIME_T',`mount_runtime_t') + define(`UDEV_RUNTIME_T',`udev_runtime_t') +',` + define(`INIT_RUNTIME_T',`init_var_run_t') + define(`LVM_RUNTIME_T',`lvm_var_run_t') + define(`SYSLOGD_RUNTIME_T',`syslogd_var_run_t') + define(`SYSTEMD_NETWORKD_RUNTIME_T',`systemd_networkd_var_run_t') + define(`MDADM_RUNTIME_T',`mdadm_var_run_t') + define(`MOUNT_RUNTIME_T',`mount_var_run_t') + define(`UDEV_RUNTIME_T',`udev_var_run_t') +') + +######################################## +# +# Declarations +# + +type trident_t; +type trident_exec_t; + +# Creates a domain for long running process (daemon), which is started by an init script. Domain is trident_t and entry_point is tridnet_exec_t. +init_daemon_domain(trident_t, trident_exec_t) + +# Create type to label files and directories in /var/lib that are specific to Trident, in particular the Trident datastore. +type trident_var_lib_t; +files_type(trident_var_lib_t) + +#################### +# +# Trident policy +# +require { + type admin_passwd_exec_t; + type anacron_exec_t; + type audisp_remote_exec_t; + type audit_spool_t; + type auditctl_exec_t; + type auditd_exec_t; + type auditd_unit_t; + type boot_t; + type bpf_t; + type bootloader_t; + type chfn_exec_t; + type chkpwd_exec_t; + + type container_conf_home_t; + type container_unit_t; + type container_var_lib_t; + type crack_db_t; + type crack_exec_t; + type cron_spool_t; + type crond_unit_t; + type dbusd_unit_t; + type debugfs_t; + type default_t; + type device_t; + type devpts_t; + type dhcpc_exec_t; + type dhcpc_state_t; + type dmesg_exec_t; + type dosfs_t; + type efivarfs_t; + type etc_runtime_t; + type fs_t; + type fsadm_exec_t; + type fsadm_t; + type fuse_device_t; + type fusefs_t; + type getty_exec_t; + type groupadd_exec_t; + type home_root_t; + type http_cache_port_t; + type http_port_t; + type init_t; + type init_exec_t; + type INIT_RUNTIME_T; + type init_var_lib_t; + type initctl_t; + type iptables_unit_t; + type kernel_t; + type kmod_exec_t; + type ld_so_t; + type ldconfig_cache_t; + type lib_t; + type load_policy_t; + type locale_t; + type lost_found_t; + type lvm_metadata_t; + type LVM_RUNTIME_T; + type lvm_t; + type lvm_unit_t; + type mail_spool_t; + type memory_pressure_t; + type mnt_t; + type modules_conf_t; + type modules_dep_t; + type modules_object_t; + type mount_t; + type mount_exec_t; + type mptctl_device_t; + type net_conf_t; + type power_unit_t; + type proc_t; + type proc_kcore_t; + type proc_mdstat_t; + type proc_net_t; + type root_t; + type security_t; + type setfiles_t; + type semanage_t; + type semanage_exec_t; + type shadow_lock_t; + type shadow_t; + type shell_exec_t; + type ssh_agent_exec_t; + type ssh_exec_t; + type ssh_home_t; + type ssh_port_t; + type sshd_t; + type sshd_key_t; + type sshd_keygen_unit_t; + type sshd_unit_t; + type sulogin_exec_t; + type sysctl_fs_t; + type sysctl_kernel_t; + type sysctl_vm_overcommit_t; + type sysctl_vm_t; + type sysfs_t; + type syslog_conf_t; + type syslogd_exec_t; + type SYSLOGD_RUNTIME_T; + type syslogd_unit_t; + type systemd_analyze_exec_t; + type systemd_backlight_exec_t; + type systemd_backlight_unit_t; + type systemd_binfmt_exec_t; + type systemd_binfmt_unit_t; + type systemd_cgroups_exec_t; + type systemd_cgtop_exec_t; + type systemd_coredump_exec_t; + type systemd_coredump_var_lib_t; + type systemd_factory_conf_t; + type systemd_generator_t; + type systemd_generator_exec_t; + type systemd_homed_exec_t; + type systemd_homework_exec_t; + type systemd_hostnamed_exec_t; + type systemd_hw_exec_t; + type systemd_hwdb_t; + type systemd_journalctl_exec_t; + type systemd_locale_exec_t; + type systemd_logind_exec_t; + type systemd_machine_id_setup_exec_t; + type systemd_modules_load_exec_t; + type systemd_networkd_t; + type systemd_networkd_unit_t; + type systemd_networkd_exec_t; + type SYSTEMD_NETWORKD_RUNTIME_T; + type MOUNT_RUNTIME_T; + type UDEV_RUNTIME_T; + type systemd_notify_exec_t; + type systemd_passwd_agent_exec_t; + type systemd_pcrphase_t; + type systemd_pcrphase_exec_t; + type systemd_pstore_exec_t; + type systemd_resolved_exec_t; + type systemd_rfkill_exec_t; + type systemd_rfkill_unit_t; + type systemd_sessions_exec_t; + type systemd_socket_proxyd_exec_t; + type systemd_stdio_bridge_exec_t; + type systemd_sysctl_exec_t; + type systemd_sysusers_exec_t; + type systemd_tmpfiles_exec_t; + type systemd_unit_t; + type systemd_update_done_exec_t; + type systemd_user_manager_unit_t; + type systemd_user_runtime_dir_exec_t; + type systemd_userdbd_exec_t; + type systemd_userdbd_unit_t; + type tmp_t; + type tmpfs_t; + type trident_t; + type udev_exec_t; + type udev_t; + type udevadm_t; + type unlabeled_t; + type unreserved_port_t; + type updpwd_exec_t; + type useradd_exec_t; + type user_tmp_t; + type user_devpts_t; + type usr_t; + type var_run_t; + + + # Types previously implicit via interface gen_require; declared + # explicitly for cross-distro compatibility (AZL3 + AZL4). + type auditd_log_t; + type devlog_t; + type faillog_t; + type fixed_disk_device_t; + type initrc_t; + type lastlog_t; + type pstore_t; + type selinux_config_t; + type semanage_read_lock_t; + type semanage_store_t; + type semanage_trans_lock_t; + type setfiles_exec_t; + type system_dbusd_var_lib_t; + type system_map_t; + type tpm_device_t; + type udev_rules_t; + type var_lib_t; + type var_lock_t; + type var_log_t; + type var_spool_t; + type var_t; + type wtmp_t; + + # Define object classes that SELinux can protect + class dir { add_name create getattr open read remove_name search write }; + class file { create getattr ioctl lock open read rename setattr relabelto unlink write map execute execute_no_trans }; + class chr_file getattr; + class filesystem getattr; + class lnk_file read; + class netlink_route_socket { bind create getattr getopt nlmsg_read read setopt write }; + class process { getsched noatsecure rlimitinh siginh }; + class capability sys_admin; + class security read_policy; + class service start; + class tcp_socket { connect create getattr getopt name_connect read setopt shutdown write }; + class udp_socket { create ioctl }; + + attribute can_change_object_identity; + + role unconfined_r; + role system_r; +} + +# Allow Trident to change (relabel) the security context of a file or directory +typeattribute trident_t can_change_object_identity; + +# Defines transition from trident_t to fsadm_t domain when Trident executes fsadm tool (i.e. mkfs) +type_transition trident_t fsadm_exec_t:process fsadm_t; + +# Defines transition from ci_unconfined_t to trident_t when Steamboat executes Trident, as well as +# specific permissions necessary for Steamboat testing +optional_policy(` + require { + type ci_unconfined_t; + role ci_unconfined_r; + } + type_transition ci_unconfined_t trident_exec_t:process trident_t; + allow ci_unconfined_t trident_exec_t:file { getattr open read execute }; + allow trident_t trident_exec_t:file entrypoint; + role ci_unconfined_r types trident_t; + + allow trident_t ci_unconfined_t:fd use; + seutil_run_setfiles(trident_t, ci_unconfined_r); +') + +# Allow transition between unconfined_t and trident_t domains; necessary for an interactive run +optional_policy(` + unconfined_run_to(trident_t, trident_exec_t) +') + +#============= trident_t ============== +# Gives trident_t the following elevated privileges: +# dac_override and dac_read_search - allow access files and directories without necessary DAC permissions +# sys_ptrace - allow trident_t to trace or debug other processes +# sys_rawio - allow trident_t to perform I/O operations directly on hardware devices +allow trident_t self:capability { dac_override dac_read_search sys_ptrace sys_rawio }; + +allow trident_t self:alg_socket { accept bind create read write }; +allow trident_t self:capability { audit_write chown mknod net_admin sys_chroot sys_resource sys_admin fowner fsetid sys_boot ipc_lock sys_nice linux_immutable sys_module setgid setuid }; +allow trident_t self:fifo_file manage_fifo_file_perms; +allow trident_t self:netlink_audit_socket { create nlmsg_relay read write }; +allow trident_t self:netlink_kobject_uevent_socket { bind create getattr getopt read setopt }; +allow trident_t self:netlink_route_socket { bind create getattr nlmsg_read read write }; +allow trident_t self:process { getattr getcap getsched setfscreate setpgid setsched signal signull }; +allow trident_t self:tcp_socket { connect create getattr getopt read setopt shutdown write }; +allow trident_t self:unix_dgram_socket { connect create write }; +allow trident_t self:udp_socket { connect create getattr setopt read write }; +allow trident_t self:key { search write }; +allow trident_t self:sem { associate create destroy read unix_read unix_write write }; + +# Ensure any new files, directories, or symbolic links created by trident_t are automatically labeled with type trident_var_lib_t +files_var_lib_filetrans(trident_t, trident_var_lib_t, { dir file lnk_file }) + +# Allow trident_t domain to interact with files and directories labeled as trident_var_lib_t +# Necessary so Trident can interact with the datastore at /var/lib/trident +allow trident_t trident_var_lib_t:dir { getattr search read write add_name create remove_name open mounton relabelto rmdir }; +allow trident_t trident_var_lib_t:file { getattr setattr create open read write unlink lock relabelto rename }; + +# Allow Trident to relabel its executable +allow trident_t trident_exec_t:file relabelto; + +allow trident_t audit_spool_t:dir { getattr open read relabelto }; +allow trident_t auditctl_exec_t:file getattr; +allow trident_t auditd_exec_t:file getattr; +allow trident_t auditd_log_t:dir relabelto; +allow trident_t auditd_unit_t:file getattr; +allow trident_t admin_passwd_exec_t:file getattr; +allow trident_t anacron_exec_t:file getattr; +allow trident_t audisp_remote_exec_t:file getattr; +allow trident_t boot_t:dir { mounton create relabelto }; +allow trident_t boot_t:file relabelto; +allow trident_t bpf_t:dir search; +optional_policy(` + require { + type cgroup_t; + } + allow trident_t cgroup_t:filesystem getattr; +') +allow trident_t chfn_exec_t:file getattr; +allow trident_t chkpwd_exec_t:file getattr; +optional_policy(` + require { + type chronyc_exec_t; + type chronyd_unit_t; + type chronyd_var_lib_t; + type chronyd_var_log_t; + } + allow trident_t chronyc_exec_t:file getattr; + allow trident_t chronyd_unit_t:file getattr; + allow trident_t chronyd_var_lib_t:dir { getattr open read relabelto }; + allow trident_t chronyd_var_log_t:dir { getattr open read relabelto }; +') +allow trident_t container_conf_home_t:dir search; # Allow access to ~/.docker directory +allow trident_t container_conf_home_t:file { open read }; # Allow access to ~/.docker/config.json +allow trident_t container_unit_t:file getattr; +allow trident_t container_var_lib_t:file getattr; +allow trident_t crack_db_t:dir { getattr open search read }; +allow trident_t crack_db_t:file getattr; +allow trident_t crack_db_t:lnk_file getattr; +allow trident_t crack_exec_t:file getattr; +allow trident_t cron_spool_t:dir { read relabelto }; +allow trident_t crond_unit_t:file { getattr read open ioctl }; +allow trident_t dbusd_unit_t:file getattr; +allow trident_t debugfs_t:filesystem getattr; +allow trident_t debugfs_t:dir search; +allow trident_t default_t:dir { getattr open read relabelto search }; +allow trident_t default_t:file relabelto; +allow trident_t device_t:filesystem { getattr mount unmount }; +allow trident_t devpts_t:chr_file { read write ioctl getattr }; +allow trident_t devlog_t:sock_file { getattr write }; +allow trident_t dhcpc_exec_t:file getattr; +allow trident_t dhcpc_state_t:dir { getattr open read relabelto }; +allow trident_t dmesg_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t dosfs_t:filesystem { getattr mount unmount }; +allow trident_t efivarfs_t:filesystem getattr; +allow trident_t efivarfs_t:dir search; +allow trident_t etc_runtime_t:file { getattr open read relabelto relabelfrom rename setattr unlink }; +allow trident_t etc_t:file { create execute execute_no_trans link relabelfrom relabelto rename setattr unlink write append }; +allow trident_t etc_t:dir { mounton relabelfrom }; +allow trident_t faillog_t:file relabelto; +allow trident_t fs_t:filesystem { mount unmount }; +allow trident_t fsadm_t:process { siginh rlimitinh noatsecure transition }; +allow trident_t fsadm_t:fd use; +allow trident_t fsadm_t:fifo_file { read write }; +allow trident_t fsadm_exec_t:file { getattr open read execute execute_no_trans relabelto setattr unlink write }; +allow trident_t fuse_device_t:chr_file { read write open }; +allow trident_t fusefs_t:dir getattr; +allow trident_t fusefs_t:filesystem { mount unmount getattr }; +allow trident_t getty_exec_t:file getattr; +optional_policy(` + require { + type gpg_pinentry_exec_t; + type gpg_secret_t; + } + allow trident_t gpg_pinentry_exec_t:file getattr; + allow trident_t gpg_secret_t:file getattr; +') +allow trident_t groupadd_exec_t:file getattr; +allow trident_t home_root_t:dir { mounton read relabelto add_name create relabelfrom setattr write }; +allow trident_t home_root_t:file { create getattr ioctl open relabelfrom setattr read write }; +allow trident_t http_cache_port_t:tcp_socket name_connect; # Allow Trident to initiate connection to HTTP proxy port +allow trident_t http_port_t:tcp_socket name_connect; +allow trident_t init_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t init_t:system { reboot reload start status }; +allow trident_t init_t:key search; +allow trident_t init_t:unix_stream_socket connectto; +allow trident_t initctl_t:fifo_file getattr; +allow trident_t INIT_RUNTIME_T:dir { add_name remove_name write }; +allow trident_t INIT_RUNTIME_T:file { create getattr open setattr read rename unlink write }; +allow trident_t INIT_RUNTIME_T:lnk_file { create unlink }; +allow trident_t INIT_RUNTIME_T:service { start status }; +allow trident_t init_var_lib_t:dir { add_name getattr open read relabelto remove_name search write }; +allow trident_t init_var_lib_t:file { create getattr open read rename setattr unlink write }; +allow trident_t iptables_unit_t:file getattr; +# Required for veritysetup to search for keys in the kernel's keyring when launched by trident. +allow trident_t kernel_t:key search; +allow trident_t kernel_t:process setsched; +allow trident_t kernel_t:system { module_request ipc_info }; +allow trident_t kernel_t:unix_dgram_socket sendto; +allow trident_t kmod_exec_t:file { execute execute_no_trans getattr map open read relabelto setattr unlink write }; +optional_policy(` + require { + type krb5kdc_exec_t; + } + allow trident_t krb5kdc_exec_t:file getattr; +') +allow trident_t lastlog_t:file relabelto; +allow trident_t ld_so_t:file { execute_no_trans relabelto setattr unlink write }; +allow trident_t ldconfig_cache_t:dir { getattr open read search relabelto }; +allow trident_t ldconfig_cache_t:file { getattr relabelto }; +allow trident_t lib_t:file { create relabelto rename setattr unlink write }; +allow trident_t locale_t:dir { add_name relabelto remove_name rmdir setattr write }; +allow trident_t locale_t:file { link relabelto rename setattr unlink write }; +optional_policy(` + require { + type locate_exec_t; + } + allow trident_t locate_exec_t:file getattr; +') +optional_policy(` + require { + type logrotate_unit_t; + type logrotate_var_lib_t; + } + allow trident_t logrotate_unit_t:file getattr; + allow trident_t logrotate_var_lib_t:dir { getattr open read relabelto }; +') +allow trident_t lost_found_t:dir { getattr open read relabelto }; +allow trident_t lvm_metadata_t:dir { getattr open read }; +allow trident_t LVM_RUNTIME_T:dir { add_name open read remove_name search write }; +allow trident_t lvm_unit_t:file getattr; +allow trident_t mail_spool_t:dir { list_dir_perms relabelto }; +allow trident_t memory_pressure_t:file { read open getattr setattr }; +allow trident_t mnt_t:dir { add_name create getattr mounton open read search write }; +allow trident_t mnt_t:lnk_file read; +allow trident_t modules_conf_t:file { create execute relabelto rename setattr unlink write }; +allow trident_t modules_conf_t:dir { write add_name remove_name }; +allow trident_t modules_dep_t:file { getattr ioctl map open read relabelto setattr unlink }; +allow trident_t modules_object_t:file { getattr map open read relabelto setattr unlink }; +allow trident_t mount_exec_t:file { execute execute_no_trans getattr map open read relabelto setattr unlink write }; +allow trident_t mptctl_device_t:chr_file getattr; +allow trident_t net_conf_t:file { relabelto setattr unlink }; +optional_policy(` + require { + type ntpd_exec_t; + type ntpd_unit_t; + } + allow trident_t ntpd_exec_t:file { execute getattr }; + allow trident_t ntpd_unit_t:file getattr; +') +optional_policy(` + require { + type oddjob_mkhomedir_exec_t; + } + allow trident_t oddjob_mkhomedir_exec_t:file getattr; +') +allow trident_t power_unit_t:file { getattr open read relabelto setattr unlink }; +allow trident_t proc_t:dir read; +allow trident_t proc_t:file { getattr open read ioctl }; +allow trident_t proc_t:filesystem { getattr mount unmount }; +allow trident_t proc_kcore_t:file getattr; +allow trident_t proc_mdstat_t:file { getattr open read }; +allow trident_t proc_net_t:file { open read }; +allow trident_t root_t:dir { add_name create mounton write }; +allow trident_t root_t:file { create getattr map open read relabelfrom write }; +optional_policy(` + require { + type rpm_unit_t; + type rpm_var_cache_t; + type rpm_var_lib_t; + } + allow trident_t rpm_unit_t:file getattr; + allow trident_t rpm_var_cache_t:dir relabelto; + allow trident_t rpm_var_cache_t:file relabelto; + allow trident_t rpm_var_lib_t:dir { add_name relabelto }; + allow trident_t rpm_var_lib_t:file { create relabelto setattr write }; +') +allow trident_t security_t:file { map write }; +allow trident_t security_t:filesystem getattr; +allow trident_t security_t:security read_policy; +allow trident_t selinux_config_t:dir relabelfrom; +allow trident_t selinux_config_t:file relabelfrom; +allow trident_t semanage_exec_t:file { execute execute_no_trans entrypoint getattr ioctl open read map }; +allow trident_t semanage_read_lock_t:file relabelto; +allow trident_t semanage_store_t:dir relabelto; +allow trident_t semanage_store_t:file relabelto; +allow trident_t semanage_trans_lock_t:file relabelto; +allow trident_t setfiles_exec_t:file entrypoint; +allow trident_t shadow_t:file { getattr open read relabelto setattr link unlink write append relabelfrom }; +allow trident_t shadow_lock_t:file { create getattr lock open read link unlink write setattr relabelfrom }; +allow trident_t shell_exec_t:file { execute execute_no_trans getattr map open read relabelto setattr unlink write }; +allow trident_t ssh_agent_exec_t:file getattr; +allow trident_t ssh_exec_t:file { execute getattr }; +allow trident_t ssh_home_t:dir { setattr relabelto }; +allow trident_t ssh_home_t:file relabelto; +allow trident_t ssh_port_t:tcp_socket name_connect; +allow trident_t sshd_t:fd use; +allow trident_t sshd_t:fifo_file { read write getattr ioctl }; # Allow Trident to read/write stdin/stdout/stderr +allow trident_t sshd_key_t:file { getattr manage_file_perms }; # Allow Trident to copy SSH keys +allow trident_t sshd_keygen_unit_t:file getattr; +allow trident_t sshd_unit_t:file getattr; +allow trident_t sulogin_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t sysctl_fs_t:dir search; +allow trident_t sysctl_fs_t:file { getattr ioctl open read }; +allow trident_t sysctl_kernel_t:dir search; +allow trident_t sysctl_kernel_t:file { getattr ioctl open read }; +allow trident_t sysctl_vm_overcommit_t:file { open read }; +allow trident_t sysctl_vm_t:dir search; +allow trident_t sysfs_t:filesystem { mount unmount }; +allow trident_t syslog_conf_t:file { getattr open read relabelto setattr unlink }; +allow trident_t syslogd_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t SYSLOGD_RUNTIME_T:dir search; +allow trident_t syslogd_unit_t:file { getattr open read relabelto setattr unlink }; +# AZL4: system_cron_spool_t does not exist +optional_policy(` + require { + type system_cron_spool_t; + } + allow trident_t system_cron_spool_t:dir relabelto; +') +allow trident_t system_dbusd_var_lib_t:dir relabelto; +allow trident_t system_dbusd_var_lib_t:lnk_file relabelto; +allow trident_t system_map_t:file relabelto; +allow trident_t systemd_analyze_exec_t:file getattr; +allow trident_t systemd_backlight_exec_t:file getattr; +allow trident_t systemd_backlight_unit_t:file getattr; +allow trident_t systemd_binfmt_exec_t:file getattr; +allow trident_t systemd_binfmt_unit_t:file getattr; +allow trident_t systemd_cgroups_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t systemd_cgtop_exec_t:file getattr; +allow trident_t systemd_coredump_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t systemd_coredump_var_lib_t:dir { getattr open read relabelto }; +allow trident_t systemd_factory_conf_t:dir { getattr open read search }; +allow trident_t systemd_factory_conf_t:file getattr; +allow trident_t systemd_generator_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t systemd_homed_exec_t:file getattr; +allow trident_t systemd_homework_exec_t:file getattr; +allow trident_t systemd_hostnamed_exec_t:file { execute getattr }; +allow trident_t systemd_hw_exec_t:file getattr; +allow trident_t systemd_hwdb_t:file { getattr open read relabelto setattr unlink }; +# AZL4: systemd_journal_t does not exist (journal handled differently) +optional_policy(` + require { + type systemd_journal_t; + } + allow trident_t systemd_journal_t:file { relabelfrom_file_perms map open read relabelto }; + allow trident_t systemd_journal_t:dir relabelto; +') +allow trident_t systemd_journalctl_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t systemd_locale_exec_t:file getattr; +allow trident_t systemd_logind_exec_t:file getattr; +allow trident_t systemd_machine_id_setup_exec_t:file getattr; +allow trident_t systemd_modules_load_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t systemd_networkd_unit_t:service { start status }; +allow trident_t systemd_networkd_exec_t:file { execute getattr }; +allow trident_t SYSTEMD_NETWORKD_RUNTIME_T:dir { add_name getattr open read remove_name search write }; +allow trident_t SYSTEMD_NETWORKD_RUNTIME_T:file { create getattr open read rename setattr unlink write }; +allow trident_t systemd_notify_exec_t:file getattr; +allow trident_t systemd_passwd_agent_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t systemd_pcrphase_exec_t:file { execute execute_no_trans getattr map open read }; +allow trident_t pstore_t:dir search; +allow trident_t systemd_pstore_exec_t:file { execute getattr }; +allow trident_t systemd_resolved_exec_t:file { execute getattr }; +allow trident_t systemd_rfkill_exec_t:file getattr; +allow trident_t systemd_rfkill_unit_t:file getattr; +allow trident_t systemd_sessions_exec_t:file getattr; +allow trident_t systemd_socket_proxyd_exec_t:file getattr; +allow trident_t systemd_stdio_bridge_exec_t:file getattr; +allow trident_t systemd_sysctl_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t systemd_sysusers_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t systemd_tmpfiles_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +allow trident_t systemd_unit_t:dir { read add_name create write reparent rename setattr relabelfrom }; +allow trident_t systemd_unit_t:file { getattr ioctl link open read relabelto relabelfrom rename setattr unlink write create }; +allow trident_t systemd_unit_t:lnk_file { getattr read create relabelfrom }; +allow trident_t systemd_unit_t:service { start status }; +allow trident_t systemd_update_done_exec_t:file getattr; +allow trident_t systemd_user_manager_unit_t:file getattr; +allow trident_t systemd_user_runtime_dir_exec_t:file getattr; +allow trident_t systemd_userdbd_exec_t:file getattr; +allow trident_t systemd_userdbd_unit_t:file getattr; +allow trident_t tmp_t:chr_file { create getattr unlink }; +allow trident_t tmp_t:dir { add_name create getattr mounton open read relabelfrom remove_name rmdir search setattr write relabelto }; +allow trident_t tmp_t:file { append create getattr ioctl open read relabelfrom rename setattr unlink write map execute link }; +allow trident_t tmp_t:lnk_file { create getattr read rename unlink }; +allow trident_t tmpfs_t:file { append create execute getattr ioctl link lock map mounton open read relabelto rename setattr unlink write }; +allow trident_t tmpfs_t:filesystem { getattr mount unmount }; +allow trident_t udev_exec_t:file { execute execute_no_trans getattr map open read relabelto setattr unlink write }; +allow trident_t UDEV_RUNTIME_T:dir { add_name create read remove_name watch write }; +allow trident_t UDEV_RUNTIME_T:file { create rename setattr unlink write }; +allow trident_t UDEV_RUNTIME_T:sock_file write; +allow trident_t unlabeled_t:chr_file { create getattr link rename unlink }; +allow trident_t unlabeled_t:dir { create add_name getattr setattr open read remove_name search write mounton relabelfrom ioctl rename reparent rmdir }; +allow trident_t unlabeled_t:file { create getattr lock open read setattr unlink write ioctl relabelfrom append execute execute_no_trans link map relabelto rename }; +allow trident_t unlabeled_t:lnk_file { create getattr read relabelfrom rename unlink }; +allow trident_t unreserved_port_t:tcp_socket name_connect; +allow trident_t updpwd_exec_t:file getattr; +allow trident_t useradd_exec_t:file { execute execute_no_trans getattr map open read }; +allow trident_t user_tmp_t:file { getattr open read }; +allow trident_t user_devpts_t:chr_file { ioctl read write }; +allow trident_t usr_t:dir { add_name create read relabelto remove_name rmdir setattr write relabelto mounton }; +allow trident_t usr_t:file { create execute execute_no_trans getattr ioctl link open read relabelto rename setattr unlink write }; +optional_policy(` + require { + type uuidd_exec_t; + type uuidd_var_lib_t; + } + allow trident_t uuidd_exec_t:file getattr; + allow trident_t uuidd_var_lib_t:dir relabelto; +') +allow trident_t var_t:dir { mounton relabelto }; +allow trident_t var_lib_t:dir relabelto; +allow trident_t var_lib_t:file relabelto; +allow trident_t var_lib_t:lnk_file relabelto; +allow trident_t var_lock_t:lnk_file relabelto; +allow trident_t var_log_t:dir relabelto; +allow trident_t var_log_t:lnk_file relabelto; +allow trident_t var_run_t:dir { add_name create remove_name write }; +allow trident_t var_run_t:file { create getattr lock open read unlink write }; +allow trident_t var_run_t:lnk_file relabelto; +allow trident_t var_run_t:sock_file write; +allow trident_t var_spool_t:dir relabelto; +allow trident_t wtmp_t:file relabelto; + +# Optional policies for modifying cloud-init settings +optional_policy(` + require { + type cloud_init_exec_t; + type cloud_init_state_t; + } + allow trident_t cloud_init_exec_t:file getattr; + allow trident_t cloud_init_state_t:dir { list_dir_perms relabelto }; + allow trident_t cloud_init_state_t:lnk_file read_lnk_file_perms; + allow trident_t cloud_init_state_t:file getattr; +') + +# Policies below must be optional for Steamboat +optional_policy(` + require { + type trident_t; + type bluetooth_unit_t; + } + allow trident_t bluetooth_unit_t:file getattr; +') +optional_policy(` + require { + type trident_t; + type colord_var_lib_t; + } + allow trident_t colord_var_lib_t:dir { getattr open read relabelto }; +') +optional_policy(` + require { + type trident_t; + type dhcpd_unit_t; + } + allow trident_t dhcpd_unit_t:file getattr; +') +optional_policy(` + require { + type trident_t; + type loadkeys_exec_t; + } + allow trident_t loadkeys_exec_t:file { execute getattr map open read relabelto setattr unlink write }; +') +optional_policy(` + require { + type trident_t; + type mdadm_exec_t; + type mdadm_unit_t; + type MDADM_RUNTIME_T; + } + allow trident_t mdadm_exec_t:file { open read getattr map relabelto setattr unlink write execute execute_no_trans }; + allow trident_t mdadm_unit_t:file { getattr open read relabelto setattr unlink }; + allow trident_t MDADM_RUNTIME_T:dir { add_name remove_name search write }; + ifdef(`raid_manage_mdadm_runtime_files',` + raid_manage_mdadm_runtime_files(trident_t) + ',` + raid_manage_mdadm_pid(trident_t) + ') +') + +#============= interfaces ============== +########################################### +# Authentication and User Management +########################################### +# AZL3: auth_create_faillog_files / AZL4: auth_manage_faillog +ifdef(`auth_create_faillog_files',` + auth_create_faillog_files(trident_t) +',` + auth_manage_faillog(trident_t) +') +auth_exec_pam(trident_t) +auth_login_entry_type(trident_t) +auth_read_lastlog(trident_t) +auth_read_login_records(trident_t) +optional_policy(` + require { + type gpg_exec_t; + type gpg_agent_exec_t; + type gpg_secret_t; + } + allow trident_t gpg_exec_t:file { ioctl read getattr lock map execute execute_no_trans open }; + allow trident_t gpg_agent_exec_t:file { ioctl read getattr lock map execute execute_no_trans open }; + allow trident_t gpg_secret_t:dir list_dir_perms; + allow trident_t gpg_secret_t:file read_file_perms; + allow trident_t gpg_secret_t:lnk_file read_lnk_file_perms; +') +su_exec(trident_t) +usermanage_check_exec_passwd(trident_t) +userdom_list_user_home_dirs(trident_t) +userdom_read_user_home_content_files(trident_t) +# AZL3: userdom_search_user_runtime_root / AZL4: removed (covered by var_run_t allow rules) +ifdef(`userdom_search_user_runtime_root',` + userdom_search_user_runtime_root(trident_t) +') +# AZL3: userdom_relabel_generic_user_home_files / AZL4: userdom_relabel_user_home_files +ifdef(`userdom_relabel_generic_user_home_files',` + userdom_relabel_generic_user_home_files(trident_t) +',` + userdom_relabel_user_home_files(trident_t) +') +userdom_relabelto_user_home_dirs(trident_t) + +########################################### +# System Services and Daemons +########################################### +bootloader_exec(trident_t) +optional_policy(` + require { + type chronyd_exec_t; + type chronyd_etc_t; + type chronyd_keys_t; + } + allow trident_t chronyd_exec_t:file { ioctl read getattr lock map execute execute_no_trans open }; + allow trident_t chronyd_etc_t:dir list_dir_perms; + allow trident_t chronyd_etc_t:file read_file_perms; + allow trident_t chronyd_keys_t:file read_file_perms; +') +clock_exec(trident_t) +optional_policy(` + require { + type cgroup_t; + } + create_files_pattern(trident_t, cgroup_t, cgroup_t) +') +cron_exec(trident_t) +# AZL3: cron_exec_crontab / AZL4: removed (covered by cron_exec) +ifdef(`cron_exec_crontab',` + cron_exec_crontab(trident_t) +') +# AZL3: cron_read_system_spool / AZL4: cron_manage_system_spool (superset) +ifdef(`cron_read_system_spool',` + cron_read_system_spool(trident_t) +',` + cron_manage_system_spool(trident_t) +') +# AZL3: dbus_exec / AZL4: dbus_exec_dbusd +ifdef(`dbus_exec',` + dbus_exec(trident_t) +',` + dbus_exec_dbusd(trident_t) +') +dbus_manage_lib_files(trident_t) +dbus_read_config(trident_t) +dbus_read_lib_files(trident_t) +# AZL3: dbus_list_system_bus_runtime / AZL4: removed, use dbus_read_pid_files +ifdef(`dbus_list_system_bus_runtime',` + dbus_list_system_bus_runtime(trident_t) +',` + dbus_read_pid_files(trident_t) +') +dbus_system_bus_client(trident_t) +domain_read_all_domains_state(trident_t) +hostname_exec(trident_t) +init_domtrans(trident_t) +init_rw_stream_sockets(trident_t) +optional_policy(` + require { + type logrotate_exec_t; + } + allow trident_t logrotate_exec_t:file { ioctl read getattr lock map execute execute_no_trans open }; +') +ssh_domtrans(trident_t) +ssh_domtrans_keygen(trident_t) +ssh_manage_home_files(trident_t) +# AZL3: systemd_list_journal_dirs / AZL4: removed (no systemd_journal_t type on AZL4) +ifdef(`systemd_list_journal_dirs',` + systemd_list_journal_dirs(trident_t) +') +# AZL3: systemd_read_networkd_units / AZL4: systemd_read_unit_files (generic) +ifdef(`systemd_read_networkd_units',` + systemd_read_networkd_units(trident_t) +',` + systemd_read_unit_files(trident_t) +') +# AZL3: systemd_read_user_runtime_units_files / AZL4: removed, covered by systemd_read_unit_files above +ifdef(`systemd_read_user_runtime_units_files',` + systemd_read_user_runtime_units_files(trident_t) +') +systemd_dbus_chat_logind(trident_t) +# AZL3: systemd_read_user_unit_files / AZL4: systemd_read_unit_files (generic) +ifdef(`systemd_read_user_unit_files',` + systemd_read_user_unit_files(trident_t) +',` + systemd_read_unit_files(trident_t) +') + +# Optional read access to cloud init state +optional_policy(` + require { + type cloud_init_t; + } + ps_process_pattern(trident_t, cloud_init_t) # equivalent to cloud_init_read_state(trident_t) +') + +########################################### +# File System Operations +########################################### +files_create_boot_dirs(trident_t) +files_list_kernel_modules(trident_t) +files_list_spool(trident_t) +files_list_var(trident_t) +files_manage_boot_files(trident_t) +files_manage_etc_dirs(trident_t) +files_manage_etc_symlinks(trident_t) +# AZL3: files_mounton_runtime_dirs / AZL4: removed, inline equivalent +ifdef(`files_mounton_runtime_dirs',` + files_mounton_runtime_dirs(trident_t) +',` + allow trident_t var_run_t:dir mounton; +') +files_read_etc_files(trident_t) +files_read_default_symlinks(trident_t) +files_read_kernel_symbol_table(trident_t) +files_read_usr_src_files(trident_t) +files_read_usr_symlinks(trident_t) +files_read_var_lib_files(trident_t) +files_search_etc(trident_t) +files_search_kernel_modules(trident_t) +files_search_locks(trident_t) +files_search_spool(trident_t) +files_search_var_lib(trident_t) +files_rw_etc_runtime_files(trident_t) +fstools_domtrans(trident_t) +fstools_relabelto_entry_files(trident_t) +fs_getattr_hugetlbfs(trident_t) +fs_getattr_iso9660_files(trident_t) +fs_getattr_iso9660_fs(trident_t) +# AZL3: fs_getattr_pstorefs / AZL4: removed +ifdef(`fs_getattr_pstorefs',` + fs_getattr_pstorefs(trident_t) +') +# AZL3: fs_getattr_tracefs / AZL4: removed +ifdef(`fs_getattr_tracefs',` + fs_getattr_tracefs(trident_t) +') +fs_getattr_xattr_fs(trident_t) +# AZL3: fs_list_efivars / AZL4: removed +ifdef(`fs_list_efivars',` + fs_list_efivars(trident_t) +') +fs_list_hugetlbfs(trident_t) +fs_manage_dos_dirs(trident_t) +fs_manage_dos_files(trident_t) +fs_manage_efivarfs_files(trident_t) +fs_manage_tmpfs_dirs(trident_t) +fs_manage_tmpfs_symlinks(trident_t) +fs_mounton_tmpfs(trident_t) +fs_read_iso9660_files(trident_t) +optional_policy(` + require { + type cgroup_t; + } + allow trident_t cgroup_t:file { ioctl read write getattr setattr lock append open }; +') +# AZL3: mount_list_runtime / AZL4: removed, inline equivalent +ifdef(`mount_list_runtime',` + mount_list_runtime(trident_t) +',` + allow trident_t MOUNT_RUNTIME_T:dir list_dir_perms; +') + +########################################### +# Network Management +########################################### +iptables_exec(trident_t) +iptables_read_config(trident_t) +# AZL3: iptables_status / AZL4: iptables_systemctl +ifdef(`iptables_status',` + iptables_status(trident_t) +',` + iptables_systemctl(trident_t) +') +sysnet_exec_ifconfig(trident_t) +sysnet_read_config(trident_t) +sysnet_read_dhcp_config(trident_t) +# AZL3: sysnet_relabel_config / AZL4: split into relabelto + relabelfrom +ifdef(`sysnet_relabel_config',` + sysnet_relabel_config(trident_t) +',` + sysnet_relabelto_net_conf(trident_t) + sysnet_relabelfrom_net_conf(trident_t) +') +sysnet_write_config(trident_t) + +########################################### +# Storage Management +########################################### +dev_rw_loop_control(trident_t) +dev_rw_lvm_control(trident_t) +lvm_exec(trident_t) +lvm_domtrans(trident_t) +# AZL3: lvm_manage_runtime_files / AZL4: lvm_manage_var_run +ifdef(`lvm_manage_runtime_files',` + lvm_manage_runtime_files(trident_t) +',` + lvm_manage_var_run(trident_t) +') +lvm_read_config(trident_t) +manage_files_pattern(trident_t, MOUNT_RUNTIME_T, MOUNT_RUNTIME_T) +storage_getattr_fuse_dev(trident_t) +storage_getattr_scsi_generic_dev(trident_t) +storage_raw_read_removable_device(trident_t) +storage_raw_read_fixed_disk(trident_t) +storage_raw_write_fixed_disk(trident_t) + +########################################### +# SELinux Management +########################################### +corecmd_relabel_bin_files(trident_t) +files_relabel_etc_files(trident_t) +files_relabel_kernel_modules(trident_t) +# AZL3: files_relabelto_etc_runtime_files / AZL4: removed, inline equivalent +ifdef(`files_relabelto_etc_runtime_files',` + files_relabelto_etc_runtime_files(trident_t) +',` + allow trident_t etc_runtime_t:file relabelto; +') +files_relabelto_usr_files(trident_t) +libs_relabel_ld_so(trident_t) +libs_relabelto_lib_files(trident_t) +miscfiles_relabel_localization(trident_t) +relabel_files_pattern(trident_t, udev_rules_t, udev_rules_t) +selinux_load_policy(trident_t) +seutil_exec_checkpolicy(trident_t) +seutil_exec_loadpolicy(trident_t) +seutil_exec_setfiles(trident_t) +seutil_get_semanage_read_lock(trident_t) +seutil_get_semanage_trans_lock(trident_t) +seutil_manage_bin_policy(trident_t) +seutil_manage_config(trident_t) +seutil_manage_config_dirs(trident_t) +seutil_manage_file_contexts(trident_t) +seutil_manage_module_store(trident_t) +seutil_read_default_contexts(trident_t) +seutil_read_bin_policy(trident_t) +seutil_run_setfiles(trident_t, system_r) +seutil_run_setfiles(trident_t, unconfined_r) +# AZL3: udev_relabel_rules_files / AZL4: removed, inline equivalent +ifdef(`udev_relabel_rules_files',` + udev_relabel_rules_files(trident_t) +',` + allow trident_t udev_rules_t:file relabel_file_perms; +') + +########################################### +# Package Management +########################################### +optional_policy(` + require { + type rpm_exec_t; + type rpm_var_cache_t; + type rpm_var_lib_t; + } + allow trident_t rpm_var_lib_t:dir { manage_dir_perms relabelto }; + allow trident_t rpm_var_lib_t:file { manage_file_perms map relabelto }; + allow trident_t rpm_var_lib_t:lnk_file { read_lnk_file_perms }; + allow trident_t rpm_exec_t:file { ioctl read getattr lock map execute execute_no_trans open }; + allow trident_t rpm_var_cache_t:dir list_dir_perms; + allow trident_t rpm_var_cache_t:file read_file_perms; + allow trident_t rpm_var_cache_t:lnk_file { read_lnk_file_perms }; +') + +########################################### +# Device Management +########################################### +corenet_getattr_ppp_dev(trident_t) +# AZL3: corenet_read_tun_tap_dev / AZL4: removed +ifdef(`corenet_read_tun_tap_dev',` + corenet_read_tun_tap_dev(trident_t) +') +# AZL3: dev_getattr_acpi_bios_dev / AZL4: dev_getattr_apm_bios_dev +ifdef(`dev_getattr_acpi_bios_dev',` + dev_getattr_acpi_bios_dev(trident_t) +',` + dev_getattr_apm_bios_dev(trident_t) +') +dev_getattr_autofs_dev(trident_t) +dev_getattr_framebuffer_dev(trident_t) +dev_getattr_generic_usb_dev(trident_t) +dev_getattr_mouse_dev(trident_t) +# AZL3: dev_getattr_pmqos_dev / AZL4: removed +ifdef(`dev_getattr_pmqos_dev',` + dev_getattr_pmqos_dev(trident_t) +') +# AZL3: dev_getattr_sysfs / AZL4: dev_getattr_sysfs_fs +ifdef(`dev_getattr_sysfs',` + dev_getattr_sysfs(trident_t) +',` + dev_getattr_sysfs_fs(trident_t) +') +dev_getattr_xserver_misc_dev(trident_t) +dev_list_sysfs(trident_t) +dev_manage_generic_blk_files(trident_t) +dev_manage_generic_dirs(trident_t) +dev_mounton(trident_t) +# AZL3: dev_mounton_sysfs_dirs / AZL4: dev_mounton_sysfs +ifdef(`dev_mounton_sysfs_dirs',` + dev_mounton_sysfs_dirs(trident_t) +',` + dev_mounton_sysfs(trident_t) +') +# AZL3: dev_read_input_dev / AZL4: dev_read_input +ifdef(`dev_read_input_dev',` + dev_read_input_dev(trident_t) +',` + dev_read_input(trident_t) +') +dev_read_kmsg(trident_t) +dev_read_rand(trident_t) +dev_read_raw_memory(trident_t) +dev_read_realtime_clock(trident_t) +dev_read_sysfs(trident_t) +dev_read_watchdog(trident_t) +dev_read_urand(trident_t) +dev_relabelfrom_generic_chr_files(trident_t) +# AZL3: dev_relabelfrom_vfio_dev / AZL4: removed +ifdef(`dev_relabelfrom_vfio_dev',` + dev_relabelfrom_vfio_dev(trident_t) +') +dev_rw_nvram(trident_t) +dev_rw_tpm(trident_t) +dev_rw_vhost(trident_t) +dev_search_sysfs(trident_t) +dev_write_sysfs(trident_t) +dev_write_urand(trident_t) +term_getattr_ptmx(trident_t) +term_use_virtio_console(trident_t) +term_getattr_pty_fs(trident_t) +udev_manage_rules_files(trident_t) +# AZL3: udev_read_runtime_files / AZL4: udev_read_pid_files +ifdef(`udev_read_runtime_files',` + udev_read_runtime_files(trident_t) +',` + udev_read_pid_files(trident_t) +') +udev_read_state(trident_t) + +########################################### +# System Command Execution +########################################### +optional_policy(` + require { + type sudo_exec_t; + } + allow trident_t sudo_exec_t:file { ioctl read getattr lock map execute execute_no_trans open }; +') +corecmd_manage_bin_files(trident_t) +corecmd_bin_entry_type(trident_t) +corecmd_shell_entry_type(trident_t) +corecmd_search_bin(trident_t) +corecmd_exec_bin(trident_t) +optional_policy(` + require { + type kadmind_exec_t; + type krb5_conf_t; + } + allow trident_t kadmind_exec_t:file { ioctl read getattr lock map execute execute_no_trans open }; + allow trident_t krb5_conf_t:dir list_dir_perms; + allow trident_t krb5_conf_t:file read_file_perms; +') +libs_exec_ldconfig(trident_t) +libs_manage_lib_dirs(trident_t) +modutils_read_module_config(trident_t) +optional_policy(` + require { + type uuidd_var_lib_t; + } + allow trident_t uuidd_var_lib_t:dir manage_dir_perms; +') +optional_policy(` + require { + type tcsd_var_lib_t; + } + allow trident_t tcsd_var_lib_t:dir { manage_dir_perms relabelto }; +') + +########################################### +# Logging and Monitoring +########################################### +logging_read_audit_config(trident_t) +logging_read_audit_log(trident_t) +# AZL3: logging_relabelto_devlog_sock_files / AZL4: logging_relabel_devlog_dev +ifdef(`logging_relabelto_devlog_sock_files',` + logging_relabelto_devlog_sock_files(trident_t) +',` + logging_relabel_devlog_dev(trident_t) +') +logging_search_logs(trident_t) +# AZL3: logging_stream_connect_journald_varlink / AZL4: logging_stream_connect_syslog +ifdef(`logging_stream_connect_journald_varlink',` + logging_stream_connect_journald_varlink(trident_t) +',` + logging_stream_connect_syslog(trident_t) +') +# AZL3: logging_manage_generic_log_dirs / AZL4: removed (covered by logging_manage_generic_logs) +ifdef(`logging_manage_generic_log_dirs',` + logging_manage_generic_log_dirs(trident_t) +') +logging_manage_generic_logs(trident_t) + +########################################### +# Miscellaneous +########################################### +optional_policy(` + ifdef(`miscfiles_read_generic_tls_privkey',` + miscfiles_read_generic_tls_privkey(trident_t) + ',` + miscfiles_read_all_certs(trident_t) + ') +') +optional_policy(` + miscfiles_read_man_pages(trident_t) +') +optional_policy(` + miscfiles_read_localization(trident_t) +') +optional_policy(` + miscfiles_read_generic_certs(trident_t) +') +optional_policy(` + require { + type xkb_var_lib_t; + } + allow trident_t xkb_var_lib_t:dir list_dir_perms; + allow trident_t xkb_var_lib_t:file read_file_perms; + allow trident_t xkb_var_lib_t:lnk_file read_lnk_file_perms; +') + +#################### +# +# Additional permissions given to external domains +# +#============= bootloader_t ============== +# List the contents of generic tmpfs directories; required for RAID +fs_list_tmpfs(bootloader_t) + +#============= cloud_init_t ============== +optional_policy(` + require { + type cloud_init_t; + } + allow cloud_init_t unlabeled_t:dir { add_name getattr remove_name search write }; + allow cloud_init_t unlabeled_t:file { create getattr ioctl open read rename write }; + allow cloud_init_t usr_t:dir { add_name create remove_name write }; + + files_exec_usr_files(cloud_init_t) + files_manage_usr_files(cloud_init_t) +') + +#============= fsadm_t ============== +role unconfined_r types fsadm_t; + +# Get the attributes of efivarfs filesystems +allow fsadm_t efivarfs_t:filesystem getattr; +allow fsadm_t trident_t:process { siginh rlimitinh noatsecure transition sigchld }; +allow fsadm_t fixed_disk_device_t:blk_file { open read write getattr ioctl }; +allow fsadm_t unlabeled_t:file map; + +# Allow fsadm_t to use losetup utility on Trident-created files in /var/lib/. Necessary to attach device to extension image. +allow fsadm_t trident_var_lib_t:file { getattr open read write }; + +# Create, read, write, and delete files on a efivarfs filesystem +fs_manage_efivarfs_files(fsadm_t) +fs_manage_tmpfs_dirs(fsadm_t) +fs_manage_tmpfs_files(fsadm_t) + +#============= loadkeys_t ============== +optional_policy(` + require { + type trident_t; + type loadkeys_t; + } + files_read_default_symlinks(loadkeys_t) + fs_search_tmpfs(loadkeys_t) +') + +#============= lvm_t ============== +# This is necessary for Trident to create encrypted volumes +allow lvm_t trident_t:sem { associate read unix_read unix_write write }; +allow lvm_t initrc_t:sem { associate read unix_read unix_write write }; + +# These permissions are necessary for cryptsetup luksOpen to succeed. +allow lvm_t init_t:key search; # Allows LVM to write to search the kernel keyring. +allow lvm_t tpm_device_t:chr_file write; # Allows LVM to write to the TPM device. + +# This is necessary for veritysetup to be able to read a key file in /tmp. +allow lvm_t tmp_t:file { getattr ioctl open read }; + +#============= mount_t ============= +allow mount_t trident_var_lib_t:dir mounton; + +#============= systemd_pcrphase_t ============== +allow systemd_pcrphase_t tmpfs_t:dir { getattr open read search }; +allow systemd_pcrphase_t tmpfs_t:file { getattr lock open setattr write }; + +#============= rpm_t ============== +optional_policy(` + require { + type rpm_t; + type rpm_script_t; + } + allow rpm_t unlabeled_t:dir { add_name getattr remove_name search write }; + allow rpm_t unlabeled_t:file { create getattr ioctl open read rename write }; + allow rpm_t rpm_script_t:process { noatsecure rlimitinh siginh }; + + #============= rpm_script_t ============== + # Allow RPM scripts to read SELinux policy (we currently apply trident.pp as a module in the Trident spec) + allow rpm_script_t security_t:security read_policy; + + allow rpm_script_t kernel_t:fd use; + allow rpm_script_t unlabeled_t:dir { add_name getattr remove_name search write }; + allow rpm_script_t unlabeled_t:file { create getattr ioctl open read rename write }; +') + +#============= semanage_t ============== +allow semanage_t proc_t:filesystem getattr; +allow semanage_t load_policy_t:process { noatsecure rlimitinh siginh }; +allow semanage_t setfiles_t:process { noatsecure rlimitinh siginh }; + +libs_manage_lib_dirs(semanage_t) +libs_manage_lib_files(semanage_t) + +#============= setfiles_t ============== +allow setfiles_t proc_t:filesystem getattr; +allow setfiles_t unlabeled_t:file { map open read }; +allow setfiles_t container_var_lib_t:blk_file relabelto; + +#============= systemd_generator_t ============== +allow systemd_generator_t home_root_t:dir read; + +#============= udev_t ============== +optional_policy(` + require { + type cloud_init_t; + } + allow udev_t cloud_init_t:fd use; + allow udev_t cloud_init_t:fifo_file { append write getattr }; +') +allow udev_t lvm_t:process { noatsecure rlimitinh siginh }; +allow udev_t unlabeled_t:file getattr; + +# Allow losetup to attach an extension image file as a loopback device. +allow udev_t trident_var_lib_t:file getattr; + +files_read_generic_tmp_files(udev_t) + +#============= udevadm_t ============== +optional_policy(` + require { + type cgroup_t; + } + allow udevadm_t cgroup_t:filesystem getattr; +') +allow udevadm_t self:netlink_route_socket { bind create getattr getopt nlmsg_read read setopt write }; +allow udevadm_t self:udp_socket { create ioctl }; +allow udevadm_t self:capability { sys_admin }; +allow udevadm_t systemd_hwdb_t:file { getattr map open read }; +allow udevadm_t kernel_t:fd use; + +# Allow udevadm to search kernel modules, read module configurations and dependencies +files_search_kernel_modules(udevadm_t) +modutils_read_module_config(udevadm_t) +modutils_read_module_deps(udevadm_t) + +# Read system network configuration files +sysnet_read_config(udevadm_t) + +# List systemd networkd runtime files +# AZL3: systemd_list_networkd_runtime / AZL4: removed, inline equivalent +ifdef(`systemd_list_networkd_runtime',` + systemd_list_networkd_runtime(udevadm_t) +',` + allow udevadm_t SYSTEMD_NETWORKD_RUNTIME_T:dir list_dir_perms; +') + +# Manage udev rules, runtime directories, and files +udev_manage_rules_files(udevadm_t) +# AZL3: udev_manage_runtime_dirs / AZL4: udev_manage_pid_dirs +ifdef(`udev_manage_runtime_dirs',` + udev_manage_runtime_dirs(udevadm_t) +',` + udev_manage_pid_dirs(udevadm_t) +') +# AZL3: udev_manage_runtime_files / AZL4: udev_manage_pid_files +ifdef(`udev_manage_runtime_files',` + udev_manage_runtime_files(udevadm_t) +',` + udev_manage_pid_files(udevadm_t) +') + +# Read symbolic links in cgroup directories and search sysfs +optional_policy(` + require { + type cgroup_t; + } + read_lnk_files_pattern(udevadm_t, cgroup_t, cgroup_t) +') +dev_search_sysfs(udevadm_t) + +#============= unlabeled_t ============== +fs_associate_tmpfs(unlabeled_t) \ No newline at end of file diff --git a/tests/tailor-images/trident-mos/files/tridentd.service b/tests/tailor-images/trident-mos/files/tridentd.service new file mode 100644 index 0000000000..85613bd130 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/tridentd.service @@ -0,0 +1,5 @@ +[Unit] +Description=Trident Daemon + +[Service] +ExecStart=trident daemon diff --git a/tests/tailor-images/trident-mos/files/tridentd.socket b/tests/tailor-images/trident-mos/files/tridentd.socket new file mode 100644 index 0000000000..79e3711c31 --- /dev/null +++ b/tests/tailor-images/trident-mos/files/tridentd.socket @@ -0,0 +1,11 @@ +[Unit] +Description=Trident Daemon gRPC Socket + +[Socket] +ListenStream=/run/trident/trident.sock +SocketMode=0600 +SocketUser=root +SocketGroup=root + +[Install] +WantedBy=sockets.target \ No newline at end of file diff --git a/tests/tailor-images/trident-mos/image.yaml b/tests/tailor-images/trident-mos/image.yaml new file mode 100644 index 0000000000..7ceb0c70eb --- /dev/null +++ b/tests/tailor-images/trident-mos/image.yaml @@ -0,0 +1,17 @@ +name: trident-mos + +base: + ref: baremetal + +outputs: + - format: iso + +extraDependencies: + - ./iso.yaml + - ./files + - ./post-install.sh + - ../common + - ../../../artifacts/rcp-agent + +config: + $include: ./iso.yaml diff --git a/tests/tailor-images/trident-mos/iso.yaml b/tests/tailor-images/trident-mos/iso.yaml new file mode 100644 index 0000000000..ea73cb15de --- /dev/null +++ b/tests/tailor-images/trident-mos/iso.yaml @@ -0,0 +1,130 @@ +storage: + bootType: efi + + disks: + - partitionTableType: gpt + maxSize: 4G + partitions: + - id: esp + type: esp + start: 1M + end: 9M + + - id: rootfs + start: 9M + filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + + - deviceId: rootfs + type: ext4 + mountPoint: + path: / + +os: + bootloader: + resetType: hard-reset + hostname: trident-mos-testimage + + packages: + update: + - systemd + + install: + - binutils + - curl + - device-mapper + - dnf + - dosfstools + - efibootmgr + - iproute + - iptables + - lsof + - mdadm + - netplan + # Support for mounting NTFS filesystems + - ntfs-3g + # Support for creating NTFS filesystems + - ntfsprogs + - openssh-server + - squashfs-tools + - tar + - tpm2-tools + - veritysetup + - vim + # Support for building SELinux module and debugging + - selinux-policy-devel + - setools-console + + additionalDirs: + # Required for systemd-pcrlock & PCR-based encryption; can be removed once + # AZL 4.0 merges a fix to provide statically defined files inside the same + # package as the systemd-pcrlock binary, i.e. systemd-udev. + - source: "files/static-pcrlock-files/" + destination: "/var/lib/pcrlock.d/" + + additionalFiles: + - source: ../common/files/getty@.service + destination: /usr/lib/systemd/system/getty@.service + - source: ../common/files/serial-getty@.service + destination: /usr/lib/systemd/system/serial-getty@.service + - source: files/root.profile + destination: /root/.profile + - source: files/trident-install.service + destination: /usr/lib/systemd/system/trident-install.service + - source: files/trident.if + destination: /usr/share/selinux/packages/trident/trident.if + - source: files/trident.fc + destination: /usr/share/selinux/packages/trident/trident.fc + - source: files/trident.te + destination: /usr/share/selinux/packages/trident/trident.te + + # Trident daemon service files + - source: files/tridentd.socket + destination: /usr/lib/systemd/system/tridentd.socket + - source: files/tridentd.service + destination: /usr/lib/systemd/system/tridentd.service + + # Netlaunch RCP files -- rcp-agent is a built Go binary staged into + # artifacts/ by the Makefile before invoking tailor (the IC container + # only mounts the tailor workspace root and the output directory, not + # arbitrary repo paths, so a built artifact must land under artifacts/ + # to be reachable here). + - source: ../../../artifacts/rcp-agent + destination: /usr/bin/rcp-agent + - source: files/rcp-agent.service + destination: /usr/lib/systemd/system/rcp-agent.service + + services: + enable: + - rcp-agent + - tridentd.socket + disable: + - trident-install + +scripts: + postCustomization: + - path: post-install.sh + +iso: + additionalFiles: + # Add placeholder config for Trident + - source: ../common/files/config-placeholder.yaml + destination: /trident-config.yaml + # Add pre-trident script to be run early by rcp-agent + - source: files/pre-trident-script.sh + destination: /pre-trident-script.sh + # Add overridable default config for rcp-agent + - source: files/rcp-agent.yaml + destination: /rcp-agent.yaml + + kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=ttyS0 + - rd.luks=0 + - selinux=1 + - enforcing=0 diff --git a/tests/tailor-images/trident-mos/post-install.sh b/tests/tailor-images/trident-mos/post-install.sh new file mode 100755 index 0000000000..927f9e3cbe --- /dev/null +++ b/tests/tailor-images/trident-mos/post-install.sh @@ -0,0 +1,21 @@ +# Use more intuitive path for the ISO mount +ln -s /run/initramfs/live /trident_cdrom + +# Load the config from the CDROM so that the user can patch it +if [ ! -d /etc/trident ]; then + mkdir -p /etc/trident +fi +ln -s /trident_cdrom/trident-config.yaml /etc/trident/config.yaml + +# Ensure /etc/rcp-agent/ exists +if [ ! -d /etc/rcp-agent ]; then + mkdir -p /etc/rcp-agent +fi + +# Link rcp-agent config from the ISO +ln -s /trident_cdrom/rcp-agent.yaml /etc/rcp-agent/config.yaml + +# Compile and load Trident SELinux module (this is otherwise handled in trident.spec) +cd /usr/share/selinux/packages/trident +make -f /usr/share/selinux/devel/Makefile trident.pp +semodule -i trident.pp \ No newline at end of file diff --git a/tests/tailor-images/trident-testimage/README.md b/tests/tailor-images/trident-testimage/README.md new file mode 100644 index 0000000000..cb27652f49 --- /dev/null +++ b/tests/tailor-images/trident-testimage/README.md @@ -0,0 +1,27 @@ +# Trident Test Image + +This image is used for testing Trident on Azure Linux. For AMD64, the image +is based on the baremetal image, and for ARM64, it is based on the ARM64 core +image. In both cases, the configuration adds Trident as well as its dependencies. +It also includes openssh-server to allow for remote access. + +## Prerequisites + +- **Trident RPMs** in `bin/RPMS/`. Build them with: + ```bash + make bin/trident-rpms.tar.gz + ``` + +## Building + +From the repo root, run: + +```bash +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml build trident-testimage -s arch=amd64 --output-dir ./artifacts +``` + +Use `-s arch=arm64` for the ARM64 variant. + +Output is written to `artifacts/trident-testimage_amd64_cosi.cosi` by default +(tailor publishes under the cell's slug; substitute `arm64` for the ARM64 +variant). Use `--output-dir ` to change the output location. diff --git a/tests/tailor-images/trident-testimage/base/post-install.sh b/tests/tailor-images/trident-testimage/base/post-install.sh new file mode 100755 index 0000000000..79da025b3b --- /dev/null +++ b/tests/tailor-images/trident-testimage/base/post-install.sh @@ -0,0 +1,2 @@ +# Add the necessary directories for the audit logs so that auditd can start +mkdir -p /var/log/audit diff --git a/tests/tailor-images/trident-testimage/by-arch/arm64.yaml b/tests/tailor-images/trident-testimage/by-arch/arm64.yaml new file mode 100644 index 0000000000..95935de4b2 --- /dev/null +++ b/tests/tailor-images/trident-testimage/by-arch/arm64.yaml @@ -0,0 +1,6 @@ +base: + $include: ../common/matrix/base-core-arm64.yaml + +outputs: + $replace: + - format: cosi diff --git a/tests/tailor-images/trident-testimage/image.yaml b/tests/tailor-images/trident-testimage/image.yaml new file mode 100644 index 0000000000..f77d6ace50 --- /dev/null +++ b/tests/tailor-images/trident-testimage/image.yaml @@ -0,0 +1,21 @@ +name: trident-testimage + +matrix: + arch: [amd64, arm64] + +base: + ref: baremetal + +outputs: + - format: cosi + +rpmSources: + - ../../../bin/RPMS + - ../../../artifacts/rpm-overrides + +extraDependencies: + - ./base + - ../common + +config: + $include: ./tailor/baseimg.yaml diff --git a/tests/tailor-images/trident-testimage/tailor/baseimg.yaml b/tests/tailor-images/trident-testimage/tailor/baseimg.yaml new file mode 100644 index 0000000000..943e888789 --- /dev/null +++ b/tests/tailor-images/trident-testimage/tailor/baseimg.yaml @@ -0,0 +1,66 @@ +storage: + bootType: efi + disks: + - partitionTableType: gpt + maxSize: 4G + partitions: + - id: esp + type: esp + size: 8M + - id: rootfs + size: grow + filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: rootfs + type: ext4 + mountPoint: + path: / +os: + bootloader: + resetType: hard-reset + hostname: trident-testimg + kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=ttyS0 + - rd.info + - log_buf_len=1M + packages: + remove: + - grub2-efi-binary + install: + - grub2-efi-binary-noprefix + - curl + - dnf + - efibootmgr + - iproute + - iptables + - lsof + - mdadm + - netplan + - openssh-server + - tpm2-tools + - trident-service + - vim + - audit + - device-mapper + - dosfstools + - lvm2 + - veritysetup + - ntfs-3g + - ntfsprogs + services: + enable: + - sshd + - trident + - tridentd.socket + additionalFiles: + - source: ../common/files/use-grpc-client-commit.conf + destination: /etc/systemd/system/trident.service.d/override.conf +scripts: + postCustomization: + - path: base/post-install.sh diff --git a/tests/tailor-images/trident-verity-testimage/README.md b/tests/tailor-images/trident-verity-testimage/README.md new file mode 100644 index 0000000000..5604cf1778 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/README.md @@ -0,0 +1,32 @@ +# Trident Verity Test Image + +This image is used for testing Trident on Azure Linux with `dm-verity` enabled. It +is based on the baremetal image and adds Trident as well as its dependencies. It +also adds openssh-server to allow for remote access. In addition to the [Trident +Test Image](../trident-testimage/README.md), this image is configured to use +dm-verity. + +## Prerequisites + +- **Trident RPMs** in `bin/RPMS/`. Build them with: + ```bash + make bin/trident-rpms.tar.gz + ``` + +## Building + +From the repo root, run: + +```bash +cargo run --manifest-path tools/tailor/Cargo.toml -- --manifest tests/tailor-images/tailor.yaml build trident-verity-testimage -s deployment=host -s mode=root --output-dir ./artifacts +``` + +Other legacy variants map to selectors on the same family: + +- `trident-usrverity-testimage` → `-s deployment=host -s mode=usr` +- `trident-container-verity-testimage` → `-s deployment=container -s mode=root` +- `trident-container-usrverity-testimage` → `-s deployment=container -s mode=usr` + +Output is written to `artifacts/` using the cell's slug (e.g. the host/root build +above publishes `trident-verity-testimage_host_root_amd64_cosi.cosi`). Use +`--output-dir ` to change the output location. diff --git a/tests/tailor-images/trident-verity-testimage/base/create-web-dir.sh b/tests/tailor-images/trident-verity-testimage/base/create-web-dir.sh new file mode 100755 index 0000000000..71f393a31a --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/base/create-web-dir.sh @@ -0,0 +1,2 @@ +# Create the web directory for testing +mkdir -p /web \ No newline at end of file diff --git a/tests/tailor-images/trident-verity-testimage/base/etc-mount.service b/tests/tailor-images/trident-verity-testimage/base/etc-mount.service new file mode 100644 index 0000000000..7883ddf82f --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/base/etc-mount.service @@ -0,0 +1,17 @@ +[Unit] +Description=/etc Mount Service +DefaultDependencies=no +Conflicts=umount.target +Before=local-fs.target umount.target +Requires=etc.mount +After=etc.mount +Requires=var-lib-trident\x2doverlay.mount +After=var-lib-trident\x2doverlay.mount + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=etc-mount.sh + +[Install] +WantedBy=local-fs.target \ No newline at end of file diff --git a/tests/tailor-images/trident-verity-testimage/base/etc-mount.sh b/tests/tailor-images/trident-verity-testimage/base/etc-mount.sh new file mode 100755 index 0000000000..f9feb5db94 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/base/etc-mount.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -eux + +mount -t overlay overlay -o lowerdir=/etc,upperdir=/var/lib/trident-overlay/etc-rw/upper,workdir=/var/lib/trident-overlay/etc-rw/work /etc +# Workaround for https://dev.azure.com/mariner-org/ECF/_workitems/edit/7349/ +chmod o+rx /etc \ No newline at end of file diff --git a/tests/tailor-images/trident-verity-testimage/base/trident-debug-log.sh b/tests/tailor-images/trident-verity-testimage/base/trident-debug-log.sh new file mode 100755 index 0000000000..da03d7c143 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/base/trident-debug-log.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +sed -i 's/--verbosity INFO/--verbosity DEBUG/' /usr/lib/systemd/system/trident.service \ No newline at end of file diff --git a/tests/tailor-images/trident-verity-testimage/by-deployment+mode/container+root.yaml b/tests/tailor-images/trident-verity-testimage/by-deployment+mode/container+root.yaml new file mode 100644 index 0000000000..765fa22857 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/by-deployment+mode/container+root.yaml @@ -0,0 +1,23 @@ +outputs: + $replace: + - format: cosi + +config: + os: + hostname: trident-container-verity-testimg + packages: + install: + - dnf + - docker-cli + - moby-engine + - squashfs-tools + - tar + additionalFiles: + - source: ../common/files/trident-container.service + destination: /usr/lib/systemd/system/trident-container.service + services: + enable: + - trident-container + scripts: + postCustomization: + - path: base/create-web-dir.sh diff --git a/tests/tailor-images/trident-verity-testimage/by-deployment+mode/container+usr.yaml b/tests/tailor-images/trident-verity-testimage/by-deployment+mode/container+usr.yaml new file mode 100644 index 0000000000..a5f9a8d916 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/by-deployment+mode/container+usr.yaml @@ -0,0 +1,19 @@ +outputs: + $replace: + - format: cosi + +config: + os: + hostname: trident-container-usrverity-testimg + packages: + install: + - docker-cli + - moby-engine + - squashfs-tools + - tar + additionalFiles: + - source: ../common/files/trident-container.service + destination: /usr/lib/systemd/system/trident-container.service + services: + enable: + - trident-container diff --git a/tests/tailor-images/trident-verity-testimage/by-deployment+mode/host+root.yaml b/tests/tailor-images/trident-verity-testimage/by-deployment+mode/host+root.yaml new file mode 100644 index 0000000000..caeaf2c0b7 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/by-deployment+mode/host+root.yaml @@ -0,0 +1,21 @@ +outputs: + $replace: + - format: cosi + +config: + os: + hostname: trident-verity-testimg + packages: + install: + - trident-service + additionalFiles: + - source: ../common/files/use-grpc-client-commit.conf + destination: /etc/systemd/system/trident.service.d/override.conf + services: + enable: + - trident + - tridentd.socket + scripts: + postCustomization: + - path: base/trident-debug-log.sh + - path: base/create-web-dir.sh diff --git a/tests/tailor-images/trident-verity-testimage/by-deployment+mode/host+usr.yaml b/tests/tailor-images/trident-verity-testimage/by-deployment+mode/host+usr.yaml new file mode 100644 index 0000000000..1ff0b914da --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/by-deployment+mode/host+usr.yaml @@ -0,0 +1,21 @@ +outputs: + $replace: + - format: cosi + +config: + os: + hostname: trident-usrverity-testimg + packages: + install: + - binutils + - trident-service + - trident-static-pcrlock-files + - audit + - selinux-policy-devel + additionalFiles: + - source: ../common/files/use-grpc-client-commit.conf + destination: /etc/systemd/system/trident.service.d/override.conf + services: + enable: + - trident + - tridentd.socket diff --git a/tests/tailor-images/trident-verity-testimage/by-deployment/container.yaml b/tests/tailor-images/trident-verity-testimage/by-deployment/container.yaml new file mode 100644 index 0000000000..de2ca21c3f --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/by-deployment/container.yaml @@ -0,0 +1 @@ +features: [] diff --git a/tests/tailor-images/trident-verity-testimage/by-deployment/host.yaml b/tests/tailor-images/trident-verity-testimage/by-deployment/host.yaml new file mode 100644 index 0000000000..71cb3154a6 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/by-deployment/host.yaml @@ -0,0 +1,3 @@ +rpmSources: + - ../../../bin/RPMS + - ../../../artifacts/rpm-overrides diff --git a/tests/tailor-images/trident-verity-testimage/by-mode/root.yaml b/tests/tailor-images/trident-verity-testimage/by-mode/root.yaml new file mode 100644 index 0000000000..04d59a7568 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/by-mode/root.yaml @@ -0,0 +1,5 @@ +config: + os: + $include: ./include/root-os-common.yaml + storage: + $include: ./include/root-storage.yaml diff --git a/tests/tailor-images/trident-verity-testimage/by-mode/usr.yaml b/tests/tailor-images/trident-verity-testimage/by-mode/usr.yaml new file mode 100644 index 0000000000..8a5445367a --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/by-mode/usr.yaml @@ -0,0 +1,14 @@ +signing: true +config: + os: + $include: ./include/usr-os-common.yaml + storage: + $include: ./include/usr-storage.yaml + output: + artifacts: + items: + - ukis + path: ./output + previewFeatures: + - uki + - output-artifacts diff --git a/tests/tailor-images/trident-verity-testimage/image.yaml b/tests/tailor-images/trident-verity-testimage/image.yaml new file mode 100644 index 0000000000..01e01ba3da --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/image.yaml @@ -0,0 +1,18 @@ +name: trident-verity-testimage + +matrix: + deployment: [host, container] + mode: [root, usr] + +base: + ref: baremetal + +outputs: + - format: cosi + +extraDependencies: + - ./base + - ./usr + - ../common + +config: {} diff --git a/tests/tailor-images/trident-verity-testimage/include/root-os-common.yaml b/tests/tailor-images/trident-verity-testimage/include/root-os-common.yaml new file mode 100644 index 0000000000..f3f6b9ea78 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/include/root-os-common.yaml @@ -0,0 +1,42 @@ +bootloader: + resetType: hard-reset +selinux: + mode: disabled +kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=ttyS0 + - rd.info + - log_buf_len=1M +packages: + install: + - grub2-efi-binary-noprefix + - curl + - device-mapper + - dosfstools + - dracut-overlayfs + - efibootmgr + - iproute + - iptables + - lsof + - lvm2 + - mdadm + - netplan + - openssh-server + - systemd-udev + - tpm2-tools + - veritysetup + - vim + remove: + - grub2-efi-binary +additionalFiles: + - source: base/etc-mount.service + destination: /etc/systemd/system/etc-mount.service + - source: base/etc-mount.sh + destination: /usr/local/bin/etc-mount.sh + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel +services: + enable: + - etc-mount + - sshd diff --git a/tests/tailor-images/trident-verity-testimage/include/root-storage.yaml b/tests/tailor-images/trident-verity-testimage/include/root-storage.yaml new file mode 100644 index 0000000000..cb38c27f81 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/include/root-storage.yaml @@ -0,0 +1,56 @@ +disks: + - partitionTableType: gpt + maxSize: 5G + partitions: + - id: esp + type: esp + size: 8M + - id: boot + size: 1G + - label: root + id: root + size: 2G + - label: root-hash + id: verityhash + size: 128M + - id: sysexts + size: 1G + - id: confexts + size: 200M + - id: var + size: grow +bootType: efi +verity: + - id: rootverity + name: root + dataDeviceId: root + hashDeviceId: verityhash + dataDeviceMountIdType: part-label + hashDeviceMountIdType: part-label +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: boot + type: ext4 + mountPoint: + path: /boot + - deviceId: rootverity + type: ext4 + mountPoint: + path: / + options: defaults,ro + - deviceId: sysexts + type: ext4 + mountPoint: + path: /var/lib/extensions + - deviceId: confexts + type: ext4 + mountPoint: + path: /var/lib/confexts + - deviceId: var + type: ext4 + mountPoint: + path: /var diff --git a/tests/tailor-images/trident-verity-testimage/include/usr-os-common.yaml b/tests/tailor-images/trident-verity-testimage/include/usr-os-common.yaml new file mode 100644 index 0000000000..7a63deaf4a --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/include/usr-os-common.yaml @@ -0,0 +1,41 @@ +bootloader: + resetType: hard-reset +selinux: + mode: disabled +uki: + mode: create +kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=ttyS0 + - rd.info + - log_buf_len=1M + - rd.hostonly=0 +packages: + install: + - curl + - device-mapper + - efibootmgr + - iproute + - iptables + - lvm2 + - mdadm + - netplan + - openssh-server + - systemd-udev + - tpm2-tools + - veritysetup + - vim + - systemd-ukify + - systemd-boot + - efibootmgr + remove: + - grub2-efi-binary +additionalFiles: + - source: usr/files/dracut-nohostonly.conf + destination: /usr/lib/dracut/dracut.conf.d/nohostonly.conf + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel +services: + enable: + - sshd diff --git a/tests/tailor-images/trident-verity-testimage/include/usr-storage.yaml b/tests/tailor-images/trident-verity-testimage/include/usr-storage.yaml new file mode 100644 index 0000000000..ce7337eaa0 --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/include/usr-storage.yaml @@ -0,0 +1,45 @@ +disks: + - partitionTableType: gpt + maxSize: 5G + partitions: + - id: esp + type: esp + size: 500M + label: esp + - id: boot + size: 150M + - id: root + size: 2G + - id: usr-data + label: usr + size: 1G + - id: usr-hash + label: usr-hash + size: 128M +bootType: efi +verity: + - id: usr + name: usr + dataDeviceId: usr-data + hashDeviceId: usr-hash + dataDeviceMountIdType: uuid + hashDeviceMountIdType: uuid +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: boot + type: ext4 + mountPoint: + path: /boot + - deviceId: root + type: ext4 + mountPoint: + path: / + - deviceId: usr + type: ext4 + mountPoint: + path: /usr + options: defaults,ro diff --git a/tests/tailor-images/trident-verity-testimage/usr/files/dracut-nohostonly.conf b/tests/tailor-images/trident-verity-testimage/usr/files/dracut-nohostonly.conf new file mode 100644 index 0000000000..18912360ca --- /dev/null +++ b/tests/tailor-images/trident-verity-testimage/usr/files/dracut-nohostonly.conf @@ -0,0 +1 @@ +hostonly="no" diff --git a/tests/tailor-images/trident-vm-testimage/README.md b/tests/tailor-images/trident-vm-testimage/README.md new file mode 100644 index 0000000000..e4dc5a3dd2 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/README.md @@ -0,0 +1,51 @@ +# Trident VM Test Image + +This image is used for testing Trident adopting an already produced image (e.g. +generated by MIC). It is based on the baremetal +image and adds Trident as well as its dependencies. It also adds openssh-server +to allow for remote access. Finally, it contains duplicate set of partitions to +setup the disk layout for A/B update. + +Two sets of images are available: + +- regular +- with verity +- with UKI usr-verity for ACL-agent-driven A/B update testing + +For both, a set of corresponding update images is available. The ACL-agent +variant reuses the servicing-style VM image layout but additionally installs +`trident-acl-agent` so storm ACL-agent scenarios can drive a real in-guest +agent talking to `tridentd`. The base (qcow2) image installs the package but +leaves `trident-acl-agent.service` disabled -- the storm scenario delivers a +fake kubeconfig at runtime and enables/starts the service itself. Only the +update image enables `trident-acl-agent.service` by default, since after a +real A/B update boots into it there is no test harness left to `systemctl +enable --now` it. Neither image preseeds `/etc/trident/trident-acl-agent.conf` +-- the harness never writes that file at all; instead it delivers a fake +kubeconfig to `/var/lib/kubelet/kubeconfig` and supplies the Nebraska +endpoint/appId/track per-request via the update-request annotation. + +## Additional Prerequisites + +- Artifacts + - **Trident RPMs**: expected in `bin/RPMS/**/*.rpm`. Can be created with + `make bin/trident-rpms.tar.gz` + +## Building + +To build the base image, run: + +| Image type | Make command | Output path | +| ---------- | ------------ | ----------- | +| Regular | `make artifacts/trident-vm-grub-testimage.qcow2` | `artifacts/trident-vm-grub-testimage.qcow2` | +| With verity `qcow2` | `make artifacts/trident-vm-grub-verity-testimage.qcow2` | `artifacts/trident-vm-grub-verity-testimage.qcow2` | +| With verity fixed size `vhd` | `make artifacts/trident-vm-grub-verity-azure-testimage.vhd` | `artifacts/trident-vm-grub-verity-azure-testimage.vhd` | +| ACL-agent UKI usr-verity `qcow2` | `make artifacts/trident-vm-acl-agent-testimage.qcow2` | `artifacts/trident-vm-acl-agent-testimage.qcow2` | + +To build the update images, run: + +| Image type | Make command | Output path | +| ---------- | ------------ | ----------- | +| Regular | `make artifacts/trident-vm-grub-testimage.cosi` | `artifacts/trident-vm-grub-testimage.cosi` | +| With verity | `make artifacts/trident-vm-grub-verity-testimage.cosi` | `artifacts/trident-vm-grub-verity-testimage.cosi` | +| ACL-agent UKI usr-verity | `make artifacts/trident-vm-acl-agent-update-testimage.cosi` | `artifacts/trident-vm-acl-agent-update-testimage.cosi` | diff --git a/tests/tailor-images/trident-vm-testimage/base/.gitignore b/tests/tailor-images/trident-vm-testimage/base/.gitignore new file mode 100644 index 0000000000..6c07ccac55 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/.gitignore @@ -0,0 +1 @@ +mic-config.yaml \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/files/.gitignore b/tests/tailor-images/trident-vm-testimage/base/files/.gitignore new file mode 100644 index 0000000000..7ed8773999 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/files/.gitignore @@ -0,0 +1,3 @@ +host_status.yaml +config.yaml +id_rsa.pub \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/files/99-dhcp-eth0.network b/tests/tailor-images/trident-vm-testimage/base/files/99-dhcp-eth0.network new file mode 100644 index 0000000000..5cef9e24f8 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/files/99-dhcp-eth0.network @@ -0,0 +1,6 @@ +[Match] +Name=eth0 + +[Network] +DHCP=yes +IPv6AcceptRA=no \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/files/etc-mount-mic.service b/tests/tailor-images/trident-vm-testimage/base/files/etc-mount-mic.service new file mode 100644 index 0000000000..48f05860e4 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/files/etc-mount-mic.service @@ -0,0 +1,15 @@ +[Unit] +Description=/etc Mount Service +DefaultDependencies=no +Conflicts=umount.target +Before=local-fs.target umount.target +Requires=var-lib-trident\x2doverlay.mount +After=var-lib-trident\x2doverlay.mount + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=etc-mount.sh commit-machine-id + +[Install] +WantedBy=local-fs.target \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/files/etc-mount.service b/tests/tailor-images/trident-vm-testimage/base/files/etc-mount.service new file mode 100644 index 0000000000..a90c052deb --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/files/etc-mount.service @@ -0,0 +1,17 @@ +[Unit] +Description=/etc Mount Service +DefaultDependencies=no +Conflicts=umount.target +Before=local-fs.target umount.target systemd-networkd.service +Requires=etc.mount +After=etc.mount +Requires=var-lib-trident\x2doverlay.mount +After=var-lib-trident\x2doverlay.mount + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=etc-mount.sh + +[Install] +WantedBy=local-fs.target \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/files/etc-mount.sh b/tests/tailor-images/trident-vm-testimage/base/files/etc-mount.sh new file mode 100755 index 0000000000..b187511aca --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/files/etc-mount.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -ex + +# TODO: figure out why we are missing systemd-machine-id-commit service, which should automate this +if [ "$1" == "commit-machine-id" ]; then + MACHINEID=`cat /etc/machine-id` + echo $MACHINEID + # if machine-id has a mount point, unmount it + if grep -q /etc/machine-id /proc/mounts; then + umount /etc/machine-id + fi +fi + +mount -t overlay overlay -o lowerdir=/etc,upperdir=/var/lib/trident-overlay/etc-rw/upper,workdir=/var/lib/trident-overlay/etc-rw/work /etc +# Workaround for dracut overlayfs module mounting /etc overlay as 755 on clean install and +# 750 on abupdate +chmod o+rx /etc + +if [ "$1" == "commit-machine-id" ]; then + echo Committing machine-id + echo $MACHINEID > /etc/machine-id + cat /etc/machine-id +fi \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/files/sshd-keygen.service b/tests/tailor-images/trident-vm-testimage/base/files/sshd-keygen.service new file mode 100644 index 0000000000..ab8532cd74 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/files/sshd-keygen.service @@ -0,0 +1,14 @@ +[Unit] +Description=Generate sshd host keys +ConditionPathExists=|!/srv/etc/ssh/ssh_host_rsa_key +ConditionPathExists=|!/srv/etc/ssh/ssh_host_ecdsa_key +ConditionPathExists=|!/srv/etc/ssh/ssh_host_ed25519_key +Before=sshd.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/ssh-keygen -A -f /srv + +[Install] +WantedBy=multi-user.target diff --git a/tests/tailor-images/trident-vm-testimage/base/files/trident-acl-agent-cert-install.service b/tests/tailor-images/trident-vm-testimage/base/files/trident-acl-agent-cert-install.service new file mode 100644 index 0000000000..4033001c9f --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/files/trident-acl-agent-cert-install.service @@ -0,0 +1,28 @@ +[Unit] +Description=Install trident-acl-agent storm test CA cert into system trust store +# Test-harness-only plumbing: this file only exists when a storm test run +# has written an ephemeral CA cert onto the persistent, non-A/B +# /var/lib/trident-acl-agent partition (see prepareVmForAclAgent in +# tools/storm/aclagent/tests/update.go). It never exists on a real +# deployment. Skips as a no-op (not a failure) when absent, e.g. before the +# harness has run at all, or for run-rollback, which never uses Nebraska. +ConditionPathExists=/var/lib/trident-acl-agent/nebraska-ca.pem +Before=trident-acl-agent.service + +[Service] +Type=oneshot +RemainAfterExit=yes +# Re-derives the system trust store install every boot: /etc is part of +# this usr-verity image's plain A/B-swapped root filesystem (root-a/root-b, +# see storage-acl-agent.yaml -- no overlay involved), so neither step below +# carries over across a reboot into the other slot, unlike the source cert +# on /var/lib/trident-acl-agent. +ExecStart=/bin/sh -c ' \ + cp /var/lib/trident-acl-agent/nebraska-ca.pem /etc/pki/ca-trust/source/anchors/trident-acl-agent-storm-test-ca.pem && \ + update-ca-trust extract && \ + cp /etc/pki/ca-trust/source/anchors/trident-acl-agent-storm-test-ca.pem /etc/pki/tls/certs/trident-acl-agent-storm-test-ca.pem && \ + openssl rehash /etc/pki/tls/certs \ + ' + +[Install] +WantedBy=multi-user.target diff --git a/tests/tailor-images/trident-vm-testimage/base/files/trident-acl-agent-override.conf b/tests/tailor-images/trident-vm-testimage/base/files/trident-acl-agent-override.conf new file mode 100644 index 0000000000..9529661983 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/files/trident-acl-agent-override.conf @@ -0,0 +1,10 @@ +[Unit] +Wants=trident-acl-agent-cert-install.service +After=trident-acl-agent-cert-install.service + +[Service] +Environment=TRIDENT_ACL_AGENT_KUBERNETES_ANNOTATION_PREFIX=acl.azure.com +Environment=TRIDENT_ACL_AGENT_CURRENT_VERSION_KEY=IMAGE_VERSION +Environment=TRIDENT_ACL_AGENT_ORCHESTRATION_MODE=annotations +Environment=TRIDENT_ACL_AGENT_CURRENT_VERSION_PATH=/etc/os-release +Environment=TRIDENT_ACL_AGENT_CURRENT_VERSION_FALLBACK=always diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/create-rw-overlay-dirs.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/create-rw-overlay-dirs.sh new file mode 100755 index 0000000000..56f74ceb13 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/create-rw-overlay-dirs.sh @@ -0,0 +1,2 @@ +mkdir -p /var/lib/trident-overlay/etc-rw/upper +mkdir -p /var/lib/trident-overlay/etc-rw/work \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/create-ssh-dirs.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/create-ssh-dirs.sh new file mode 100755 index 0000000000..6454a7a0e3 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/create-ssh-dirs.sh @@ -0,0 +1,3 @@ +# Move the SSH host keys off the read-only /etc directory, so that sshd can run. +SSH_VAR_DIR="/srv/etc/ssh/" +mkdir -p "$SSH_VAR_DIR" diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/duid-type-to-link-layer.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/duid-type-to-link-layer.sh new file mode 100755 index 0000000000..5c35e32cf2 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/duid-type-to-link-layer.sh @@ -0,0 +1 @@ +sed -i 's/#DUIDType=vendor/DUIDType=link-layer/' /etc/systemd/networkd.conf \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/lsblk.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/lsblk.sh new file mode 100644 index 0000000000..39b5518e72 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/lsblk.sh @@ -0,0 +1 @@ +lsblk --json --output-all --bytes \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/post-install.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/post-install.sh new file mode 100755 index 0000000000..b960507cd1 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/post-install.sh @@ -0,0 +1,2 @@ +# Add the necessary directories for the audit logs so that auditd can start +mkdir -p /var/log/audit \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/prepare-update-config-usrverity.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/prepare-update-config-usrverity.sh new file mode 100755 index 0000000000..82663a13d3 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/prepare-update-config-usrverity.sh @@ -0,0 +1,9 @@ +CONFIG_PATH=/var/lib/trident/update-config.yaml +DOWNLOAD_URL_PREFIX="http://192.168.122.1:8000" + +cp /etc/trident/config.yaml $CONFIG_PATH +cat <> $CONFIG_PATH +image: + url: $DOWNLOAD_URL_PREFIX/usrverity.cosi + sha384: ignored +EOF \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/prepare-update-config-verity.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/prepare-update-config-verity.sh new file mode 100755 index 0000000000..600151fdd8 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/prepare-update-config-verity.sh @@ -0,0 +1,36 @@ +CONFIG_PATH=/var/lib/trident/update-config.yaml +DOWNLOAD_URL_PREFIX="http://192.168.122.1:8000" + +cat < $CONFIG_PATH +image: + url: $DOWNLOAD_URL_PREFIX/verity.cosi + sha384: ignored +EOF + +INTERFACE_MASK='enp*' +if [ "$1" == "eth0" ]; then + INTERFACE_MASK="$1" +fi + +if [ "$1" != "uki" ]; then + cat <> $CONFIG_PATH +scripts: + postConfigure: + - name: rw-overlay + runOn: [all] + content: | + mkdir -p /var/lib/trident-overlay/etc-rw/upper && mkdir -p /var/lib/trident-overlay/etc-rw/work +EOF +fi + +cat <> $CONFIG_PATH +internalParams: + allowUnusedFilesystems: true +EOF + +if [ "$1" == "uki" ]; then + cat <> $CONFIG_PATH + uki: true + disableGrubNoprefixCheck: true +EOF +fi diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/prepare-update-config.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/prepare-update-config.sh new file mode 100755 index 0000000000..df4ddb8143 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/prepare-update-config.sh @@ -0,0 +1,9 @@ +CONFIG_PATH=/var/lib/trident/update-config.yaml +DOWNLOAD_URL_PREFIX="http://192.168.122.1:8000" + +cp /etc/trident/config.yaml $CONFIG_PATH +cat <> $CONFIG_PATH +image: + url: $DOWNLOAD_URL_PREFIX/regular.cosi + sha384: ignored +EOF \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/ssh-move-host-keys.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/ssh-move-host-keys.sh new file mode 100755 index 0000000000..7891a607ac --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/ssh-move-host-keys.sh @@ -0,0 +1,9 @@ +# Move the SSH host keys off the read-only /etc directory, so that sshd can run. +SSH_VAR_DIR="/srv/etc/ssh/" + +cat << EOF >> /etc/ssh/sshd_config + +HostKey $SSH_VAR_DIR/ssh_host_rsa_key +HostKey $SSH_VAR_DIR/ssh_host_ecdsa_key +HostKey $SSH_VAR_DIR/ssh_host_ed25519_key +EOF diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/update-host-status.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/update-host-status.sh new file mode 100755 index 0000000000..4a69a02213 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/update-host-status.sh @@ -0,0 +1 @@ +trident offline-initialize diff --git a/tests/tailor-images/trident-vm-testimage/base/scripts/update-os-release.sh b/tests/tailor-images/trident-vm-testimage/base/scripts/update-os-release.sh new file mode 100755 index 0000000000..d28e1c109d --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/base/scripts/update-os-release.sh @@ -0,0 +1,2 @@ +printf -v DATE '%(%Y%m%d)T' -1 +sed -i "s/VERSION=\".*\"/VERSION=\"$DATE\"/" /etc/os-release \ No newline at end of file diff --git a/tests/tailor-images/trident-vm-testimage/by-arch+scenario/arm64+grub-verity.yaml b/tests/tailor-images/trident-vm-testimage/by-arch+scenario/arm64+grub-verity.yaml new file mode 100644 index 0000000000..59e00d5894 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-arch+scenario/arm64+grub-verity.yaml @@ -0,0 +1,3 @@ +outputs: + $replace: + - format: cosi diff --git a/tests/tailor-images/trident-vm-testimage/by-arch/arm64.yaml b/tests/tailor-images/trident-vm-testimage/by-arch/arm64.yaml new file mode 100644 index 0000000000..95935de4b2 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-arch/arm64.yaml @@ -0,0 +1,6 @@ +base: + $include: ../common/matrix/base-core-arm64.yaml + +outputs: + $replace: + - format: cosi diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/acl-agent-base.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/acl-agent-base.yaml new file mode 100644 index 0000000000..bc4ee9fe07 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/acl-agent-base.yaml @@ -0,0 +1,37 @@ +# Base (qcow2) counterpart to acl-agent.yaml. The real A/B reboot lands on a +# different root than the one the storm harness SSHes into pre-stage. /etc/trident +# and /var/lib/kubelet are persistent, part-labeled partitions shared by both +# roots (see storage-acl-agent.yaml), but the systemd enablement symlink that +# "systemctl enable --now" writes lives under the root filesystem itself, so a +# live enable on the old root has no effect once the new root is booted. +# trident-acl-agent.service is therefore only enabled by default on the +# cosi (update) counterpart; the qcow2 base image enables it live via SSH +# during initial deploy. +outputs: + $replace: + - format: qcow2 +config: + storage: + $include: ./include/storage-acl-agent.yaml + os: + hostname: trident-acl-agent-testimg + packages: + install: + $remove: + - trident-service + $append: + - trident-acl + additionalFiles: + - source: base/files/99-dhcp-eth0.network + destination: /etc/systemd/network/99-dhcp-eth0.network + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel + - source: base/files/trident-acl-agent-override.conf + destination: /etc/systemd/system/trident-acl-agent.service.d/override.conf + - source: base/files/trident-acl-agent-cert-install.service + destination: /etc/systemd/system/trident-acl-agent-cert-install.service + services: + enable: + - kdump + - tridentd.socket + - trident-acl-agent-cert-install.service diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/acl-agent.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/acl-agent.yaml new file mode 100644 index 0000000000..b00bb504ad --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/acl-agent.yaml @@ -0,0 +1,29 @@ +outputs: + $replace: + - format: cosi +config: + storage: + $include: ./include/storage-acl-agent.yaml + os: + hostname: trident-acl-agent-testimg + packages: + install: + $remove: + - trident-service + $append: + - trident-acl + additionalFiles: + - source: base/files/99-dhcp-eth0.network + destination: /etc/systemd/network/99-dhcp-eth0.network + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel + - source: base/files/trident-acl-agent-override.conf + destination: /etc/systemd/system/trident-acl-agent.service.d/override.conf + - source: base/files/trident-acl-agent-cert-install.service + destination: /etc/systemd/system/trident-acl-agent-cert-install.service + services: + enable: + - kdump + - tridentd.socket + - trident-acl-agent-cert-install.service + - trident-acl-agent.service diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/grub-base.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-base.yaml new file mode 100644 index 0000000000..4362d99abf --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-base.yaml @@ -0,0 +1,56 @@ +# Base (qcow2) counterpart to grub.yaml, matching the pre-migration +# baseimg-grub.yaml / updateimg-grub.yaml split: the base image is a +# dual-slot A/B layout (storage-grub.yaml, unchanged), while the cosi +# update target uses a single slot (storage-grub-update.yaml). +outputs: + $replace: + - format: qcow2 +config: + storage: + $include: ./include/storage-grub.yaml + os: + bootloader: + resetType: hard-reset + hostname: trident-vm-testimg + selinux: + mode: disabled + kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=tty1 + - console=ttyS0 + - rd.debug + - loglevel=6 + - log_buf_len=1M + - systemd.journald.forward_to_console=1 + packages: + install: + - dnf + - efibootmgr + - grub2-efi-binary + - iproute + - iptables + - jq + - openssh-server + - trident-service + - vim + - netplan + services: + enable: + - tridentd.socket + users: + - name: testuser + sshPublicKeyPaths: + - base/files/id_rsa.pub + secondaryGroups: + - wheel + additionalFiles: + - source: base/files/sshd-keygen.service + destination: /usr/lib/systemd/system/sshd-keygen.service + - source: base/files/99-dhcp-eth0.network + destination: /etc/systemd/network/99-dhcp-eth0.network + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel + scripts: + postCustomization: + - $include: ./include/grub-base-scripts.yaml diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity+grub-verity-azure.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity+grub-verity-azure.yaml new file mode 100644 index 0000000000..ad0608c844 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity+grub-verity-azure.yaml @@ -0,0 +1,6 @@ +config: + os: + $include: ./include/grub-verity-os-common.yaml + scripts: + postCustomization: + - $include: ./include/grub-verity-scripts.yaml diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-azure-base.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-azure-base.yaml new file mode 100644 index 0000000000..669be03657 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-azure-base.yaml @@ -0,0 +1,33 @@ +# Base (vhd-fixed) counterpart to grub-verity-azure.yaml. The VHD is the +# initial-deploy image and needs the dual-slot A/B partition layout (like +# grub-verity-base.yaml), unlike the cosi update target which only ever +# lands on a single slot. Shared os/scripts content comes from +# grub-verity-base+grub-verity-azure-base.yaml; this file only layers the +# azure-specific overrides on top. Storage uses the Azure-specific legacy +# layout (15G disk cap, 16M ESP, growable /srv), not the generic QEMU +# grub-verity-base sizing -- see storage-grub-verity-azure-base.yaml. +outputs: + $replace: + - format: vhd-fixed +base: + $set: + ref: core_selinux +config: + storage: + $include: ./include/storage-grub-verity-azure-base.yaml + os: + selinux: + mode: + $set: permissive + packages: + install: + $remove: + - netplan + $append: + - selinux-policy + - WALinuxAgent + users: + $replace: + - name: testuser + secondaryGroups: + - wheel diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-azure.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-azure.yaml new file mode 100644 index 0000000000..9e572bc9df --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-azure.yaml @@ -0,0 +1,24 @@ +outputs: + $replace: + - format: cosi +base: + $set: + ref: core_selinux +config: + storage: + $include: ./include/storage-grub-verity-azure.yaml + os: + hostname: trident-vm-testimg + selinux: + mode: + $set: permissive + packages: + install: + $append: + - selinux-policy + - WALinuxAgent + users: + $replace: + - name: testuser + secondaryGroups: + - wheel diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-base+grub-verity-azure-base.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-base+grub-verity-azure-base.yaml new file mode 100644 index 0000000000..a5d3f9648a --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-base+grub-verity-azure-base.yaml @@ -0,0 +1,6 @@ +config: + os: + $include: ./include/grub-verity-base-os-common.yaml + scripts: + postCustomization: + - $include: ./include/grub-verity-base-scripts.yaml diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-base.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-base.yaml new file mode 100644 index 0000000000..c81b5fdd7f --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity-base.yaml @@ -0,0 +1,6 @@ +outputs: + $replace: + - format: qcow2 +config: + storage: + $include: ./include/storage-grub-verity-base.yaml diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity.yaml new file mode 100644 index 0000000000..03400b8530 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/grub-verity.yaml @@ -0,0 +1,8 @@ +outputs: + $replace: + - format: cosi +config: + storage: + $include: ./include/storage-grub-verity.yaml + os: + hostname: trident-vm-verity-testimg diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/grub.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/grub.yaml new file mode 100644 index 0000000000..0024e36cef --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/grub.yaml @@ -0,0 +1,57 @@ +config: + storage: + $include: ./include/storage-grub-update.yaml + os: + bootloader: + resetType: hard-reset + hostname: trident-vm-testimg + selinux: + mode: disabled + kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=tty1 + - console=ttyS0 + - rd.debug + - loglevel=6 + - log_buf_len=1M + - systemd.journald.forward_to_console=1 + packages: + install: + - curl + - dnf + - efibootmgr + - grub2-efi-binary-noprefix + - iproute + - iptables + - jq + - lsof + - netplan + - openssh-server + - trident-service + - vim + - netplan + remove: + - grub2-efi-binary + services: + enable: + - trident + - tridentd.socket + users: + - name: testuser + sshPublicKeyPaths: + - base/files/id_rsa.pub + secondaryGroups: + - wheel + additionalFiles: + - source: base/files/sshd-keygen.service + destination: /usr/lib/systemd/system/sshd-keygen.service + - source: base/files/99-dhcp-eth0.network + destination: /etc/systemd/network/99-dhcp-eth0.network + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel + - source: ../common/files/use-grpc-client-commit.conf + destination: /etc/systemd/system/trident.service.d/override.conf + scripts: + postCustomization: + - $include: ./include/grub-scripts.yaml diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/root-verity+usr-verity+acl-agent+acl-agent-base.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/root-verity+usr-verity+acl-agent+acl-agent-base.yaml new file mode 100644 index 0000000000..ac986e4ae7 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/root-verity+usr-verity+acl-agent+acl-agent-base.yaml @@ -0,0 +1,8 @@ +config: + os: + $include: ./include/uki-verity-os-common.yaml + scripts: + postCustomization: + - $include: ./include/uki-verity-scripts.yaml + previewFeatures: + - uki diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/root-verity.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/root-verity.yaml new file mode 100644 index 0000000000..153202d9c1 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/root-verity.yaml @@ -0,0 +1,29 @@ +outputs: + $replace: + - format: cosi + - format: qcow2 + +config: + storage: + $include: ./include/storage-root-verity.yaml + os: + hostname: trident-vm-root-verity-testimg + additionalFiles: + - source: base/files/99-dhcp-eth0.network + destination: /etc/systemd/network/99-dhcp-eth0.network + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel + overlays: + - mountPoint: /etc + lowerDirs: + - /etc + upperDir: /var/lib/overlays/etc/upper + workDir: /var/lib/overlays/etc/work + mountDependencies: + - /var + isInitrdOverlay: true + services: + enable: + - kdump + - trident + - tridentd.socket diff --git a/tests/tailor-images/trident-vm-testimage/by-scenario/usr-verity.yaml b/tests/tailor-images/trident-vm-testimage/by-scenario/usr-verity.yaml new file mode 100644 index 0000000000..c631ce4892 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/by-scenario/usr-verity.yaml @@ -0,0 +1,19 @@ +outputs: + $replace: + - format: cosi + - format: qcow2 +config: + storage: + $include: ./include/storage-usr-verity.yaml + os: + hostname: trident-vm-usr-verity-testimg + additionalFiles: + - source: base/files/99-dhcp-eth0.network + destination: /etc/systemd/network/99-dhcp-eth0.network + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel + services: + enable: + - kdump + - trident + - tridentd.socket diff --git a/tests/tailor-images/trident-vm-testimage/image.yaml b/tests/tailor-images/trident-vm-testimage/image.yaml new file mode 100644 index 0000000000..e99dd1136a --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/image.yaml @@ -0,0 +1,25 @@ +name: trident-vm-testimage + +matrix: + arch: [amd64, arm64] + scenario: [grub, grub-base, grub-verity, grub-verity-base, root-verity, usr-verity, acl-agent, acl-agent-base, grub-verity-azure, grub-verity-azure-base] + +selectors: + exclude: + - { arch: arm64, scenario: [grub-base, grub-verity-base, root-verity, usr-verity, acl-agent, acl-agent-base, grub-verity-azure, grub-verity-azure-base] } + +base: + ref: qemu_guest + +outputs: + - format: cosi + +rpmSources: + - ../../../bin/RPMS + - ../../../artifacts/rpm-overrides + +extraDependencies: + - ./base + - ../common + +config: {} diff --git a/tests/tailor-images/trident-vm-testimage/include/grub-base-scripts.yaml b/tests/tailor-images/trident-vm-testimage/include/grub-base-scripts.yaml new file mode 100644 index 0000000000..b5dfd7894f --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/grub-base-scripts.yaml @@ -0,0 +1,6 @@ +- path: base/scripts/post-install.sh +- path: base/scripts/update-host-status.sh +- path: base/scripts/prepare-update-config.sh +- path: base/scripts/ssh-move-host-keys.sh +- path: base/scripts/create-ssh-dirs.sh +- path: base/scripts/duid-type-to-link-layer.sh diff --git a/tests/tailor-images/trident-vm-testimage/include/grub-scripts.yaml b/tests/tailor-images/trident-vm-testimage/include/grub-scripts.yaml new file mode 100644 index 0000000000..cefd80ff51 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/grub-scripts.yaml @@ -0,0 +1,4 @@ +- path: base/scripts/post-install.sh +- path: base/scripts/ssh-move-host-keys.sh +- path: base/scripts/duid-type-to-link-layer.sh +- path: base/scripts/update-os-release.sh diff --git a/tests/tailor-images/trident-vm-testimage/include/grub-verity-base-os-common.yaml b/tests/tailor-images/trident-vm-testimage/include/grub-verity-base-os-common.yaml new file mode 100644 index 0000000000..7aceedaad1 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/grub-verity-base-os-common.yaml @@ -0,0 +1,53 @@ +bootloader: + resetType: hard-reset +hostname: trident-vm-verity-testimg +selinux: + mode: disabled +kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=tty1 + - console=ttyS0 + - rd.debug + - loglevel=6 + - log_buf_len=1M + - systemd.journald.forward_to_console=1 +packages: + install: + - device-mapper + - dnf + - efibootmgr + - grub2-efi-binary + - iproute + - iptables + - jq + - kexec-tools + - lvm2 + - openssh-server + - systemd-udev + - trident + - veritysetup + - vim + - netplan +additionalFiles: + - source: base/files/etc-mount-mic.service + destination: /etc/systemd/system/etc-mount.service + - source: base/files/etc-mount.sh + destination: /usr/local/bin/etc-mount.sh + - source: base/files/sshd-keygen.service + destination: /usr/lib/systemd/system/sshd-keygen.service + - source: base/files/99-dhcp-eth0.network + destination: /etc/systemd/network/99-dhcp-eth0.network + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel +services: + enable: + - etc-mount + - kdump + - tridentd.socket +users: + - name: testuser + sshPublicKeyPaths: + - base/files/id_rsa.pub + secondaryGroups: + - wheel diff --git a/tests/tailor-images/trident-vm-testimage/include/grub-verity-base-scripts.yaml b/tests/tailor-images/trident-vm-testimage/include/grub-verity-base-scripts.yaml new file mode 100644 index 0000000000..d43975b098 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/grub-verity-base-scripts.yaml @@ -0,0 +1,7 @@ +- path: base/scripts/post-install.sh +- path: base/scripts/create-rw-overlay-dirs.sh +- path: base/scripts/update-host-status.sh +- path: base/scripts/prepare-update-config-verity.sh +- path: base/scripts/ssh-move-host-keys.sh +- path: base/scripts/create-ssh-dirs.sh +- path: base/scripts/duid-type-to-link-layer.sh diff --git a/tests/tailor-images/trident-vm-testimage/include/grub-verity-os-common.yaml b/tests/tailor-images/trident-vm-testimage/include/grub-verity-os-common.yaml new file mode 100644 index 0000000000..93bf5ba13f --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/grub-verity-os-common.yaml @@ -0,0 +1,59 @@ +bootloader: + resetType: hard-reset +selinux: + mode: disabled +kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=tty1 + - console=ttyS0 + - rd.debug + - loglevel=6 + - log_buf_len=1M + - systemd.journald.forward_to_console=1 +packages: + install: + - curl + - device-mapper + - dnf + - dracut-overlayfs + - efibootmgr + - grub2-efi-binary-noprefix + - iproute + - iptables + - jq + - kexec-tools + - lsof + - lvm2 + - netplan + - openssh-server + - systemd-udev + - trident-service + - veritysetup + - vim + - netplan + remove: + - grub2-efi-binary +additionalFiles: + - source: base/files/etc-mount.service + destination: /etc/systemd/system/etc-mount.service + - source: base/files/etc-mount.sh + destination: /usr/local/bin/etc-mount.sh + - source: ../common/files/sudoers-wheel + destination: /etc/sudoers.d/wheel + - source: base/files/99-dhcp-eth0.network + destination: /etc/systemd/network/99-dhcp-eth0.network + - source: ../common/files/use-grpc-client-commit.conf + destination: /etc/systemd/system/trident.service.d/override.conf +services: + enable: + - etc-mount + - kdump + - trident + - tridentd.socket +users: + - name: testuser + sshPublicKeyPaths: + - base/files/id_rsa.pub + secondaryGroups: + - wheel diff --git a/tests/tailor-images/trident-vm-testimage/include/grub-verity-scripts.yaml b/tests/tailor-images/trident-vm-testimage/include/grub-verity-scripts.yaml new file mode 100644 index 0000000000..db0dca3e4c --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/grub-verity-scripts.yaml @@ -0,0 +1,4 @@ +- path: base/scripts/post-install.sh +- path: base/scripts/ssh-move-host-keys.sh +- path: base/scripts/update-os-release.sh +- path: base/scripts/duid-type-to-link-layer.sh diff --git a/tests/tailor-images/trident-vm-testimage/include/storage-acl-agent.yaml b/tests/tailor-images/trident-vm-testimage/include/storage-acl-agent.yaml new file mode 100644 index 0000000000..82632328f0 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/storage-acl-agent.yaml @@ -0,0 +1,101 @@ +bootType: efi +disks: + - partitionTableType: gpt + partitions: + - id: esp + type: esp + label: esp + size: 512M + - id: boot-a + size: 256M + - id: boot-b + size: 256M + - id: root-a + size: 4G + - id: root-b + size: 4G + - id: usr-a + size: 1G + - id: usr-b + size: 1G + - id: usr-hash-a + size: 128M + - id: usr-hash-b + size: 128M + - id: trident + label: trident + size: 512M + - id: trident-acl-agent + label: trident-acl-agent + size: 128M + - id: kubelet + label: kubelet + size: 128M + - id: etc-trident + label: etc-trident + size: 128M + - id: home + label: home + size: 1G + - id: srv + label: srv + size: 128M +verity: + - id: usrverity + name: usr + dataDeviceId: usr-a + hashDeviceId: usr-hash-a + dataDeviceMountIdType: uuid + hashDeviceMountIdType: uuid +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + idType: part-label + path: /boot/efi + options: umask=0077 + - deviceId: boot-a + type: ext4 + mountPoint: + idType: uuid + path: /boot + - deviceId: usrverity + type: ext4 + mountPoint: + path: /usr + options: defaults,ro + - deviceId: root-a + type: ext4 + mountPoint: + idType: uuid + path: / + - deviceId: trident + type: ext4 + mountPoint: + idType: part-label + path: /var/lib/trident + - deviceId: trident-acl-agent + type: ext4 + mountPoint: + idType: part-label + path: /var/lib/trident-acl-agent + - deviceId: kubelet + type: ext4 + mountPoint: + idType: part-label + path: /var/lib/kubelet + - deviceId: etc-trident + type: ext4 + mountPoint: + idType: part-label + path: /etc/trident + - deviceId: home + type: ext4 + mountPoint: + idType: part-label + path: /home + - deviceId: srv + type: ext4 + mountPoint: + idType: part-label + path: /srv diff --git a/tests/tailor-images/trident-vm-testimage/include/storage-grub-update.yaml b/tests/tailor-images/trident-vm-testimage/include/storage-grub-update.yaml new file mode 100644 index 0000000000..affd3e7254 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/storage-grub-update.yaml @@ -0,0 +1,19 @@ +bootType: efi +disks: + - partitionTableType: gpt + maxSize: 5G + partitions: + - id: esp + type: esp + size: 8M + - id: root + size: 4G +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: root + type: ext4 + mountPoint: / diff --git a/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity-azure-base.yaml b/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity-azure-base.yaml new file mode 100644 index 0000000000..a5b0e7e571 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity-azure-base.yaml @@ -0,0 +1,70 @@ +bootType: efi +disks: + - partitionTableType: gpt + maxSize: 15G + partitions: + - id: esp + type: esp + size: 16M + - id: boot-a + size: 256M + - id: boot-b + size: 256M + - id: root-a + size: 4G + - id: root-b + size: 4G + - id: root-hash-a + size: 128M + - id: root-hash-b + size: 128M + - id: var-a + size: 1G + - id: var-b + size: 1G + - id: trident-overlay-a + size: 32M + - id: trident-overlay-b + size: 32M + - id: trident + size: 512M + - id: home + size: 1G + - id: srv + size: grow +verity: + - id: rootverity + name: root + dataDeviceId: root-a + hashDeviceId: root-hash-a + dataDeviceMountIdType: uuid + hashDeviceMountIdType: uuid +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: boot-a + type: ext4 + mountPoint: /boot + - deviceId: rootverity + type: ext4 + mountPoint: + path: / + options: defaults,ro + - deviceId: var-a + type: ext4 + mountPoint: /var + - deviceId: trident-overlay-a + type: ext4 + mountPoint: /var/lib/trident-overlay + - deviceId: trident + type: ext4 + mountPoint: /var/lib/trident + - deviceId: home + type: ext4 + mountPoint: /home + - deviceId: srv + type: ext4 + mountPoint: /srv diff --git a/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity-azure.yaml b/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity-azure.yaml new file mode 100644 index 0000000000..d5ea899248 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity-azure.yaml @@ -0,0 +1,57 @@ +bootType: efi +disks: + - partitionTableType: gpt + # Azure's fixed update-image layout needs a bounded disk size (unlike the generic grub-verity + # scenario, which has none) -- matches the legacy image's `updateimg-grub-verity-azure.yaml`. + maxSize: 7G + partitions: + - id: esp + type: esp + size: 8M + - id: boot + size: 256M + - id: root + size: 4G + - id: root-hash + size: 128M + - id: var + size: 1G + - id: trident-overlay + size: 32M + - id: srv + size: 1G + - id: home + size: 32M +verity: + - id: rootverity + name: root + dataDeviceId: root + hashDeviceId: root-hash + dataDeviceMountIdType: uuid + hashDeviceMountIdType: uuid +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: boot + type: ext4 + mountPoint: /boot + - deviceId: rootverity + type: ext4 + mountPoint: + path: / + options: defaults,ro + - deviceId: var + type: ext4 + mountPoint: /var + - deviceId: trident-overlay + type: ext4 + mountPoint: /var/lib/trident-overlay + - deviceId: srv + type: ext4 + mountPoint: /srv + - deviceId: home + type: ext4 + mountPoint: /home diff --git a/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity-base.yaml b/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity-base.yaml new file mode 100644 index 0000000000..28bcd41bb0 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity-base.yaml @@ -0,0 +1,69 @@ +bootType: efi +disks: + - partitionTableType: gpt + partitions: + - id: esp + type: esp + size: 512M + - id: boot-a + size: 256M + - id: boot-b + size: 256M + - id: root-a + size: 4G + - id: root-b + size: 4G + - id: root-hash-a + size: 128M + - id: root-hash-b + size: 128M + - id: var-a + size: 1G + - id: var-b + size: 1G + - id: trident-overlay-a + size: 32M + - id: trident-overlay-b + size: 32M + - id: trident + size: 512M + - id: home + size: 1G + - id: srv + size: 128M +verity: + - id: rootverity + name: root + dataDeviceId: root-a + hashDeviceId: root-hash-a + dataDeviceMountIdType: uuid + hashDeviceMountIdType: uuid +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: boot-a + type: ext4 + mountPoint: /boot + - deviceId: rootverity + type: ext4 + mountPoint: + path: / + options: defaults,ro + - deviceId: var-a + type: ext4 + mountPoint: /var + - deviceId: trident-overlay-a + type: ext4 + mountPoint: /var/lib/trident-overlay + - deviceId: trident + type: ext4 + mountPoint: /var/lib/trident + - deviceId: home + type: ext4 + mountPoint: /home + - deviceId: srv + type: ext4 + mountPoint: /srv diff --git a/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity.yaml b/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity.yaml new file mode 100644 index 0000000000..fbe1d145ea --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/storage-grub-verity.yaml @@ -0,0 +1,54 @@ +bootType: efi +disks: + - partitionTableType: gpt + partitions: + - id: esp + type: esp + size: 8M + - id: boot + size: 256M + - id: root + size: 4G + - id: root-hash + size: 128M + - id: var + size: 1G + - id: trident-overlay + size: 32M + - id: srv + size: 1G + - id: home + size: 32M +verity: + - id: rootverity + name: root + dataDeviceId: root + hashDeviceId: root-hash + dataDeviceMountIdType: uuid + hashDeviceMountIdType: uuid +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: boot + type: ext4 + mountPoint: /boot + - deviceId: rootverity + type: ext4 + mountPoint: + path: / + options: defaults,ro + - deviceId: var + type: ext4 + mountPoint: /var + - deviceId: trident-overlay + type: ext4 + mountPoint: /var/lib/trident-overlay + - deviceId: srv + type: ext4 + mountPoint: /srv + - deviceId: home + type: ext4 + mountPoint: /home diff --git a/tests/tailor-images/trident-vm-testimage/include/storage-grub.yaml b/tests/tailor-images/trident-vm-testimage/include/storage-grub.yaml new file mode 100644 index 0000000000..f36e7979e8 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/storage-grub.yaml @@ -0,0 +1,31 @@ +bootType: efi +disks: + - partitionTableType: gpt + maxSize: 10G + partitions: + - id: esp + type: esp + size: 16M + - id: root-a + size: 4G + - id: root-b + size: 4G + - id: trident + size: 1G + - id: srv + size: grow +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + path: /boot/efi + options: umask=0077 + - deviceId: root-a + type: ext4 + mountPoint: / + - deviceId: trident + type: ext4 + mountPoint: /var/lib/trident + - deviceId: srv + type: ext4 + mountPoint: /srv diff --git a/tests/tailor-images/trident-vm-testimage/include/storage-root-verity.yaml b/tests/tailor-images/trident-vm-testimage/include/storage-root-verity.yaml new file mode 100644 index 0000000000..e5e3cbd74d --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/storage-root-verity.yaml @@ -0,0 +1,78 @@ +bootType: efi +disks: + - partitionTableType: gpt + partitions: + - id: esp + type: esp + label: esp + size: 512M + - id: boot-a + size: 256M + - id: boot-b + size: 256M + - id: root-a + size: 4G + - id: root-b + size: 4G + - id: root-hash-a + size: 128M + - id: root-hash-b + size: 128M + - id: var-a + size: 1G + - id: var-b + size: 1G + - id: trident + label: trident + size: 512M + - id: home + label: home + size: 1G + - id: srv + label: srv + size: 128M +verity: + - id: rootverity + name: root + dataDeviceId: root-a + hashDeviceId: root-hash-a + dataDeviceMountIdType: uuid + hashDeviceMountIdType: uuid +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + idType: part-label + path: /boot/efi + options: umask=0077 + - deviceId: boot-a + type: ext4 + mountPoint: + idType: uuid + path: /boot + - deviceId: rootverity + type: ext4 + mountPoint: + path: / + options: defaults,ro + - deviceId: var-a + type: ext4 + mountPoint: + idType: uuid + path: /var + options: defaults,x-initrd.mount + - deviceId: trident + type: ext4 + mountPoint: + idType: part-label + path: /var/lib/trident + - deviceId: home + type: ext4 + mountPoint: + idType: part-label + path: /home + - deviceId: srv + type: ext4 + mountPoint: + idType: part-label + path: /srv diff --git a/tests/tailor-images/trident-vm-testimage/include/storage-usr-verity.yaml b/tests/tailor-images/trident-vm-testimage/include/storage-usr-verity.yaml new file mode 100644 index 0000000000..a380c8eb59 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/storage-usr-verity.yaml @@ -0,0 +1,77 @@ +bootType: efi +disks: + - partitionTableType: gpt + partitions: + - id: esp + type: esp + label: esp + size: 512M + - id: boot-a + size: 256M + - id: boot-b + size: 256M + - id: root-a + size: 4G + - id: root-b + size: 4G + - id: usr-a + size: 1G + - id: usr-b + size: 1G + - id: usr-hash-a + size: 128M + - id: usr-hash-b + size: 128M + - id: trident + label: trident + size: 512M + - id: home + label: home + size: 1G + - id: srv + label: srv + size: 128M +verity: + - id: usrverity + name: usr + dataDeviceId: usr-a + hashDeviceId: usr-hash-a + dataDeviceMountIdType: uuid + hashDeviceMountIdType: uuid +filesystems: + - deviceId: esp + type: fat32 + mountPoint: + idType: part-label + path: /boot/efi + options: umask=0077 + - deviceId: boot-a + type: ext4 + mountPoint: + idType: uuid + path: /boot + - deviceId: usrverity + type: ext4 + mountPoint: + path: /usr + options: defaults,ro + - deviceId: root-a + type: ext4 + mountPoint: + idType: uuid + path: / + - deviceId: trident + type: ext4 + mountPoint: + idType: part-label + path: /var/lib/trident + - deviceId: home + type: ext4 + mountPoint: + idType: part-label + path: /home + - deviceId: srv + type: ext4 + mountPoint: + idType: part-label + path: /srv diff --git a/tests/tailor-images/trident-vm-testimage/include/uki-verity-os-common.yaml b/tests/tailor-images/trident-vm-testimage/include/uki-verity-os-common.yaml new file mode 100644 index 0000000000..6f277178bd --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/uki-verity-os-common.yaml @@ -0,0 +1,41 @@ +bootloader: + resetType: hard-reset +selinux: + mode: disabled +uki: + mode: create +kernelCommandLine: + extraCommandLine: + - console=tty0 + - console=tty1 + - console=ttyS0 + - rd.debug + - loglevel=6 + - log_buf_len=1M + - systemd.journald.forward_to_console=1 + - rd.hostonly=0 +packages: + install: + - device-mapper + - dnf + - efibootmgr + - iproute + - iptables + - jq + - kexec-tools + - lvm2 + - openssh-server + - systemd-boot + - systemd-udev + - trident-service + - veritysetup + - vim + - netplan + remove: + - grub2-efi-binary +users: + - name: testuser + sshPublicKeyPaths: + - base/files/id_rsa.pub + secondaryGroups: + - wheel diff --git a/tests/tailor-images/trident-vm-testimage/include/uki-verity-scripts.yaml b/tests/tailor-images/trident-vm-testimage/include/uki-verity-scripts.yaml new file mode 100644 index 0000000000..89bf812cc3 --- /dev/null +++ b/tests/tailor-images/trident-vm-testimage/include/uki-verity-scripts.yaml @@ -0,0 +1,6 @@ +- path: base/scripts/post-install.sh +- path: base/scripts/update-host-status.sh +- path: base/scripts/prepare-update-config-verity.sh + arguments: + - uki +- path: base/scripts/duid-type-to-link-layer.sh