diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2012-11-28 00:32:24 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2012-11-28 00:32:24 +0000 |
commit | 18c11c3bca25a2ed2d2f051d4d75d6ac9cb37777 (patch) | |
tree | 673032e93b636fdaaa77157b2fc31b42bee570f1 /net-misc/openssh | |
parent | Version bump, bug #444680. (diff) | |
download | gentoo-2-18c11c3bca25a2ed2d2f051d4d75d6ac9cb37777.tar.gz gentoo-2-18c11c3bca25a2ed2d2f051d4d75d6ac9cb37777.tar.bz2 gentoo-2-18c11c3bca25a2ed2d2f051d4d75d6ac9cb37777.zip |
Cleanup of sshd init.d in preparation for bug #410541. local keyword is not POSIX sh.
(Portage version: 2.2.0_alpha142/cvs/Linux x86_64, unsigned Manifest commit)
Diffstat (limited to 'net-misc/openssh')
-rw-r--r-- | net-misc/openssh/ChangeLog | 6 | ||||
-rwxr-xr-x | net-misc/openssh/files/sshd.rc6.4 | 85 |
2 files changed, 90 insertions, 1 deletions
diff --git a/net-misc/openssh/ChangeLog b/net-misc/openssh/ChangeLog index 617ddb0c9cec..a250219dfbaf 100644 --- a/net-misc/openssh/ChangeLog +++ b/net-misc/openssh/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for net-misc/openssh # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/ChangeLog,v 1.459 2012/11/19 20:43:34 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/ChangeLog,v 1.460 2012/11/28 00:32:24 robbat2 Exp $ + + 28 Nov 2012; Robin H. Johnson <robbat2@gentoo.org> +files/sshd.rc6.4: + Cleanup of sshd init.d in preparation for bug #410541. local keyword is not + POSIX sh. 19 Nov 2012; Mike Frysinger <vapier@gentoo.org> openssh-6.1_p1.ebuild: Only show ecdsa key message when upgrading from older versions, and drop diff --git a/net-misc/openssh/files/sshd.rc6.4 b/net-misc/openssh/files/sshd.rc6.4 new file mode 100755 index 000000000000..d636327f2287 --- /dev/null +++ b/net-misc/openssh/files/sshd.rc6.4 @@ -0,0 +1,85 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6.4,v 1.1 2012/11/28 00:32:24 robbat2 Exp $ + +extra_commands="checkconfig gen_keys" +extra_started_commands="reload" + +depend() { + use logger dns + need net +} + +SSHD_CONFDIR=${SSHD_CONFDIR:-/etc/ssh} +SSHD_PIDFILE=${SSHD_PIDFILE:-/var/run/${SVCNAME}.pid} +SSHD_BINARY=${SSHD_BINARY:-/usr/sbin/sshd} + +checkconfig() { + if [ ! -d /var/empty ] ; then + mkdir -p /var/empty || return 1 + fi + + if [ ! -e "${SSHD_CONFDIR}"/sshd_config ] ; then + eerror "You need an ${SSHD_CONFDIR}/sshd_config file to run sshd" + eerror "There is a sample file in /usr/share/doc/openssh" + return 1 + fi + + gen_keys || return 1 + + [ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \ + && SSHD_OPTS="${SSHD_OPTS} -o PidFile=${SSHD_PIDFILE}" + [ "${SSHD_CONFDIR}" != "/etc/ssh" ] \ + && SSHD_OPTS="${SSHD_OPTS} -f ${SSHD_CONFDIR}/sshd_config" + + "${SSHD_BINARY}" -t ${SSHD_OPTS} || return 1 +} + +gen_key() { + keytype=$1 + [ $# -eq 1 ] && ks="${keytype}_" + key="${SSHD_CONFDIR}/ssh_host_${ks}key" + if [ ! -e "${key}" ] ; then + ebegin "Generating ${keytype} host key" + ssh-keygen -t ${keytype} -f "${key}" -N '' + eend $? || return $? + fi +} + +gen_keys() { + if egrep -q '^[[:space:]]*Protocol[[:space:]]+.*1' "${SSHD_CONFDIR}"/sshd_config ; then + gen_key rsa1 "" || return 1 + fi + gen_key dsa && gen_key rsa && gen_key ecdsa + return $? +} + +start() { + checkconfig || return 1 + + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --exec "${SSHD_BINARY}" \ + --pidfile "${SSHD_PIDFILE}" \ + -- ${SSHD_OPTS} + eend $? +} + +stop() { + if [ "${RC_CMD}" = "restart" ] ; then + checkconfig || return 1 + fi + + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec "${SSHD_BINARY}" \ + --pidfile "${SSHD_PIDFILE}" --quiet + eend $? +} + +reload() { + checkconfig || return 1 + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal HUP \ + --exec "${SSHD_BINARY}" --pidfile "${SSHD_PIDFILE}" + eend $? +} |