Commit 92a5ba6
committed
initrd/gpg: address PR #2158 review comments
- Fix 6 instances of $? clobbered by intervening TRACE_FUNC/DEBUG
calls: capture rc=$? immediately after each DO_WITH_DEBUG gpg
pipeline, check $rc (adds local rc declarations).
- Replace --passphrase-file with --passphrase-fd 3 3< <(...) to
avoid leaking the PIN value through /proc/<pid>/cmdline of the
child echo process (3 sites: factory reset, card identity, import).
- Fix algo_code/bit_len extraction: add head -1 to prevent multi-line
values when multiple keys are present in the backup.
- Fix STATUS_OK on public partition mount: only emit on success.
- Fix gpg_reset_nk3_secret_app: return actual hotp_verification
error code, add local error_code, explicit return 0 for non-NK3.
- Remove incorrect || [ $? -eq 2 ] pattern: gpg --import exit code 2
is a fatal error, not "unchanged".
- Fix pubkey.asc import: check success properly, fall back to keyring
export on failure.
- Fix partition derivation for NVMe/MMC: use [0-9]+$ without (p?)
capture that was removing the p separator.
- Add _luks_cleanup helper called on every error return path to
close LUKS mappings (removed broken EXIT trap).
- Re-run NK3 Secrets app reset with custom PIN when factory reset
is retried from default to custom PIN.
- Add chmod 600 on /tmp/secret/gpg_pin to match existing convention.
- Fix recovery-shell.md: gpg_auth also guards USB/external boot entry
via media-scan.sh.
- Write backup passphrase to /tmp/secret/backup_pass, call mount-usb.sh
with --pass-file instead of --pass to avoid argv leak.
- Add --pass-file option to mount-usb.sh (reads passphrase from file).
- Fix doc/qemu.md: clarify ./qemu_img/ vs ~/Qemu_img/ roles.
Signed-off-by: Thierry Laurion <insurgo@riseup.net>1 parent 606d71d commit 92a5ba6
4 files changed
Lines changed: 153 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
162 | 164 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
168 | 177 | | |
169 | 178 | | |
170 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
0 commit comments