Commit 842edb0e authored by Guido Gunther's avatar Guido Gunther
Browse files

Regenarate keys if empty

If the system crashes on startup the keys might end up as empty
files. Recover in that case by regenerating the keys.

Closes: image-builder!30
parent dd4dbc2b
Pipeline #55583 passed with stage
in 46 seconds
......@@ -43,8 +43,9 @@ create_key() {
shift
if echo "$hostkeys" | grep -x "$file" >/dev/null && \
[ ! -f "$file" ] ; then
[ ! -s "$file" ] ; then
printf "%s" "$msg"
[ ! -f "$file" ] || rm -f "$file"
ssh-keygen -q -f "$file" -N '' "$@"
echo
if command -v restorecon >/dev/null 2>&1; then
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment