mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
23 lines
746 B
Bash
23 lines
746 B
Bash
#!/bin/sh
|
|
# This file was created by bootstrap-vz.
|
|
# See https://github.com/andsens/bootstrap-vz/blob/master/LICENSE for
|
|
# legal notices and disclaimers.
|
|
|
|
# Generate ssh host keys if they do not exist.
|
|
# Output the public keys to the console. This allows user to get host
|
|
# keys securely through console log.
|
|
|
|
set -eu
|
|
|
|
prog="$(basename $0)"
|
|
logger="logger -t ${prog}"
|
|
|
|
echo "-----BEGIN SSH HOST KEY FINGERPRINTS-----" | ${logger}
|
|
for key in ecdsa ed25519 rsa; do
|
|
keyfile="/etc/ssh/ssh_host_${key}_key"
|
|
if [ ! -f "${keyfile}" ]; then
|
|
/usr/bin/ssh-keygen -f "${keyfile}" -t "${key}" -C 'host' -N ''
|
|
fi
|
|
/usr/bin/ssh-keygen -l -f "${keyfile}.pub" | ${logger}
|
|
done
|
|
echo "------END SSH HOST KEY FINGERPRINTS------" | ${logger}
|