diff options
author | Colin Watson <cjwatson@debian.org> | 2005-05-30 21:44:32 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2005-05-30 21:44:32 +0000 |
commit | a55bd782aa819b7f5ae716de000f19f4f531850e (patch) | |
tree | 12638b19bc0ed9c8d48541d460693ab0fbb58e89 /contrib/solaris/opensshd.in | |
parent | fe9489f7e522f780f3fa5c2f28208124d193398c (diff) | |
parent | 5d05471f6657646d1d6500c7c43134462c407ee6 (diff) |
Import OpenSSH 4.1p1.
Diffstat (limited to 'contrib/solaris/opensshd.in')
-rwxr-xr-x | contrib/solaris/opensshd.in | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/contrib/solaris/opensshd.in b/contrib/solaris/opensshd.in new file mode 100755 index 000000000..50e18deea --- /dev/null +++ b/contrib/solaris/opensshd.in | |||
@@ -0,0 +1,82 @@ | |||
1 | #!/sbin/sh | ||
2 | # Donated code that was put under PD license. | ||
3 | # | ||
4 | # Stripped PRNGd out of it for the time being. | ||
5 | |||
6 | umask 022 | ||
7 | |||
8 | CAT=/usr/bin/cat | ||
9 | KILL=/usr/bin/kill | ||
10 | |||
11 | prefix=%%openSSHDir%% | ||
12 | etcdir=%%configDir%% | ||
13 | piddir=%%pidDir%% | ||
14 | |||
15 | SSHD=$prefix/sbin/sshd | ||
16 | PIDFILE=$piddir/sshd.pid | ||
17 | SSH_KEYGEN=$prefix/bin/ssh-keygen | ||
18 | HOST_KEY_RSA1=$etcdir/ssh_host_key | ||
19 | HOST_KEY_DSA=$etcdir/ssh_host_dsa_key | ||
20 | HOST_KEY_RSA=$etcdir/ssh_host_rsa_key | ||
21 | |||
22 | |||
23 | checkkeys() { | ||
24 | if [ ! -f $HOST_KEY_RSA1 ]; then | ||
25 | ${SSH_KEYGEN} -t rsa1 -f ${HOST_KEY_RSA1} -N "" | ||
26 | fi | ||
27 | if [ ! -f $HOST_KEY_DSA ]; then | ||
28 | ${SSH_KEYGEN} -t dsa -f ${HOST_KEY_DSA} -N "" | ||
29 | fi | ||
30 | if [ ! -f $HOST_KEY_RSA ]; then | ||
31 | ${SSH_KEYGEN} -t rsa -f ${HOST_KEY_RSA} -N "" | ||
32 | fi | ||
33 | } | ||
34 | |||
35 | stop_service() { | ||
36 | if [ -r $PIDFILE -a ! -z ${PIDFILE} ]; then | ||
37 | PID=`${CAT} ${PIDFILE}` | ||
38 | fi | ||
39 | if [ ${PID:=0} -gt 1 -a ! "X$PID" = "X " ]; then | ||
40 | ${KILL} ${PID} | ||
41 | else | ||
42 | echo "Unable to read PID file" | ||
43 | fi | ||
44 | } | ||
45 | |||
46 | start_service() { | ||
47 | # XXX We really should check if the service is already going, but | ||
48 | # XXX we will opt out at this time. - Bal | ||
49 | |||
50 | # Check to see if we have keys that need to be made | ||
51 | checkkeys | ||
52 | |||
53 | # Start SSHD | ||
54 | echo "starting $SSHD... \c" ; $SSHD | ||
55 | |||
56 | sshd_rc=$? | ||
57 | if [ $sshd_rc -ne 0 ]; then | ||
58 | echo "$0: Error ${sshd_rc} starting ${SSHD}... bailing." | ||
59 | exit $sshd_rc | ||
60 | fi | ||
61 | echo done. | ||
62 | } | ||
63 | |||
64 | case $1 in | ||
65 | |||
66 | 'start') | ||
67 | start_service | ||
68 | ;; | ||
69 | |||
70 | 'stop') | ||
71 | stop_service | ||
72 | ;; | ||
73 | |||
74 | 'restart') | ||
75 | stop_service | ||
76 | start_service | ||
77 | ;; | ||
78 | |||
79 | *) | ||
80 | echo "$0: usage: $0 {start|stop|restart}" | ||
81 | ;; | ||
82 | esac | ||