updated on Sat Jan 21 20:03:50 UTC 2012
[aur-mirror.git] / obfuscated-openssh / sshd
blob539c197eafe2c188cb22b6656e2814d01a5e21ef
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 #. /opt/etc/conf.d/sshd
6 SSHD_ARGS=""
7 PIDFILE=/var/run/obsshd.pid
8 PID=$(cat $PIDFILE 2>/dev/null)
9 if ! readlink -q /proc/$PID/exe | grep -q '^/opt/ob-openssh/sbin/sshd'; then
10 PID=
11 rm $PIDFILE 2>/dev/null
14 case "$1" in
15 start)
16 stat_busy 'Starting Secure Shell Daemon'
17 if [ ! -s "/opt/ob-openssh/etc/ssh_host_rsa_key" ]
18 then
19 /opt/ob-openssh/bin/ssh-keygen -t rsa -f /opt/ob-openssh/etc/ssh_host_rsa_key -N ""
21 if [ ! -s "/opt/ob-openssh/etc/ssh_host_dsa_key" ]
22 then
23 /opt/ob-openssh/bin/ssh-keygen -t dsa -f /opt/ob-openssh/etc/ssh_host_dsa_key -N ""
24 fi
26 [[ -d /var/empty ]] || mkdir -p /var/empty
27 [[ -z $PID ]] && /opt/ob-openssh/sbin/sshd $SSHD_ARGS
28 if [[ $? -gt 0 ]]; then
29 stat_fail
30 else
31 add_daemon sshd
32 stat_done
35 stop)
36 stat_busy 'Stopping Secure Shell Daemon'
37 [[ ! -z $PID ]] && kill $PID &> /dev/null
38 if [[ $? -gt 0 ]]; then
39 stat_fail
40 else
41 rm_daemon sshd
42 stat_done
45 restart)
46 $0 stop
47 sleep 1
48 $0 start
51 echo "usage: $0 {start|stop|restart}"
52 esac
53 exit 0