2008-07-23 09:15:38 +00:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
2009-02-24 18:49:27 +00:00
|
|
|
# $Id: ssh-host-keygen,v 1.3 2008/11/03 09:16:01 djm Exp $
|
2008-07-23 09:15:38 +00:00
|
|
|
#
|
|
|
|
# This script is normally run only *once* for a given host
|
|
|
|
# (in a given period of time) -- on updates/upgrades/recovery
|
|
|
|
# the ssh_host_key* files _should_ be retained! Otherwise false
|
|
|
|
# "man-in-the-middle-attack" alerts will frighten unsuspecting
|
|
|
|
# clients...
|
|
|
|
|
|
|
|
keydir=@sysconfdir@
|
|
|
|
keygen=@sshkeygen@
|
|
|
|
|
|
|
|
if [ -f $keydir/ssh_host_key -o \
|
|
|
|
-f $keydir/ssh_host_key.pub ]; then
|
|
|
|
echo "You already have an SSH1 RSA host key in $keydir/ssh_host_key."
|
|
|
|
else
|
2009-02-24 18:49:27 +00:00
|
|
|
echo "Generating SSH1 RSA host key."
|
|
|
|
$keygen -t rsa1 -f $keydir/ssh_host_key -C '' -N ''
|
2008-07-23 09:15:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f $keydir/ssh_host_rsa_key -o \
|
|
|
|
-f $keydir/ssh_host_rsa_key.pub ]; then
|
|
|
|
echo "You already have an SSH2 RSA host key in $keydir/ssh_host_rsa_key."
|
|
|
|
else
|
2009-02-24 18:49:27 +00:00
|
|
|
echo "Generating SSH2 RSA host key."
|
|
|
|
$keygen -t rsa -f $keydir/ssh_host_rsa_key -C '' -N ''
|
2008-07-23 09:15:38 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f $keydir/ssh_host_dsa_key -o \
|
|
|
|
-f $keydir/ssh_host_dsa_key.pub ]; then
|
|
|
|
echo "You already have an SSH2 DSA host key in $keydir/ssh_host_dsa_key."
|
|
|
|
else
|
|
|
|
echo "Generating SSH2 DSA host key."
|
|
|
|
$keygen -t dsa -f $keydir/ssh_host_dsa_key -C '' -N ''
|
|
|
|
fi
|