Skip to content

Commit

Permalink
Fail on trailing new lines in disk-encryption keys
Browse files Browse the repository at this point in the history
  • Loading branch information
phaer committed Aug 16, 2023
1 parent f1a76e0 commit 0bff847
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/nixos-anywhere.sh
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@ SSH
fi
for path in "${!disk_encryption_keys[@]}"; do
step "Uploading ${disk_encryption_keys[$path]} to $path"
[[ "${disk_encryption_keys[$path]}" != *"\n" ]] || {
echo "ERROR: disk encryption key $path ends in a trailing newline,
this would make it impossible to enter this key at a prompt."
exit 1
}
ssh_ "umask 077; cat > $path" <"${disk_encryption_keys[$path]}"
done

Expand Down

0 comments on commit 0bff847

Please sign in to comment.