fix(wizard): 出厂默认账号(pi/无密码或 raspberry)才进 OOBE,改名或改密码视为已配置 - #151
Merged
Conversation
pi-gen bakes FIRST_USER_PASS=raspberry into every image, so the password-presence check added for bug #227 also fired on factory-fresh devices and skipped the OOBE entirely, leaving Wi-Fi and timezone unconfigured. Verify the stored hash against the baked pi/raspberry default via crypt_r(3) (the stored hash doubles as the setting string, per crypt(5)), and treat a match as an unconfigured account. Imager-provisioned devices store a user-chosen password (or a renamed user), never match, and keep skipping the wizard. crypt failures return a "*" token that can never compare equal, so errors safely count as configured. Links LaunchWizard against libcrypt (libcrypt.so.1, already in the image) and covers the new policy branch in the unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
A renamed UID 1000 user can only come from Imager/userconf provisioning, so skip the OOBE even when no password was set (e.g. SSH-keys-only customisation). The factory marker now triggers the wizard only in exact factory state: default username with no password or the baked default. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
8-17 的 #147 用"有没有密码"判断设备是否被 Imager 配置过,但 pi-gen 在每个镜像里烙死了
FIRST_USER_PASS=raspberry,导致裸刷出厂镜像也被判成"已配置",OOBE 永远不出现(只剩键盘引导),WiFi/时区无人配置。判定规则(出厂标记存在时)
设置里的"重新运行引导"(re-arm 标记)不受影响,永远进。
实现
crypt_r("raspberry", hash),输出逐字节相同即匹配。同一 trixie 生成与校验,算法必然支持;libxcrypt 失败时返回*failure token,手册保证永不等于 setting,故任何错误都安全地判成"已配置"。first_boot_policy拆出factory_username/factory_credentials两个纯信号,policy 保持可单测。libcrypt.so.1(镜像自带,无新增依赖)。验证
launch_wizard_core_tests全绿,覆盖上表所有分支readelf -d确认NEEDED libcrypt.so.1crypt_r:yescrypt 哈希正确密码 MATCH、错误密码 NO-MATCH、锁定账户 NO-MATCH效果
已流出的 8-17 镜像只需升级 launcher deb 即可修复,无需重新出镜像;产测依赖的 pi/raspberry SSH 登录保持可用。
Made with Cursor