openssh: Remove temporary keys before generating new ones

Key generation may wait for user input, due to the existence of
temporary keys resulting from power interruption in the first boot.
This prevents users from login via ssh.

(From OE-Core rev: dceba60f817c61d36868a2def642fc4164ff53ab)

Signed-off-by: Asfak Rahman <asfakr@outlook.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 3196249a6917a32491be56e70bbf26d3b9818e0e)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Asfak Rahman
2021-06-25 09:52:57 +03:00
committed by Richard Purdie
parent 2566c5c5e0
commit 7de4219733

View File

@@ -6,6 +6,7 @@ generate_key() {
local DIR="$(dirname "$FILE")"
mkdir -p "$DIR"
rm -f ${FILE}.tmp
ssh-keygen -q -f "${FILE}.tmp" -N '' -t $TYPE
# Atomically rename file public key