Patchwork [3/5] openssh: fixes for systemd

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Jan. 17, 2014, 6:46 a.m.
Message ID <6c4a7d97d851239671854c5f4522859fa9d3e8e1.1389941136.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/65013/
State New
Headers show

Comments

Qi.Chen@windriver.com - Jan. 17, 2014, 6:46 a.m.
This patch contains a few fixes for the systemd unit files of openssh.
The fixes use the same unit files in Fedora 20 as a reference.

1) Remove sshdgenkeys.service and sshd@.service from SYSTEMD_SERVICE.
2) Fix the dependency and logic of sshdgenkeys.service.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../openssh/openssh-6.4p1/sshd.socket              |    1 -
 .../openssh/openssh-6.4p1/sshd@.service            |    1 +
 .../openssh/openssh-6.4p1/sshdgenkeys.service      |    8 ++++----
 meta/recipes-connectivity/openssh/openssh_6.4p1.bb |    4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

Patch

diff --git a/meta/recipes-connectivity/openssh/openssh-6.4p1/sshd.socket b/meta/recipes-connectivity/openssh/openssh-6.4p1/sshd.socket
index d19ab2a..12c39b2 100644
--- a/meta/recipes-connectivity/openssh/openssh-6.4p1/sshd.socket
+++ b/meta/recipes-connectivity/openssh/openssh-6.4p1/sshd.socket
@@ -8,4 +8,3 @@  Accept=yes
 
 [Install]
 WantedBy=sockets.target
-Also=sshdgenkeys.service
diff --git a/meta/recipes-connectivity/openssh/openssh-6.4p1/sshd@.service b/meta/recipes-connectivity/openssh/openssh-6.4p1/sshd@.service
index 64e009f..4eda659 100644
--- a/meta/recipes-connectivity/openssh/openssh-6.4p1/sshd@.service
+++ b/meta/recipes-connectivity/openssh/openssh-6.4p1/sshd@.service
@@ -1,5 +1,6 @@ 
 [Unit]
 Description=OpenSSH Per-Connection Daemon
+Wants=sshdgenkeys.service
 After=sshdgenkeys.service
 
 [Service]
diff --git a/meta/recipes-connectivity/openssh/openssh-6.4p1/sshdgenkeys.service b/meta/recipes-connectivity/openssh/openssh-6.4p1/sshdgenkeys.service
index 2fd8a9a..c21d70b 100644
--- a/meta/recipes-connectivity/openssh/openssh-6.4p1/sshdgenkeys.service
+++ b/meta/recipes-connectivity/openssh/openssh-6.4p1/sshdgenkeys.service
@@ -1,10 +1,10 @@ 
 [Unit]
-Description=SSH Key Generation
+Description=OpenSSH Key Generation
+ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key
+ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key
+ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key
 
 [Service]
 ExecStart=@BINDIR@/ssh-keygen -A
 Type=oneshot
 RemainAfterExit=yes
-
-[Install]
-WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/openssh/openssh_6.4p1.bb b/meta/recipes-connectivity/openssh/openssh_6.4p1.bb
index c61d16f..1f78566 100644
--- a/meta/recipes-connectivity/openssh/openssh_6.4p1.bb
+++ b/meta/recipes-connectivity/openssh/openssh_6.4p1.bb
@@ -44,7 +44,7 @@  INITSCRIPT_NAME_${PN}-sshd = "sshd"
 INITSCRIPT_PARAMS_${PN}-sshd = "defaults 9"
 
 SYSTEMD_PACKAGES = "${PN}-sshd"
-SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket sshd@.service sshdgenkeys.service"
+SYSTEMD_SERVICE_${PN}-sshd = "sshd.socket"
 
 PACKAGECONFIG ??= "tcp-wrappers"
 PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,,tcp-wrappers"
@@ -114,7 +114,7 @@  ALLOW_EMPTY_${PN} = "1"
 PACKAGES =+ "${PN}-keygen ${PN}-scp ${PN}-ssh ${PN}-sshd ${PN}-sftp ${PN}-misc ${PN}-sftp-server"
 FILES_${PN}-scp = "${bindir}/scp.${BPN}"
 FILES_${PN}-ssh = "${bindir}/ssh.${BPN} ${sysconfdir}/ssh/ssh_config"
-FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd"
+FILES_${PN}-sshd = "${sbindir}/sshd ${sysconfdir}/init.d/sshd ${systemd_unitdir}/system"
 FILES_${PN}-sshd += "${sysconfdir}/ssh/moduli ${sysconfdir}/ssh/sshd_config ${sysconfdir}/ssh/sshd_config_readonly ${sysconfdir}/default/volatiles/99_sshd"
 FILES_${PN}-sftp = "${bindir}/sftp"
 FILES_${PN}-sftp-server = "${libexecdir}/sftp-server"