diff --git a/openssh/PKGBUILD b/openssh/PKGBUILD index 6bb71a9df..889116636 100644 --- a/openssh/PKGBUILD +++ b/openssh/PKGBUILD @@ -6,7 +6,7 @@ pkgname=openssh pkgver=5.9p1 -pkgrel=1 +pkgrel=2 pkgdesc='Free version of the SSH connectivity tools' arch=('i686' 'x86_64') license=('custom:BSD') @@ -16,11 +16,21 @@ depends=('krb5' 'openssl' 'libedit') source=("ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/${pkgname}-${pkgver}.tar.gz" 'sshd.confd' 'sshd.pam' - 'sshd') + 'sshd' + 'sshdgenkeys.service' + 'sshd.service' + 'sshd@.service' + 'sshd.socket' + 'tmpfiles.d') sha1sums=('ac4e0055421e9543f0af5da607a72cf5922dcc56' 'ec102deb69cad7d14f406289d2fc11fee6eddbdd' '07fecd5880b1c4fdd8c94ddb2e89ddce88effdc1' - '6b7f8ebf0c1cc37137a7d9a53447ac8a0ee6a2b5') + '6b7f8ebf0c1cc37137a7d9a53447ac8a0ee6a2b5' + '6c71de2c2ca9622aa8e863acd94b135555e11125' + '83a257b8f6a62237383262cb0e2583e5609ddac0' + 'bd6eae36c7ef9efb7147778baad7858b81f2d660' + 'a30fb5fda6d0143345bae47684edaffb8d0a92a7' + 'b5cf44205e8f4365c00bfbee110d7c0e563627aa') build() { cd "${srcdir}/${pkgname}-${pkgver}" @@ -64,4 +74,9 @@ package() { sed -i -e '/^#ChallengeResponseAuthentication yes$/c ChallengeResponseAuthentication no' \ -e '/^#UsePAM no$/c UsePAM yes' \ "${pkgdir}"/etc/ssh/sshd_config -} \ No newline at end of file + + # install systemd units + install -dm755 "$pkgdir/usr/lib/systemd/system/" + install -m644 "$srcdir"/sshd{{,@,genkeys}.service,.socket} "$pkgdir/usr/lib/systemd/system/" + install -Dm644 "$srcdir"/tmpfiles.d "$pkgdir"/usr/lib/tmpfiles.d/openssh.conf +} diff --git a/openssh/sshd.service b/openssh/sshd.service new file mode 100644 index 000000000..7c8f88372 --- /dev/null +++ b/openssh/sshd.service @@ -0,0 +1,19 @@ +[Unit] +Description=OpenSSH Daemon +After=sshdgenkeys.service + +[Service] +ExecStart=/usr/sbin/sshd -D +ExecReload=/bin/kill -HUP $MAINPID +KillMode=process +Restart=always + +[Install] +WantedBy=multi-user.target +Also=sshdgenkeys.service + +# Note that this is the service file for running a single SSH server for all +# incoming connections, suitable only for systems with a large amount of SSH +# traffic. In almost all other cases it is a better idea to use sshd.socket + +# sshd@.service (i.e. the on-demand spawning version for one instance per +# connection). diff --git a/openssh/sshd.socket b/openssh/sshd.socket new file mode 100644 index 000000000..6a67bfe86 --- /dev/null +++ b/openssh/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/openssh/sshd@.service b/openssh/sshd@.service new file mode 100644 index 000000000..2fd9b0814 --- /dev/null +++ b/openssh/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/openssh/sshdgenkeys.service b/openssh/sshdgenkeys.service new file mode 100644 index 000000000..47c1c3fd6 --- /dev/null +++ b/openssh/sshdgenkeys.service @@ -0,0 +1,18 @@ +[Unit] +Description=SSH Key Generation +ConditionPathExists=|!/etc/ssh/ssh_host_key +ConditionPathExists=|!/etc/ssh/ssh_host_key.pub +ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key +ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key.pub +ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key +ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key.pub +ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key +ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key.pub + +[Service] +ExecStart=/usr/bin/ssh-keygen -A +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/openssh/tmpfiles.d b/openssh/tmpfiles.d new file mode 100644 index 000000000..7c5b26100 --- /dev/null +++ b/openssh/tmpfiles.d @@ -0,0 +1 @@ +d /var/empty 0755 root root -