diff options
author | Jonathan Liu <net147@gmail.com> | 2016-02-26 20:12:21 +1100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-28 11:33:06 +0000 |
commit | 00117606637549fa3bb6d1494e79c0a3ad9ee99b (patch) | |
tree | 5c29757c329306411664c5f5d8dc0399be924b82 /meta/classes/rootfs-postcommands.bbclass | |
parent | 96f5f89b49d1762ee925e1d31136f57f30eb2625 (diff) | |
download | poky-00117606637549fa3bb6d1494e79c0a3ad9ee99b.tar.gz |
rootfs-postcommands: fix ssh_allow_empty_password checking
The ssh_allow_empty_password function doesn't check if
sshd_config_readonly exists before running sed which can result in an
error if sshd_config exists but sshd_config_readonly doesn't.
(From OE-Core rev: dc4e3d31852084a75faf224882d1ab19d07de8fe)
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/rootfs-postcommands.bbclass')
-rw-r--r-- | meta/classes/rootfs-postcommands.bbclass | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass index f5d6147b4d..e184667f67 100644 --- a/meta/classes/rootfs-postcommands.bbclass +++ b/meta/classes/rootfs-postcommands.bbclass | |||
@@ -112,10 +112,12 @@ zap_empty_root_password () { | |||
112 | # allow dropbear/openssh to accept root logins and logins from accounts with an empty password string | 112 | # allow dropbear/openssh to accept root logins and logins from accounts with an empty password string |
113 | # | 113 | # |
114 | ssh_allow_empty_password () { | 114 | ssh_allow_empty_password () { |
115 | if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ]; then | 115 | for config in sshd_config sshd_config_readonly; do |
116 | sed -i 's/^[#[:space:]]*PermitRootLogin.*/PermitRootLogin yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config_readonly | 116 | if [ -e ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config ]; then |
117 | sed -i 's/^[#[:space:]]*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config ${IMAGE_ROOTFS}${sysconfdir}/ssh/sshd_config_readonly | 117 | sed -i 's/^[#[:space:]]*PermitRootLogin.*/PermitRootLogin yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config |
118 | fi | 118 | sed -i 's/^[#[:space:]]*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' ${IMAGE_ROOTFS}${sysconfdir}/ssh/$config |
119 | fi | ||
120 | done | ||
119 | 121 | ||
120 | if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then | 122 | if [ -e ${IMAGE_ROOTFS}${sbindir}/dropbear ] ; then |
121 | if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then | 123 | if grep -q DROPBEAR_EXTRA_ARGS ${IMAGE_ROOTFS}${sysconfdir}/default/dropbear 2>/dev/null ; then |