add systemd units to openssh

This commit is contained in:
Samir 2012-06-24 13:34:29 +00:00
parent 1850922117
commit 3a31928598
6 changed files with 75 additions and 4 deletions

View File

@ -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
}
# 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
}

19
openssh/sshd.service Normal file
View File

@ -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).

10
openssh/sshd.socket Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Conflicts=sshd.service
[Socket]
ListenStream=22
Accept=yes
[Install]
WantedBy=sockets.target
Also=sshdgenkeys.service

8
openssh/sshd@.service Normal file
View File

@ -0,0 +1,8 @@
[Unit]
Description=OpenSSH Per-Connection Daemon
After=sshdgenkeys.service
[Service]
ExecStart=-/usr/sbin/sshd -i
StandardInput=socket
StandardError=syslog

View File

@ -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

1
openssh/tmpfiles.d Normal file
View File

@ -0,0 +1 @@
d /var/empty 0755 root root -