3 # Init file for PlanetLab OpenSSH server daemon (copied from standard
4 # sshd init file, minor modifications made).
6 # chkconfig: 2345 55 25
7 # description: PlanetLab OpenSSH server daemon
10 # config: /etc/ssh/ssh_host_key
11 # config: /etc/ssh/ssh_host_key.pub
12 # config: /etc/ssh/ssh_random_seed
13 # config: /etc/ssh/sshd_config
14 # pidfile: /var/run/pl_sshd.pid
16 # source function library
17 . /etc/rc.d/init.d/functions
19 # pull in sysconfig settings
20 [ -f /etc/sysconfig/pl_sshd ] && . /etc/sysconfig/pl_sshd
22 # add the PlanetLab-specific options
23 KEYDIR=/var/pl_sshd/keys
24 OPTIONS="-p 806 -o 'AuthorizedKeysFile $KEYDIR/%u/authorized_keys'"
25 AUTOMOUNT=/usr/sbin/automount
26 AUTOMAP=/etc/auto.pl_sshd
32 # Some functions to make the below more readable
34 RSA1_KEY=/var/local/etc/ssh_host_key
35 RSA_KEY=/var/local/etc/ssh_host_rsa_key
36 DSA_KEY=/var/local/etc/ssh_host_dsa_key
37 PID_FILE=/var/run/pl_sshd.pid
39 do_restart_sanity_check()
43 if [ ! "$RETVAL" = 0 ]; then
44 failure $"Configuration file or keys are invalid"
51 # get pid for our automount process
53 sed -ne "s%^automount(pid\([0-9]*\)) on $KEYDIR type autofs.*%\1%p"`
55 # check if that process is still alive
56 { [ -n "$AUTOPID" ] && ps -p $AUTOPID >/dev/null 2>&1; } || return 1
58 # check if we can actually mount a user dir in the automount dir
59 [ -d "$KEYDIR/root" ] || return 1
64 # make sure the key dir exists and automount is working on it
65 [ -d "$KEYDIR" ] || mkdir -p $KEYDIR
67 { echo "$AUTOMAP not executable"; return 1; }
68 check_automount || $AUTOMOUNT $KEYDIR program $AUTOMAP
70 echo -n $"Starting $prog:"
71 initlog -c "$SSHD $OPTIONS" && success || failure
73 [ "$RETVAL" = 0 ] && touch /var/lock/subsys/pl_sshd
79 check_automount && kill -USR2 $AUTOPID
81 #echo -n $"Stopping $prog:"
83 echo 'you need to kill the port 806 sshd(s) manually'
84 echo 'make sure not to kill the port 22 sshd...'
86 [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/pl_sshd
92 echo -n $"Reloading $prog:"
113 if [ -f /var/lock/subsys/pl_sshd ] ; then
114 do_restart_sanity_check
115 if [ "$RETVAL" = 0 ] ; then
124 check_automount && echo automount running ||
125 echo automount not functioning
130 echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"