summaryrefslogtreecommitdiff
path: root/contrib/caldera/ssh-host-keygen
blob: 28a97b9b48a2b3812aed0da76d9caeff9d0a5890 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/sh
#
# $Id: ssh-host-keygen,v 1.1 2001/04/27 05:50:50 tim Exp $
#
# 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
  echo "Generating 1024 bit SSH1 RSA host key."
  $keygen -b 1024 -t rsa1 -f $keydir/ssh_host_key -C '' -N ''
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
  echo "Generating 1024 bit SSH2 RSA host key."
  $keygen -b 1024 -t rsa -f $keydir/ssh_host_rsa_key -C '' -N ''
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