install: root SSH tmpfiles.d drop-in is labeled etc_runtime_t instead of etc_t
维护者通常 1 天内回复
评估
调研方向
从 crates/lib/src/install/osconfig.rs 和 crates/lib/src/lsm.rs 中 atomic_replace_labeled 的查找开始;将此调用方与其他传入相对于目标根目录的路径的调用方进行比较。检查安装代码如何确定 /etc/tmpfiles.d/bootc-root-ssh.conf 的标签。安装后的 drop-in 被解析为 etc_t 而不是 etc_runtime_t,即表示完成。
由索引模型根据 Issue 内容生成。
描述
bootc install --root-ssh-authorized-keys writes /etc/tmpfiles.d/bootc-root-ssh.conf labeled etc_runtime_t, while the policy expects etc_t for that path. On the installed system, with SELinux enforcing:
# matchpathcon /etc/tmpfiles.d/bootc-root-ssh.conf
/etc/tmpfiles.d/bootc-root-ssh.conf system_u:object_r:etc_t:s0
# restorecon -n -v -R /etc/tmpfiles.d
Would relabel /etc/tmpfiles.d/bootc-root-ssh.conf from system_u:object_r:etc_runtime_t:s0 to system_u:object_r:etc_t:s0
The file already has etc_runtime_t on the disk before first boot, and its parent directory is etc_t. It happens with the ostree backend, and with the composefs backend once #2536 writes the drop-in there. systemd-tmpfiles still reads the file and root key login works, so the visible effect is the relabel.
I saw this with $IMG built by just build from main at 66d4e4d (the centos-bootc stream10 base), installing like this and then booting the disk:
ssh-keygen -t ed25519 -N '' -f k
truncate -s 20G a.raw
podman run --rm --privileged --pid=host --security-opt label=type:unconfined_t \
-v /dev:/dev -v /var/lib/containers:/var/lib/containers -v $PWD:/out $IMG \
bootc install to-disk --via-loopback --filesystem ext4 --generic-image --wipe \
--root-ssh-authorized-keys /out/k.pub /out/a.raw
The code involved is the same in v1.16.13, which quay.io/fedora/fedora-bootc:44 ships.
inject_root_ssh_authorized_keys opens etc/tmpfiles.d and passes the bare file name to atomic_replace_labeled (osconfig.rs L39-L47), which looks up the label for that name joined onto / (lsm.rs L664-L668). The policy is asked about /bootc-root-ssh.conf, which its /[^/]+ rule maps to etc_runtime_t. The other callers pass a path relative to the target root, so their lookups are right.
I'd expect the drop-in to be labeled for its full path, which gives etc_t.
- 主要语言
- Rust
- 星标
- 2.3k
- 派生
- 230
- 平均合并
- 2 天 19 小时
- 30 天内合并 PR
- 42
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bootc-dev/bootc 的其他 Issue
-
auto-updates fail with `opendir(boot): Operation not permitted` when /boot is a systemd automount that has idled out可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭triaged
难度 2/5 1-3 小时 新手友好度 70/100
bootc-dev/bootc#2402 · 9 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
install: improve error message when systemd-boot is selected without composefs backend可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
-
难度 4/5 1-2 天 新手友好度 49/100
bootc-dev/bootc#2585 · 7 条评论 · 4 个 reaction ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
FavioVazquez/mollify#62 ·
-
难度 2/5 1-3 小时 新手友好度 61/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
fendouai/awesome-deepseek-harness#125 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
rust-embedded/heapless#694 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
维护者通常 1 天内回复