root/pcbsdTCR/sshcreate.sh

Revision 10, 2.0 KB (checked in by andrei, 2 years ago)

First ThinClientRelease? source files import

Line 
1#!/bin/sh
2#
3
4name="sshd"
5command="/usr/sbin/${name}"
6keygen_cmd="sshd_keygen"
7start_precmd="sshd_precmd"
8pidfile="/var/run/${name}.pid"
9extra_commands="keygen reload"
10tee="../customroot/etc/ssh"
11timeout=300
12
13seeded=`sysctl -n kern.random.sys.seeded 2>/dev/null`
14        if [ "${seeded}" != "" ] ; then
15                warn "Setting entropy source to blocking mode."
16                echo "===================================================="
17                echo "Type a full screenful of random junk to unblock"
18                echo "it and remember to finish with <enter>. This will"
19                echo "timeout in ${timeout} seconds, but waiting for"
20                echo "the timeout without typing junk may make the"
21                echo "entropy source deliver predictable output."
22                echo ""
23                echo "Just hit <enter> for fast+insecure startup."
24                echo "===================================================="
25                sysctl kern.random.sys.seeded=0 2>/dev/null
26                read -t ${timeout} junk
27                echo "${junk}" `sysctl -a` `date` > /dev/random
28        fi
29
30
31umask 022
32        # Can't do anything if ssh is not installed
33        [ -x /usr/bin/ssh-keygen ] || {
34                warn "/usr/bin/ssh-keygen does not exist."
35                return 1
36        }
37
38        if [ -f ${tee}/ssh_host_key ]; then
39                echo "You already have an RSA host key" \
40                    "in ${tee}/ssh_host_key"
41                echo "Skipping protocol version 1 RSA Key Generation"
42        else
43                /usr/bin/ssh-keygen -t rsa1 -b 1024 \
44                    -f ${tee}/ssh_host_key -N ''
45        fi
46
47        if [ -f ${tee}/ssh_host_dsa_key ]; then
48                echo "You already have a DSA host key" \
49                    "in ${tee}/ssh_host_dsa_key"
50                echo "Skipping protocol version 2 DSA Key Generation"
51        else
52                /usr/bin/ssh-keygen -t dsa -f ${tee}/ssh_host_dsa_key -N ''
53        fi
54
55        if [ -f ${tee}/ssh_host_rsa_key ]; then
56                echo "You already have a RSA host key" \
57                    "in ${tee}/ssh_host_rsa_key"
58                echo "Skipping protocol version 2 RSA Key Generation"
59        else
60                /usr/bin/ssh-keygen -t rsa -f ${tee}/ssh_host_rsa_key -N ''
61        fi
Note: See TracBrowser for help on using the browser.