summaryrefslogtreecommitdiff
path: root/contrib/redhat
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-02-26 20:38:53 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-02-26 20:38:53 +0000
commit0c100870ac1c271a0a3d65099777af312e71d865 (patch)
tree3259fad4d7103dc544b2419339ba6f86eb189703 /contrib/redhat
parent7603b2d244c9aeacacc78b246594bea011c48bd7 (diff)
- (bal) sshd.init support for all Redhat release. Patch by Jim Knoble
<jmknoble@jmknoble.cx>
Diffstat (limited to 'contrib/redhat')
-rw-r--r--contrib/redhat/openssh.spec1
-rwxr-xr-xcontrib/redhat/sshd.init48
-rwxr-xr-xcontrib/redhat/sshd.init-5.x62
3 files changed, 40 insertions, 71 deletions
diff --git a/contrib/redhat/openssh.spec b/contrib/redhat/openssh.spec
index f23468de2..9583a1ce7 100644
--- a/contrib/redhat/openssh.spec
+++ b/contrib/redhat/openssh.spec
@@ -60,7 +60,6 @@ Summary: OpenSSH Secure Shell protocol server (sshd)
60Group: System Environment/Daemons 60Group: System Environment/Daemons
61Obsoletes: ssh-server 61Obsoletes: ssh-server
62PreReq: openssh = %{version}-%{release}, chkconfig >= 0.9 62PreReq: openssh = %{version}-%{release}, chkconfig >= 0.9
63Requires: initscripts >= 4.16
64%if %{redhat7} 63%if %{redhat7}
65Requires: /etc/pam.d/system-auth 64Requires: /etc/pam.d/system-auth
66%endif 65%endif
diff --git a/contrib/redhat/sshd.init b/contrib/redhat/sshd.init
index a4df64276..c9c1c7bfe 100755
--- a/contrib/redhat/sshd.init
+++ b/contrib/redhat/sshd.init
@@ -23,14 +23,46 @@ RSA1_KEY=/etc/ssh/ssh_host_key
23RSA_KEY=/etc/ssh/ssh_host_rsa_key 23RSA_KEY=/etc/ssh/ssh_host_rsa_key
24DSA_KEY=/etc/ssh/ssh_host_dsa_key 24DSA_KEY=/etc/ssh/ssh_host_dsa_key
25PID_FILE=/var/run/sshd.pid 25PID_FILE=/var/run/sshd.pid
26my_success() {
27 local msg
28 if [ $# -gt 1 ]; then
29 msg="$2"
30 else
31 msg="done"
32 fi
33 case "`type -type success`" in
34 function)
35 success "$1"
36 ;;
37 *)
38 echo -n "${msg}"
39 ;;
40 esac
41}
42my_failure() {
43 local msg
44 if [ $# -gt 1 ]; then
45 msg="$2"
46 else
47 msg="FAILED"
48 fi
49 case "`type -type failure`" in
50 function)
51 failure "$1"
52 ;;
53 *)
54 echo -n "${msg}"
55 ;;
56 esac
57}
26do_rsa1_keygen() { 58do_rsa1_keygen() {
27 if ! test -f $RSA1_KEY ; then 59 if ! test -f $RSA1_KEY ; then
28 echo -n "Generating SSH1 RSA host key: " 60 echo -n "Generating SSH1 RSA host key: "
29 if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then 61 if $KEYGEN -q -t rsa1 -f $RSA1_KEY -C '' -N '' >&/dev/null; then
30 success "RSA1 key generation" 62 my_success "RSA1 key generation"
31 echo 63 echo
32 else 64 else
33 failure "RSA1 key generation" 65 my_failure "RSA1 key generation"
34 echo 66 echo
35 exit 1 67 exit 1
36 fi 68 fi
@@ -40,10 +72,10 @@ do_rsa_keygen() {
40 if ! test -f $RSA_KEY ; then 72 if ! test -f $RSA_KEY ; then
41 echo -n "Generating SSH2 RSA host key: " 73 echo -n "Generating SSH2 RSA host key: "
42 if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then 74 if $KEYGEN -q -t rsa -f $RSA_KEY -C '' -N '' >&/dev/null; then
43 success "RSA key generation" 75 my_success "RSA key generation"
44 echo 76 echo
45 else 77 else
46 failure "RSA key generation" 78 my_failure "RSA key generation"
47 echo 79 echo
48 exit 1 80 exit 1
49 fi 81 fi
@@ -53,10 +85,10 @@ do_dsa_keygen() {
53 if ! test -f $DSA_KEY ; then 85 if ! test -f $DSA_KEY ; then
54 echo -n "Generating SSH2 DSA host key: " 86 echo -n "Generating SSH2 DSA host key: "
55 if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then 87 if $KEYGEN -q -t dsa -f $DSA_KEY -C '' -N '' >&/dev/null; then
56 success "DSA key generation" 88 my_success "DSA key generation"
57 echo 89 echo
58 else 90 else
59 failure "DSA key generation" 91 my_failure "DSA key generation"
60 echo 92 echo
61 exit 1 93 exit 1
62 fi 94 fi
@@ -75,10 +107,10 @@ case "$1" in
75 sshd 107 sshd
76 RETVAL=$? 108 RETVAL=$?
77 if [ "$RETVAL" = "0" ] ; then 109 if [ "$RETVAL" = "0" ] ; then
78 success "sshd startup" 110 my_success "sshd startup" "sshd"
79 touch /var/lock/subsys/sshd 111 touch /var/lock/subsys/sshd
80 else 112 else
81 failure "sshd startup" 113 my_failure "sshd startup" ""
82 fi 114 fi
83 fi 115 fi
84 echo 116 echo
diff --git a/contrib/redhat/sshd.init-5.x b/contrib/redhat/sshd.init-5.x
deleted file mode 100755
index 51ded9338..000000000
--- a/contrib/redhat/sshd.init-5.x
+++ /dev/null
@@ -1,62 +0,0 @@
1#!/bin/bash
2
3# Init file for OpenSSH server daemon
4#
5# chkconfig: 2345 55 25
6# description: OpenSSH server daemon
7#
8# processname: sshd
9# config: /etc/ssh/ssh_host_key
10# config: /etc/ssh/ssh_host_key.pub
11# config: /etc/ssh/ssh_random_seed
12# config: /etc/ssh/sshd_config
13# pidfile: /var/run/sshd.pid
14
15# source function library
16. /etc/rc.d/init.d/functions
17
18RETVAL=0
19
20case "$1" in
21 start)
22 echo -n "Starting sshd: "
23 if [ ! -f /var/run/sshd.pid ] ; then
24 case "`type -type success`" in
25 function)
26 /usr/sbin/sshd && success "sshd startup" || failure "sshd startup"
27 RETVAL=$?
28 ;;
29 *)
30 /usr/sbin/sshd && echo -n "sshd "
31 RETVAL=$?
32 ;;
33 esac
34 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd
35 fi
36 echo
37 ;;
38 stop)
39 echo -n "Shutting down sshd: "
40 if [ -f /var/run/sshd.pid ] ; then
41 killproc sshd
42 RETVAL=$?
43 fi
44 echo
45 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sshd
46 ;;
47 restart)
48 $0 stop
49 $0 start
50 RETVAL=$?
51 ;;
52 status)
53 status sshd
54 RETVAL=$?
55 ;;
56 *)
57 echo "Usage: sshd {start|stop|restart|status}"
58 exit 1
59 ;;
60esac
61
62exit $RETVAL