From: Enrico Scholz <[email protected]>

Install 'openssh-config-allow-empty-password' when corresponding
IMAGE_FEATURES are active.

Signed-off-by: Enrico Scholz <[email protected]>
---
 meta/classes-recipe/core-image.bbclass                      | 1 +
 meta/classes-recipe/rootfs-postcommands.bbclass             | 6 ------
 meta/recipes-connectivity/openssh/openssh-config.bb         | 2 ++
 .../openssh/openssh-config/60-allow-empty-password.conf     | 1 +
 4 files changed, 4 insertions(+), 6 deletions(-)
 create mode 100644 
meta/recipes-connectivity/openssh/openssh-config/60-allow-empty-password.conf

diff --git a/meta/classes-recipe/core-image.bbclass 
b/meta/classes-recipe/core-image.bbclass
index adf236e0693e..63e0e99b2a56 100644
--- a/meta/classes-recipe/core-image.bbclass
+++ b/meta/classes-recipe/core-image.bbclass
@@ -84,6 +84,7 @@ CORE_IMAGE_EXTRA_INSTALL ?= ""
 IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
 
 OPENSSH_FEATURE_CONFIGURATION = "\
+    ${@bb.utils.contains_any('IMAGE_FEATURES', [ 'debug-tweaks', 
'allow-empty-password' ], 'openssh-config-allow-empty-password', '',d)} \
 "
 
 inherit image
diff --git a/meta/classes-recipe/rootfs-postcommands.bbclass 
b/meta/classes-recipe/rootfs-postcommands.bbclass
index e81b69a239b5..88f88505b5ed 100644
--- a/meta/classes-recipe/rootfs-postcommands.bbclass
+++ b/meta/classes-recipe/rootfs-postcommands.bbclass
@@ -246,12 +246,6 @@ zap_empty_root_password () {
 # allow dropbear/openssh to accept logins from accounts with an empty password 
string
 #
 ssh_allow_empty_password () {
-       for config in sshd_config sshd_config_readonly; do
-               if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then
-                       sed -i 
's/^[#[:space:]]*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' 
${IMAGE_ROOTFS}${sysconfdir}/ssh/$config
-               fi
-       done
-
        if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then
                if grep -q DROPBEAR_EXTRA_ARGS 
${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then
                        if ! grep -q "DROPBEAR_EXTRA_ARGS=.*-B" 
${IMAGE_ROOTFS}${sysconfdir}/default/dropbear ; then
diff --git a/meta/recipes-connectivity/openssh/openssh-config.bb 
b/meta/recipes-connectivity/openssh/openssh-config.bb
index 312a1c903f63..20dfe086f8ab 100644
--- a/meta/recipes-connectivity/openssh/openssh-config.bb
+++ b/meta/recipes-connectivity/openssh/openssh-config.bb
@@ -4,6 +4,7 @@ LICENSE = "MIT"
 LIC_FILES_CHKSUM = 
"file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
 
 SRC_URI = "\
+    file://60-allow-empty-password.conf \
     file://80-oe.conf \
 "
 
@@ -11,6 +12,7 @@ do_install() {
     d=${D}${sysconfdir}/ssh/sshd_config.d
     install -d "$d"
     install -p -m 0644 \
+        ${WORKDIR}/60-allow-empty-password.conf \
         ${WORKDIR}/80-oe.conf \
         "$d"/
 
diff --git 
a/meta/recipes-connectivity/openssh/openssh-config/60-allow-empty-password.conf 
b/meta/recipes-connectivity/openssh/openssh-config/60-allow-empty-password.conf
new file mode 100644
index 000000000000..04e75ab6cefa
--- /dev/null
+++ 
b/meta/recipes-connectivity/openssh/openssh-config/60-allow-empty-password.conf
@@ -0,0 +1 @@
+PermitEmptyPasswords yes
-- 
2.44.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#196956): 
https://lists.openembedded.org/g/openembedded-core/message/196956
Mute This Topic: https://lists.openembedded.org/mt/104868004/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to