fix(chv-guest): seed user-data 不再自带 runcmd,防顶掉镜像钩子
sync-test 首轮实测:seed 的 runcmd 整体替换了镜像 /etc/cloud/cloud.cfg.d/99-chv-sync.cfg 的 runcmd(cloud-init 不跨配置类型合并,merge_how 救不了 conf.d),chv-sync boot 钩子静默不跑、启动 clone 没跑。 - hostkeys.build_seed_user_data 不再发 runcmd;chmod 600 已由 write_files 0600 保证;sshd 重启搬到镜像自己的 runcmd(cloud-final,sshd 首次启动之后)。 - build.sh:99-chv-sync.cfg 的 runcmd 增加 restart ssh 一行(在 chv-sync boot 之前)。 - README §5 同步硬性要求;回归测试 2 项(无 runcmd、 带 secret 仍单 write_files 列表无 runcmd)。 - 针对性 147 项全过(test_chv_to10/gaps/secfix/fix/ arch95plus)。 本地提交,未推未部署。
This commit is contained in:
1 parent
cbd5ab7c0b
commit
67ca0b86cd
4 files changed
+71
-10
No files matched your search
+8
-1
@@ -83,7 +83,14 @@ KVM;全量模式在无 /dev/kvm 的机器上第一步就明确退出
|
||||
- 装 cloud-init 且支持 NoCloud seed(seed 磁盘(CIDATA ISO,feat-chv-fix 起挂进 VmConfig
|
||||
第二块只读盘)由执行器在 VM 启动前生成,含 meta-data 与 user-data);
|
||||
- 首启时先应用 seed 再启动 sshd,seed 里的 user-data
|
||||
把该 VM 的 host key 对写进 /etc/ssh/ 并重启 sshd;
|
||||
把该 VM 的 host key 对写进 /etc/ssh/(write_files,
|
||||
0600);seed 里绝不能带 `runcmd:`——user-data 的
|
||||
runcmd 会整体替换镜像 `/etc/cloud/cloud.cfg.d/` 里
|
||||
的 runcmd(cloud-init 不跨配置类型合并),旧版 seed
|
||||
的 restart ssh 两行就这样顶掉了 `99-chv-sync.cfg`
|
||||
的 `chv-sync boot` 钩子(sync-test 首轮实测);sshd
|
||||
重启由镜像自己的 runcmd(`99-chv-sync.cfg`,cloud-final
|
||||
阶段)做,见 `cloud/chv/hostkeys.py` 根因禁令;
|
||||
- 镜像里已钉死 `ssh_deletekeys: false`(build.sh 已写),首启
|
||||
不得无条件重新生成 host key——重生成会使预置的 known_hosts
|
||||
立即失效,SSH 钉死直接拒绝,这是设计,不是 bug;无预置 key
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ VC_ARGS=(-a "$OUT/disk.raw"
|
||||
--copy-in "$REPO_DIR/cloud:/app/"
|
||||
--copy-in "$SCRIPT_DIR/chv-sync.sh:/usr/local/bin/"
|
||||
--run-command 'mv /usr/local/bin/chv-sync.sh /usr/local/bin/chv-sync && chmod +x /usr/local/bin/chv-sync'
|
||||
--run-command 'printf "runcmd:\n - /usr/local/bin/chv-sync boot >>/var/log/chv-sync.log 2>&1 || true\n" > /etc/cloud/cloud.cfg.d/99-chv-sync.cfg'
|
||||
--run-command 'printf "runcmd:\n - systemctl restart ssh || service ssh restart || true\n - /usr/local/bin/chv-sync boot >>/var/log/chv-sync.log 2>&1 || true\n" > /etc/cloud/cloud.cfg.d/99-chv-sync.cfg'
|
||||
--run-command 'git config --system user.name chv && git config --system user.email chv@localhost && git config --system credential.helper store && git config --system init.defaultBranch main'
|
||||
--run-command "$GT_INSTALL_CMD"
|
||||
--run-command '/usr/local/bin/gt version > /app/guest-versions-gt.txt'
|
||||
|
||||
Reference in new issue
Block a user