]> code.ossystems Code Review - openembedded-core.git/commitdiff
dropbear: fix key generation when systemd is in use and rootfs is readonly
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>
Wed, 30 Sep 2015 12:53:18 +0000 (15:53 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 1 Oct 2015 06:40:36 +0000 (07:40 +0100)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/dropbear/dropbear/dropbear@.service
meta/recipes-core/dropbear/dropbear/dropbearkey.service

index 6fe9942090d7bb6139761d10b3201122c935443f..b420bcddcb11640644f31e6e03385c25f1351eac 100644 (file)
@@ -4,8 +4,9 @@ Wants=dropbearkey.service
 After=syslog.target dropbearkey.service
 
 [Service]
+Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
 EnvironmentFile=-/etc/default/dropbear
-ExecStart=-@SBINDIR@/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key $DROPBEAR_EXTRA_ARGS
+ExecStart=-@SBINDIR@/dropbear -i -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key $DROPBEAR_EXTRA_ARGS
 ExecReload=@BASE_BINDIR@/kill -HUP $MAINPID
 StandardInput=socket
 KillMode=process
index ccc21d5ccace9beb42495cdf3953430c3ef6ee05..c49053d57c7f190c6b57086c912b818c1a30d02c 100644 (file)
@@ -1,8 +1,13 @@
 [Unit]
 Description=SSH Key Generation
-ConditionPathExists=|!/etc/dropbear/dropbear_rsa_host_key
+RequiresMountsFor=/var /var/lib
+ConditionPathExists=!/etc/dropbear/dropbear_rsa_host_key
+ConditionPathExists=!/var/lib/dropbear/dropbear_rsa_host_key
 
 [Service]
+Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
+EnvironmentFile=-/etc/default/dropbear
 Type=oneshot
-ExecStart=@SBINDIR@/dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
+ExecStart=@BASE_BINDIR@/mkdir -p ${DROPBEAR_RSAKEY_DIR}
+ExecStart=@SBINDIR@/dropbearkey -t rsa -f ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key
 RemainAfterExit=yes