Home | History | Annotate | Download | only in caldera
      1 #! /bin/sh
      2 #
      3 # $Id: ssh-host-keygen,v 1.3 2008/11/03 09:16:01 djm Exp $
      4 #
      5 # This script is normally run only *once* for a given host
      6 # (in a given period of time) -- on updates/upgrades/recovery
      7 # the ssh_host_key* files _should_ be retained! Otherwise false
      8 # "man-in-the-middle-attack" alerts will frighten unsuspecting
      9 # clients...
     10 
     11 keydir=@sysconfdir@
     12 keygen=@sshkeygen@
     13 
     14 if [ -f $keydir/ssh_host_key -o \
     15 	     -f $keydir/ssh_host_key.pub ]; then
     16   echo "You already have an SSH1 RSA host key in $keydir/ssh_host_key."
     17 else
     18   echo "Generating SSH1 RSA host key."
     19   $keygen -t rsa1 -f $keydir/ssh_host_key -C '' -N ''
     20 fi
     21 
     22 if [ -f $keydir/ssh_host_rsa_key -o \
     23 	     -f $keydir/ssh_host_rsa_key.pub ]; then
     24   echo "You already have an SSH2 RSA host key in $keydir/ssh_host_rsa_key."
     25 else
     26   echo "Generating SSH2 RSA host key."
     27   $keygen -t rsa -f $keydir/ssh_host_rsa_key -C '' -N ''
     28 fi
     29 
     30 if [ -f $keydir/ssh_host_dsa_key -o \
     31 	     -f $keydir/ssh_host_dsa_key.pub ]; then
     32   echo "You already have an SSH2 DSA host key in $keydir/ssh_host_dsa_key."
     33 else
     34   echo "Generating SSH2 DSA host key."
     35   $keygen -t dsa -f $keydir/ssh_host_dsa_key -C '' -N ''
     36 fi
     37