#!/bin/bash

. /var/lib/autoyast-cc/libcc

KEYLEN=2048

ret=0
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
	cc_echo "Generating /etc/ssh/ssh_host_rsa_key with $KEYLEN bits."
	cc_exec_log ssh-keygen -t rsa -b $KEYLEN -f /etc/ssh/ssh_host_rsa_key -N '' || {
		ret=$?
		cc_echo "Cannot generate RSA host key"
		# we do not exit here as we still try to generate the other host key
	}
else
	cc_echo "RSA key file found - leaving it untouched"
fi

# TODO: Add DSA key gen here once FIPS186-3 DSA is supported.
#       The DSA key currently is generated by the start script.

cc_exit $ret
