summaryrefslogtreecommitdiff
path: root/openssh
diff options
context:
space:
mode:
authorJuergen Daubert <jue@jue.li>2015-06-26 11:55:28 +0200
committerJuergen Daubert <jue@jue.li>2015-06-26 11:55:28 +0200
commit23920fffd2ae5b1615e2fb0778fcc3ebcde4dc82 (patch)
tree5464b9c60f75ad129970d26337674587b2890ccb /openssh
parentf5cd52ca5088865297b482b43bdb67c3b82e1bc5 (diff)
downloadcore-23920fffd2ae5b1615e2fb0778fcc3ebcde4dc82.tar.gz
core-23920fffd2ae5b1615e2fb0778fcc3ebcde4dc82.tar.xz
openssh: improved rc script, drop rsa1 key creation
Diffstat (limited to 'openssh')
-rw-r--r--openssh/.md5sum2
-rw-r--r--openssh/Pkgfile2
-rwxr-xr-xopenssh/sshd54
3 files changed, 34 insertions, 24 deletions
diff --git a/openssh/.md5sum b/openssh/.md5sum
index 1c31a07e..7aefe4af 100644
--- a/openssh/.md5sum
+++ b/openssh/.md5sum
@@ -1,2 +1,2 @@
08f72de6751acfbd0892b5f003922701 openssh-6.8p1.tar.gz
-569e2757f9a1fcee7869c986b4c90fdd sshd
+7789cba75dc6c448814ca2e51f0dbf30 sshd
diff --git a/openssh/Pkgfile b/openssh/Pkgfile
index c3df974a..edc1dbf1 100644
--- a/openssh/Pkgfile
+++ b/openssh/Pkgfile
@@ -5,7 +5,7 @@
name=openssh
version=6.8p1
-release=1
+release=2
source=(ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$name-$version.tar.gz sshd)
build() {
diff --git a/openssh/sshd b/openssh/sshd
index 57189a66..7abaf02d 100755
--- a/openssh/sshd
+++ b/openssh/sshd
@@ -3,40 +3,50 @@
# /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
- fi
- if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
- /usr/bin/ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_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
- 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_dsa_key ]; then
+ $KEYGEN -q -t dsa -N "" -f $SSHDIR/ssh_host_dsa_key
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_ecdsa_key ]; then
+ $KEYGEN -q -t ecdsa -b 521 -N "" -f $SSHDIR/ssh_host_ecdsa_key
fi
- if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then
- /usr/bin/ssh-keygen -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key > /dev/null
+ if [ ! -f $SSHDIR/ssh_host_ed25519_key ]; then
+ $KEYGEN -q -t ed25519 -N "" -f $SSHDIR/ssh_host_ed25519_key
fi
- /usr/sbin/sshd
+}
+
+case $1 in
+start)
+ create_keys
+ $SSD --start --pidfile $PID --exec $PROG
;;
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
- sleep 2
$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

Generated by cgit