From: Alexander Kanavin Date: Wed, 30 Sep 2015 12:53:18 +0000 (+0300) Subject: dropbear: fix key generation when systemd is in use and rootfs is readonly X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~28691 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e13fc603aa86219bf15e355ca9ea9275308cca5;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git dropbear: fix key generation when systemd is in use and rootfs is readonly Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- diff --git a/meta/recipes-core/dropbear/dropbear/dropbear@.service b/meta/recipes-core/dropbear/dropbear/dropbear@.service index 6fe9942090d..b420bcddcb1 100644 --- a/meta/recipes-core/dropbear/dropbear/dropbear@.service +++ b/meta/recipes-core/dropbear/dropbear/dropbear@.service @@ -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 diff --git a/meta/recipes-core/dropbear/dropbear/dropbearkey.service b/meta/recipes-core/dropbear/dropbear/dropbearkey.service index ccc21d5ccac..c49053d57c7 100644 --- a/meta/recipes-core/dropbear/dropbear/dropbearkey.service +++ b/meta/recipes-core/dropbear/dropbear/dropbearkey.service @@ -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