From 82ddbd1c525ec5e4bda3eec666c2c25f38200e75 Mon Sep 17 00:00:00 2001 From: Mathieu Le Marec - Pasquet Date: Mon, 4 Nov 2024 20:48:00 +0100 Subject: [PATCH] safebelt check --- entry.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/entry.sh b/entry.sh index c3d2318..d04a39e 100755 --- a/entry.sh +++ b/entry.sh @@ -31,10 +31,12 @@ execute_hooks() { print_fingerprints() { local BASE_DIR=${1-'/etc/ssh'} for item in dsa rsa ecdsa ed25519;do - echo ">>> Fingerprints for ${item} host key" - ssh-keygen -E md5 -lf ${BASE_DIR}/ssh_host_${item}_key - ssh-keygen -E sha256 -lf ${BASE_DIR}/ssh_host_${item}_key - ssh-keygen -E sha512 -lf ${BASE_DIR}/ssh_host_${item}_key + if [ -e ${BASE_DIR}/ssh_host_${item}_key ];then + echo ">>> Fingerprints for ${item} host key" + ssh-keygen -E md5 -lf ${BASE_DIR}/ssh_host_${item}_key + ssh-keygen -E sha256 -lf ${BASE_DIR}/ssh_host_${item}_key + ssh-keygen -E sha512 -lf ${BASE_DIR}/ssh_host_${item}_key + fi done }