dropbear: Allow root login fix

Message ID AS8PR02MB8392C950253DEB9B054726B9F0A59@AS8PR02MB8392.eurprd02.prod.outlook.com
State New
Headers show
Series dropbear: Allow root login fix | expand

Commit Message

Jan Claussen June 7, 2022, 12:36 p.m. UTC
This enables root login when either "allow-root-login" or "debug-tweaks"
    were set in EXTRA_IMAGE_FEATURES.

    Signed-off-by: Jan Claussen <claussen.j@eppendorf.de>

Comments

Luca Ceresoli June 8, 2022, 7:48 a.m. UTC | #1
Hi Jan,

On Tue, 7 Jun 2022 12:36:15 +0000
"Jan Claussen via lists.openembedded.org"
<claussen.j=eppendorf.de@lists.openembedded.org> wrote:

>     This enables root login when either "allow-root-login" or "debug-tweaks"
>     were set in EXTRA_IMAGE_FEATURES.
> 
>     Signed-off-by: Jan Claussen <claussen.j@eppendorf.de>

Thanks for your patch. However I have a couple comments.

First, please try to send patches using 'git format-patch' and 'git
send-email'. Otherwise the format makes it hard to apply it. Even
though this one has a better format than your previous submission
(thanks for taking care of that!), using the git tools will simplify
both yours and others' task.

> diff --git a/meta/recipes-core/dropbear/dropbear.inc b/meta/recipes-core/dropbear/dropbear.inc
> index 78f9f9adbd..e545c425ab 100644
> --- a/meta/recipes-core/dropbear/dropbear.inc
> +++ b/meta/recipes-core/dropbear/dropbear.inc
> @@ -105,6 +105,13 @@ do_install() {
>   -e 's,@BINDIR@,${bindir},g' \
>   -e 's,@SBINDIR@,${sbindir},g' \
>   ${D}${systemd_system_unitdir}/dropbear.socket ${D}${systemd_system_unitdir}/*.service
> +
> +    # Enable root login for dropbear when debug-tweaks or allow-root-login are set
> +    if [ "${@bb.utils.filter('EXTRA_IMAGE_FEATURES', 'debug-tweaks', d)}" \
> +         || "${@bb.utils.filter('EXTRA_IMAGE_FEATURES', 'allow-root-login', d)}" ]; then
> +            sed -i 's/-w//g' ${D}/etc/default/dropbear
> +    fi
> +
>  }

Actually I don't think this should be needed at all because
meta/classes/rootfs-postcommands.bbclass already does this.
If that doesn't work for you, then maybe you could explain your problem
so we can help you find out why.

Patch

diff --git a/meta/recipes-core/dropbear/dropbear.inc b/meta/recipes-core/dropbear/dropbear.inc
index 78f9f9adbd..e545c425ab 100644
--- a/meta/recipes-core/dropbear/dropbear.inc
+++ b/meta/recipes-core/dropbear/dropbear.inc
@@ -105,6 +105,13 @@  do_install() {
  -e 's,@BINDIR@,${bindir},g' \
  -e 's,@SBINDIR@,${sbindir},g' \
  ${D}${systemd_system_unitdir}/dropbear.socket ${D}${systemd_system_unitdir}/*.service
+
+    # Enable root login for dropbear when debug-tweaks or allow-root-login are set
+    if [ "${@bb.utils.filter('EXTRA_IMAGE_FEATURES', 'debug-tweaks', d)}" \
+         || "${@bb.utils.filter('EXTRA_IMAGE_FEATURES', 'allow-root-login', d)}" ]; then
+            sed -i 's/-w//g' ${D}/etc/default/dropbear
+    fi
+
 }

 inherit update-alternatives