summaryrefslogtreecommitdiff
path: root/openssh/files
diff options
context:
space:
mode:
authorBruno Randolf <br1@subnet.at>2004-10-01 16:22:55 +0000
committerBruno Randolf <br1@subnet.at>2004-10-01 16:22:55 +0000
commit4c1c43c4c107e0770be7ddb18378aacadc578717 (patch)
tree9d17d482954601ffa67cec64c7fa48323bbbcb22 /openssh/files
parent903d65b2f67a60eb01420bce896fdbcc1dc6318c (diff)
Merge bk://openembedded@openembedded.bkbits.net/packages
into null.(none):/data/mtx/oe/oe.write/packages 2004/10/01 18:20:45+02:00 (none)!br1 linux-libc-headers: a better fix for mipsel include problems 2004/10/01 18:18:25+02:00 (none)!br1 mtx-1 and nylon updates 2004/10/01 18:14:35+02:00 (none)!br1 some initscripts fixes BKrev: 415d845fhRK74UgeJN_R5X4UKLTUKQ
Diffstat (limited to 'openssh/files')
-rw-r--r--openssh/files/init88
1 files changed, 88 insertions, 0 deletions
diff --git a/openssh/files/init b/openssh/files/init
index e69de29bb2..b16cbd61a6 100644
--- a/openssh/files/init
+++ b/openssh/files/init
@@ -0,0 +1,88 @@
+#! /bin/sh
+set -e
+
+# /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon
+
+test -x /usr/sbin/sshd || exit 0
+( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
+
+if test -f /etc/default/ssh; then
+ . /etc/default/ssh
+fi
+
+check_for_no_start() {
+ # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
+ if [ -e /etc/ssh/sshd_not_to_be_run ]; then
+ echo "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
+ exit 0
+ fi
+}
+
+check_privsep_dir() {
+ # Create the PrivSep empty dir if necessary
+ if [ ! -d /var/run/sshd ]; then
+ mkdir /var/run/sshd
+ chmod 0755 /var/run/sshd
+ fi
+}
+
+check_config() {
+ /usr/sbin/sshd -t || exit 1
+}
+
+check_keys() {
+ # create keys if necessary
+ if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
+ echo " generating ssh RSA key..."
+ ssh-keygen -q -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa
+ fi
+ if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
+ echo " generating ssh DSA key..."
+ ssh-keygen -q -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa
+ fi
+}
+
+export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
+
+case "$1" in
+ start)
+ check_for_no_start
+ echo "Starting OpenBSD Secure Shell server: sshd"
+ check_keys
+ check_privsep_dir
+ start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS
+ echo "done."
+ ;;
+ stop)
+ echo -n "Stopping OpenBSD Secure Shell server: sshd"
+ start-stop-daemon -K -x /usr/sbin/sshd
+ echo "."
+ ;;
+
+ reload|force-reload)
+ check_for_no_start
+ check_keys
+ check_config
+ echo -n "Reloading OpenBSD Secure Shell server's configuration"
+ start-stop-daemon -K -s 1 -x /usr/sbin/sshd
+ echo "."
+ ;;
+
+ restart)
+ check_keys
+ check_config
+ echo -n "Restarting OpenBSD Secure Shell server: sshd"
+ start-stop-daemon -K -x /usr/sbin/sshd
+ check_for_no_start
+ check_privsep_dir
+ sleep 2
+ start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS
+ echo "."
+ ;;
+
+ *)
+ echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
+ exit 1
+esac
+
+exit 0