summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-01-16 17:00:12 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-18 13:28:05 +0000
commit411413aa281e2a95a7a641a91ec3c0b1c07471c8 (patch)
treec5358e91a2a5f06ba5d4757b5987d08c0d785332
parent955568ddfad2e21b8ff680d84655b2c9d54c06f2 (diff)
downloadpoky-411413aa281e2a95a7a641a91ec3c0b1c07471c8.tar.gz
classes/image: improve debug-tweaks ssh server configuration
Create a single postprocessing function that enables no-password logins for both openssh and dropbear when debug-tweaks is in IMAGE_FEATURES, changing its behaviour slightly: * Run it regardless of whether ssh-server-* are in IMAGE_FEATURES so that it still takes effect if these are installed by adding dropbear/openssh to IMAGE_INSTALL. * Enable it to be run from image.bbclass rather than core-image.bbclass so that it works for images that are using the former. Second half of the fix for [YOCTO #2578]. (From OE-Core rev: 0937054e6e3e02565f57e60a8bdc14b0ad62e249) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/core-image.bbclass3
-rw-r--r--meta/classes/image.bbclass16
2 files changed, 14 insertions, 5 deletions
diff --git a/meta/classes/core-image.bbclass b/meta/classes/core-image.bbclass
index 2e67018536..e0f6dbb7d9 100644
--- a/meta/classes/core-image.bbclass
+++ b/meta/classes/core-image.bbclass
@@ -76,6 +76,3 @@ ROOTFS_POSTPROCESS_COMMAND += "rootfs_update_timestamp ; "
76 76
77# Zap the root password if debug-tweaks feature is not enabled 77# Zap the root password if debug-tweaks feature is not enabled
78ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "", "zap_root_password ; ",d)}' 78ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "", "zap_root_password ; ",d)}'
79# Allow openssh accept empty password login if both debug-tweaks and ssh-server-openssh are enabled
80ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks ssh-server-openssh", "openssh_allow_empty_password; ", "",d)}'
81
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index e49468949e..0293d2e358 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -167,6 +167,8 @@ inherit ${IMAGE_CLASSES}
167IMAGE_POSTPROCESS_COMMAND ?= "" 167IMAGE_POSTPROCESS_COMMAND ?= ""
168MACHINE_POSTPROCESS_COMMAND ?= "" 168MACHINE_POSTPROCESS_COMMAND ?= ""
169ROOTFS_POSTPROCESS_COMMAND_prepend = "run_intercept_scriptlets; " 169ROOTFS_POSTPROCESS_COMMAND_prepend = "run_intercept_scriptlets; "
170# Allow dropbear/openssh to accept logins from accounts with an empty password string if debug-tweaks is enabled
171ROOTFS_POSTPROCESS_COMMAND += '${@base_contains("IMAGE_FEATURES", "debug-tweaks", "ssh_allow_empty_password; ", "",d)}'
170 172
171# some default locales 173# some default locales
172IMAGE_LINGUAS ?= "de-de fr-fr en-gb" 174IMAGE_LINGUAS ?= "de-de fr-fr en-gb"
@@ -396,12 +398,22 @@ zap_root_password () {
396 mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd 398 mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd
397} 399}
398 400
399# allow openssh accept login with empty password string 401# allow dropbear/openssh to accept root logins and logins from accounts with an empty password string
400openssh_allow_empty_password () { 402ssh_allow_empty_password () {
401 if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then 403 if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then
402 sed -i 's#.*PermitRootLogin.*#PermitRootLogin yes#' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config 404 sed -i 's#.*PermitRootLogin.*#PermitRootLogin yes#' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
403 sed -i 's#.*PermitEmptyPasswords.*#PermitEmptyPasswords yes#' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config 405 sed -i 's#.*PermitEmptyPasswords.*#PermitEmptyPasswords yes#' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config
404 fi 406 fi
407
408 if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then
409 if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then
410 if ! grep -q "DROPBEAR_EXTRA_ARGS=.*-B" ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear ; then
411 sed -i 's/^DROPBEAR_EXTRA_ARGS="*\([^"]*\)"*/DROPBEAR_EXTRA_ARGS="\1 -B"/' ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
412 fi
413 else
414 printf '\nDROPBEAR_EXTRA_ARGS="-B"\n' >> ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear
415 fi
416 fi
405} 417}
406 418
407# Turn any symbolic /sbin/init link into a file 419# Turn any symbolic /sbin/init link into a file