CRUX-ARM :
Home
Home
::
Documentation
::
Download
::
Development
::
Community
::
Ports
::
Packages
::
Bugs
::
Links
::
About
::
Donors
development
/
crossrootfs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1db6ffb
)
openssh: updated sshd script
author
Victor Martinez
<pitillo@ono.com>
Sun, 6 Mar 2016 19:09:52 +0000
(19:09 +0000)
committer
Victor Martinez
<pitillo@ono.com>
Sun, 6 Mar 2016 19:09:52 +0000
(19:09 +0000)
openssh/sshd
patch
|
blob
|
blame
|
history
diff --git
a/openssh/sshd
b/openssh/sshd
index 11a1c26d54d576e272801133b062f6b3bab5e148..7abaf02d8c894c6dfc6b83bdfdf56eddab474c8d 100755
(executable)
--- a/
openssh/sshd
+++ b/
openssh/sshd
@@
-3,37
+3,50
@@
# /etc/rc.d/sshd: start/stop ssh daemon
#
# /etc/rc.d/sshd: start/stop ssh daemon
#
-case $1 in
-start)
- if [ ! -f /etc/ssh/ssh_host_key ]; then
- /usr/bin/ssh-keygen -t rsa1 -N "" -f /etc/ssh/ssh_host_key > /dev/null
+SSD=/sbin/start-stop-daemon
+PROG=/usr/sbin/sshd
+PID=/var/run/sshd.pid
+KEYGEN=/usr/bin/ssh-keygen
+SSHDIR=/etc/ssh
+
+create_keys() {
+ if [ ! -f $SSHDIR/ssh_host_rsa_key ]; then
+ $KEYGEN -q -t rsa -b 2048 -N "" -f $SSHDIR/ssh_host_rsa_key
fi
fi
- if [ ! -f
/etc/ssh/ssh_host_r
sa_key ]; then
- /usr/bin/ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key > /dev/null
+ if [ ! -f
$SSHDIR/ssh_host_d
sa_key ]; then
+ $KEYGEN -q -t dsa -N "" -f $SSHDIR/ssh_host_dsa_key
fi
fi
- if [ ! -f
/etc/ssh/ssh_host_
dsa_key ]; then
- /usr/bin/ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key > /dev/null
+ if [ ! -f
$SSHDIR/ssh_host_ec
dsa_key ]; then
+ $KEYGEN -q -t ecdsa -b 521 -N "" -f $SSHDIR/ssh_host_ecdsa_key
fi
fi
- if [ ! -f
/etc/ssh/ssh_host_ecdsa
_key ]; then
- /usr/bin/ssh-keygen -t ecdsa -N "" -f /etc/ssh/ssh_host_ecdsa_key > /dev/null
+ if [ ! -f
$SSHDIR/ssh_host_ed25519
_key ]; then
+ $KEYGEN -q -t ed25519 -N "" -f $SSHDIR/ssh_host_ed25519_key
fi
fi
- /usr/sbin/sshd
+}
+
+case $1 in
+start)
+ create_keys
+ $SSD --start --pidfile $PID --exec $PROG
;;
stop)
;;
stop)
- if [ -f /var/run/sshd.pid ]; then
- kill $(< /var/run/sshd.pid)
- rm -f /var/run/sshd.pid
- else
- killall -q /usr/sbin/sshd
- fi
+ $SSD --stop --retry 10 --pidfile $PID
;;
restart)
$0 stop
;;
restart)
$0 stop
- sleep 2
$0 start
;;
$0 start
;;
+status)
+ $SSD --status --pidfile $PID
+ case $? in
+ 0) echo "$PROG is running with pid $(cat $PID)" ;;
+ 1) echo "$PROG is not running but the pid file $PID exists" ;;
+ 3) echo "$PROG is not running" ;;
+ 4) echo "Unable to determine the program status" ;;
+ esac
+ ;;
*)
*)
- echo "usage: $0 [start|stop|restart]"
+ echo "usage: $0 [start|stop|restart
|status
]"
;;
esac
;;
esac