mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 00:32:13 +02:00
image.bbclass: when building a readonly rootfs, tweak ssh settings regardless of init system in use
Previously it was done only if sysvinit was in DISTRO_FEATURES. (From OE-Core rev: 8aa5c66a29c1394e0418e94bdd49e5b268ffc790) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
f1e25150ef
commit
006497e36a
@@ -239,6 +239,18 @@ read_only_rootfs_hook () {
|
||||
# Tweak the mount option and fs_passno for rootfs in fstab
|
||||
sed -i -e '/^[#[:space:]]*\/dev\/root/{s/defaults/ro/;s/\([[:space:]]*[[:digit:]]\)\([[:space:]]*\)[[:digit:]]$/\1\20/}' ${IMAGE_ROOTFS}/etc/fstab
|
||||
|
||||
# If we're using openssh and the /etc/ssh directory has no pre-generated keys,
|
||||
# we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly
|
||||
# and the keys under /var/run/ssh.
|
||||
if [ -d ${IMAGE_ROOTFS}/etc/ssh ]; then
|
||||
if [ -e ${IMAGE_ROOTFS}/etc/ssh/ssh_host_rsa_key ]; then
|
||||
echo "SYSCONFDIR=/etc/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh
|
||||
echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh
|
||||
else
|
||||
echo "SYSCONFDIR=/var/run/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh
|
||||
echo "SSHD_OPTS='-f /etc/ssh/sshd_config_readonly'" >> ${IMAGE_ROOTFS}/etc/default/ssh
|
||||
fi
|
||||
fi
|
||||
if ${@bb.utils.contains("DISTRO_FEATURES", "sysvinit", "true", "false", d)}; then
|
||||
# Change the value of ROOTFS_READ_ONLY in /etc/default/rcS to yes
|
||||
if [ -e ${IMAGE_ROOTFS}/etc/default/rcS ]; then
|
||||
@@ -249,18 +261,6 @@ read_only_rootfs_hook () {
|
||||
if [ -x ${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh ]; then
|
||||
${IMAGE_ROOTFS}/etc/init.d/populate-volatile.sh
|
||||
fi
|
||||
# If we're using openssh and the /etc/ssh directory has no pre-generated keys,
|
||||
# we should configure openssh to use the configuration file /etc/ssh/sshd_config_readonly
|
||||
# and the keys under /var/run/ssh.
|
||||
if [ -d ${IMAGE_ROOTFS}/etc/ssh ]; then
|
||||
if [ -e ${IMAGE_ROOTFS}/etc/ssh/ssh_host_rsa_key ]; then
|
||||
echo "SYSCONFDIR=/etc/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh
|
||||
echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh
|
||||
else
|
||||
echo "SYSCONFDIR=/var/run/ssh" >> ${IMAGE_ROOTFS}/etc/default/ssh
|
||||
echo "SSHD_OPTS='-f /etc/ssh/sshd_config_readonly'" >> ${IMAGE_ROOTFS}/etc/default/ssh
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "true", "false", d)}; then
|
||||
|
||||
Reference in New Issue
Block a user