summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2017-07-03 20:18:18 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-25 14:14:16 +0100
commitae32558a19ae3b3f175365dc0e10fa74a91e28ce (patch)
tree6f5476c59bf2c89c13100f6b2ccf6497bfcf02d2 /meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
parentedcf39820f94c84b29c95a0d7b16b8d36857e87b (diff)
downloadpoky-ae32558a19ae3b3f175365dc0e10fa74a91e28ce.tar.gz
openssh: Fix key generation with systemd
106b59d9 broke SSH host key generation when systemd and a read-only root file system are in use because there isn't a way for systemd to get the optional weak assigment of SYSCONFDIR from /etc/default/sshd and still provide a default value if it is not specified. Instead, move the logic for determining if keys need to be created to a helper script that both the SysV init script and the systemd unit file can reference. This does mean that the systemd unit file can't check for file existence to know if it should start the service, but it wasn't able to do that correctly anyway anymore. This should be a problem since the serivce is only run once per power cycle by systemd, and should exit quickly if the keys already exist (From OE-Core rev: 7e49c5879862253ae1b6a26535d07a2740a95798) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service')
-rw-r--r--meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service16
1 files changed, 1 insertions, 15 deletions
diff --git a/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service b/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
index 148e6ad63a..603c33787f 100644
--- a/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
+++ b/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service
@@ -1,22 +1,8 @@
1[Unit] 1[Unit]
2Description=OpenSSH Key Generation 2Description=OpenSSH Key Generation
3RequiresMountsFor=/var /run 3RequiresMountsFor=/var /run
4ConditionPathExists=!/var/run/ssh/ssh_host_rsa_key
5ConditionPathExists=!/var/run/ssh/ssh_host_dsa_key
6ConditionPathExists=!/var/run/ssh/ssh_host_ecdsa_key
7ConditionPathExists=!/var/run/ssh/ssh_host_ed25519_key
8ConditionPathExists=!/etc/ssh/ssh_host_rsa_key
9ConditionPathExists=!/etc/ssh/ssh_host_dsa_key
10ConditionPathExists=!/etc/ssh/ssh_host_ecdsa_key
11ConditionPathExists=!/etc/ssh/ssh_host_ed25519_key
12 4
13[Service] 5[Service]
14Environment="SYSCONFDIR=/etc/ssh" 6ExecStart=@LIBEXECDIR@/sshd_check_keys
15EnvironmentFile=-/etc/default/ssh
16ExecStart=@BASE_BINDIR@/mkdir -p $SYSCONFDIR
17ExecStart=@BINDIR@/ssh-keygen -q -f ${SYSCONFDIR}/ssh_host_rsa_key -N '' -t rsa
18ExecStart=@BINDIR@/ssh-keygen -q -f ${SYSCONFDIR}/ssh_host_dsa_key -N '' -t dsa
19ExecStart=@BINDIR@/ssh-keygen -q -f ${SYSCONFDIR}/ssh_host_ecdsa_key -N '' -t ecdsa
20ExecStart=@BINDIR@/ssh-keygen -q -f ${SYSCONFDIR}/ssh_host_ed25519_key -N '' -t ed25519
21Type=oneshot 7Type=oneshot
22RemainAfterExit=yes 8RemainAfterExit=yes