From 260b83db2d8339986aad97954771919cb2766c7d Mon Sep 17 00:00:00 2001 From: Raptor Engineering Development Team Date: Fri, 14 Feb 2020 20:38:26 +0000 Subject: Move SSH keys to /etc --- poky/meta/classes/rootfs-postcommands.bbclass | 20 -------------------- .../recipes-connectivity/openssh/openssh/sshd_config | 2 +- .../openssh/openssh/sshdgenkeys.service | 2 +- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/poky/meta/classes/rootfs-postcommands.bbclass b/poky/meta/classes/rootfs-postcommands.bbclass index bde58ad6c..892f5a0ad 100644 --- a/poky/meta/classes/rootfs-postcommands.bbclass +++ b/poky/meta/classes/rootfs-postcommands.bbclass @@ -95,26 +95,6 @@ read_only_rootfs_hook () { sed -i -e '/^[#[:space:]]*\/dev\/root/{s/defaults/ro/;s/\([[:space:]]*[[:digit:]]\)\([[:space:]]*\)[[:digit:]]$/\1\20/}' ${IMAGE_ROOTFS}/etc/fstab 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=\${SYSCONFDIR:-/etc/ssh}" >> ${IMAGE_ROOTFS}/etc/default/ssh - echo "SSHD_OPTS=" >> ${IMAGE_ROOTFS}/etc/default/ssh - else - echo "SYSCONFDIR=\${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 - - # Also tweak the key location for dropbear in the same way. - if [ -d ${IMAGE_ROOTFS}/etc/dropbear ]; then - if [ ! -e ${IMAGE_ROOTFS}/etc/dropbear/dropbear_rsa_host_key ]; then - echo "DROPBEAR_RSAKEY_DIR=/var/lib/dropbear" >> ${IMAGE_ROOTFS}/etc/default/dropbear - 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 diff --git a/poky/meta/recipes-connectivity/openssh/openssh/sshd_config b/poky/meta/recipes-connectivity/openssh/openssh/sshd_config index 15f061b57..0eee29ab8 100644 --- a/poky/meta/recipes-connectivity/openssh/openssh/sshd_config +++ b/poky/meta/recipes-connectivity/openssh/openssh/sshd_config @@ -97,7 +97,7 @@ ChallengeResponseAuthentication no Compression no ClientAliveInterval 15 ClientAliveCountMax 4 -#UseDNS no +UseDNS no #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no diff --git a/poky/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service b/poky/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service index 603c33787..dc4ba33ca 100644 --- a/poky/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service +++ b/poky/meta/recipes-connectivity/openssh/openssh/sshdgenkeys.service @@ -1,6 +1,6 @@ [Unit] Description=OpenSSH Key Generation -RequiresMountsFor=/var /run +RequiresMountsFor=/etc [Service] ExecStart=@LIBEXECDIR@/sshd_check_keys -- cgit v1.2.1