From 3c45cf46060b0932ac874d3cb26752133f39fbae Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 2 Jun 2012 13:31:20 +0200 Subject: [PATCH] openssh: enable systemd socket activation for sshd by default. --- srcpkgs/openssh/files/sshd.socket | 10 ++++++++++ srcpkgs/openssh/files/sshd@.service | 8 ++++++++ srcpkgs/openssh/openssh-client.template | 6 ++---- srcpkgs/openssh/openssh-server.INSTALL | 15 +++++++++++++++ srcpkgs/openssh/openssh-server.template | 16 ++++++++-------- srcpkgs/openssh/template | 8 +++----- 6 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 srcpkgs/openssh/files/sshd.socket create mode 100644 srcpkgs/openssh/files/sshd@.service create mode 100644 srcpkgs/openssh/openssh-server.INSTALL diff --git a/srcpkgs/openssh/files/sshd.socket b/srcpkgs/openssh/files/sshd.socket new file mode 100644 index 00000000000..6a67bfe864b --- /dev/null +++ b/srcpkgs/openssh/files/sshd.socket @@ -0,0 +1,10 @@ +[Unit] +Conflicts=sshd.service + +[Socket] +ListenStream=22 +Accept=yes + +[Install] +WantedBy=sockets.target +Also=sshdgenkeys.service diff --git a/srcpkgs/openssh/files/sshd@.service b/srcpkgs/openssh/files/sshd@.service new file mode 100644 index 00000000000..2fd9b08140a --- /dev/null +++ b/srcpkgs/openssh/files/sshd@.service @@ -0,0 +1,8 @@ +[Unit] +Description=OpenSSH Per-Connection Daemon +After=sshdgenkeys.service + +[Service] +ExecStart=-/usr/sbin/sshd -i +StandardInput=socket +StandardError=syslog diff --git a/srcpkgs/openssh/openssh-client.template b/srcpkgs/openssh/openssh-client.template index abef625eef4..9cc674ea2b9 100644 --- a/srcpkgs/openssh/openssh-client.template +++ b/srcpkgs/openssh/openssh-client.template @@ -1,14 +1,12 @@ # Template file for 'openssh-client'. # -depends="openssh>=6.0p1" +conf_files="/etc/ssh/ssh_config" +depends="openssh>=$version" short_desc="The OpenSSH client" long_desc="${long_desc} This package contains the ${pkgname} client files." -conf_files="/etc/ssh/ssh_config" - - do_install() { for f in scp sftp slogin ssh ssh-add ssh-agent \ ssh-copy-id ssh-keyscan findssl; do diff --git a/srcpkgs/openssh/openssh-server.INSTALL b/srcpkgs/openssh/openssh-server.INSTALL new file mode 100644 index 00000000000..5cf6a5c2a14 --- /dev/null +++ b/srcpkgs/openssh/openssh-server.INSTALL @@ -0,0 +1,15 @@ +case $ACTION in +post) + cat <<_EOF +=========================================================================== +Two systemd services are provided by ${PKGNAME}-${VERSION}: + + - sshd.service (starts a single instance of sshd) + - sshd.socket (per-connection on demand sshd) + +By default we enable the on-demand per-connection daemon, which is lighter +when there are few connections. +=========================================================================== +_EOF + ;; +esac diff --git a/srcpkgs/openssh/openssh-server.template b/srcpkgs/openssh/openssh-server.template index 1167f9aff8b..10e952d0523 100644 --- a/srcpkgs/openssh/openssh-server.template +++ b/srcpkgs/openssh/openssh-server.template @@ -1,15 +1,13 @@ # Template file for 'openssh-server'. # -depends="openssh>=6.0p1" +conf_files="/etc/ssh/sshd_config /etc/pam.d/sshd" +systemd_services="sshd.socket on" +depends="openssh>=$version" short_desc="The OpenSSH server" long_desc="${long_desc} This package contains the ${pkgname} server files." -conf_files="/etc/ssh/sshd_config /etc/pam.d/sshd" -systemd_services="sshd.service on sshdgenkeys.service on" - - do_install() { vmove usr/libexec/sftp-server usr/libexec vmove etc/ssh/sshd_config etc/ssh @@ -19,7 +17,9 @@ do_install() { vmove usr/share/man/man8/${f}.8 usr/share/man/man8 done vmove etc/pam.d etc - vinstall ${FILESDIR}/sshd.service 644 lib/systemd/system - vinstall ${FILESDIR}/sshdgenkeys.service 644 lib/systemd/system - vinstall ${FILESDIR}/sshd.tmpfiles.d 644 usr/lib/tmpfiles.d sshd.conf + vmkdir lib/systemd/system + install -m644 ${FILESDIR}/*.{socket,service} \ + ${DESTDIR}/lib/systemd/system + vinstall ${FILESDIR}/sshd.tmpfiles.d 644 \ + usr/lib/tmpfiles.d sshd.conf } diff --git a/srcpkgs/openssh/template b/srcpkgs/openssh/template index 202cb0e1f05..b84646354dc 100644 --- a/srcpkgs/openssh/template +++ b/srcpkgs/openssh/template @@ -1,6 +1,7 @@ # Template file for 'openssh' pkgname=openssh version=6.0p1 +revision=1 distfiles="ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/$pkgname-$version.tar.gz" build_style=gnu-configure configure_args="--without-tcp-wrappers --datadir=/usr/share/openssh @@ -10,6 +11,8 @@ configure_args="--without-tcp-wrappers --datadir=/usr/share/openssh --with-kerberos5=/usr" depends="shadow" makedepends="perl>=0 zlib-devel openssl-devel pam-devel mit-krb5-devel e2fsprogs-devel" +conf_files="/etc/ssh/moduli" +subpackages="$pkgname-client $pkgname-server" short_desc="The OpenSSH implementation of SSH protocol versions 1 and 2" maintainer="Juan RP " homepage="http://www.openssh.org" @@ -30,11 +33,6 @@ long_desc=" client and server. To make this package useful, you should also install openssh-client, openssh-server, or both." -conf_files="/etc/ssh/moduli" -subpackages="$pkgname-client $pkgname-server" - - - post_install() { vinstall contrib/sshd.pam.generic 644 etc/pam.d sshd vinstall contrib/findssl.sh 755 usr/bin findssl