diff options
author | Louis Rannou <louis.rannou@non.se.com> | 2025-07-03 14:14:36 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-07 22:12:50 +0100 |
commit | 2ff9b7b6c684882a6e283d335286e3c31b7f219a (patch) | |
tree | 9edd24072c57ee9f980dc1159d1aacc604d65bc0 | |
parent | 9a084b728e7e26db8114417fee62cf6f8ee3091d (diff) | |
download | poky-2ff9b7b6c684882a6e283d335286e3c31b7f219a.tar.gz |
openssh: limit read access to sshd_config
Enhance security by limiting read access for /etc/sshd_config to user root as it
may reveal unsecure configurations.
Reading access is limited in the install append as the default value 0644 is
hardcoded in the openssh makefile and is not configurable. Therefore the
permissions are modified in the install append.
(From OE-Core rev: 99c09d29d56cb98f749c2283b5b800de9af98745)
Signed-off-by: Louis Rannou <louis.rannou@non.se.com>
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-connectivity/openssh/openssh_10.0p1.bb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/meta/recipes-connectivity/openssh/openssh_10.0p1.bb b/meta/recipes-connectivity/openssh/openssh_10.0p1.bb index a044aec063..2f446b5540 100644 --- a/meta/recipes-connectivity/openssh/openssh_10.0p1.bb +++ b/meta/recipes-connectivity/openssh/openssh_10.0p1.bb | |||
@@ -102,7 +102,7 @@ CACHED_CONFIGUREVARS += "ac_cv_header_maillock_h=no" | |||
102 | 102 | ||
103 | do_configure:prepend () { | 103 | do_configure:prepend () { |
104 | export LD="${CC}" | 104 | export LD="${CC}" |
105 | install -m 0644 ${UNPACKDIR}/sshd_config ${B}/ | 105 | install -m 0600 ${UNPACKDIR}/sshd_config ${B}/ |
106 | install -m 0644 ${UNPACKDIR}/ssh_config ${B}/ | 106 | install -m 0644 ${UNPACKDIR}/ssh_config ${B}/ |
107 | } | 107 | } |
108 | 108 | ||
@@ -153,9 +153,12 @@ do_install:append () { | |||
153 | install -m 644 ${UNPACKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd | 153 | install -m 644 ${UNPACKDIR}/volatiles.99_sshd ${D}/${sysconfdir}/default/volatiles/99_sshd |
154 | install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir} | 154 | install -m 0755 ${S}/contrib/ssh-copy-id ${D}${bindir} |
155 | 155 | ||
156 | # Limit sshd_config access to the owner (default is 0644) | ||
157 | chmod 0600 ${D}${sysconfdir}/ssh/sshd_config | ||
158 | |||
156 | # Create config files for read-only rootfs | 159 | # Create config files for read-only rootfs |
157 | install -d ${D}${sysconfdir}/ssh | 160 | install -d ${D}${sysconfdir}/ssh |
158 | install -m 644 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly | 161 | install -m 0600 ${D}${sysconfdir}/ssh/sshd_config ${D}${sysconfdir}/ssh/sshd_config_readonly |
159 | 162 | ||
160 | install -d ${D}${systemd_system_unitdir} | 163 | install -d ${D}${systemd_system_unitdir} |
161 | if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then | 164 | if ${@bb.utils.contains('PACKAGECONFIG','systemd-sshd-socket-mode','true','false',d)}; then |