diff options
Diffstat (limited to 'contrib/redhat/sshd.init')
-rwxr-xr-x | contrib/redhat/sshd.init | 48 |
1 files changed, 40 insertions, 8 deletions
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 | |||
23 | RSA_KEY=/etc/ssh/ssh_host_rsa_key | 23 | RSA_KEY=/etc/ssh/ssh_host_rsa_key |
24 | DSA_KEY=/etc/ssh/ssh_host_dsa_key | 24 | DSA_KEY=/etc/ssh/ssh_host_dsa_key |
25 | PID_FILE=/var/run/sshd.pid | 25 | PID_FILE=/var/run/sshd.pid |
26 | my_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 | } | ||
42 | my_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 | } | ||
26 | do_rsa1_keygen() { | 58 | do_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 |