diskimage-builder/elements/runtime-ssh-host-keys/cleanup.d/90-remove-ssh-host-keys

16 lines
320 B
Plaintext
Raw Normal View History

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# Cloud images shouldn't have ssh host keys baked
# in so that they are regenerated on first boot and
# are unique.
if [ -d $TARGET_ROOT/etc/ssh ] ; then
sudo find $TARGET_ROOT/etc/ssh -name 'ssh_host*' -type f -delete
fi