]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
openssh: Be more restrictive on private key file permissions
authorKhem Raj <raj.khem@gmail.com>
Fri, 11 Oct 2024 19:42:51 +0000 (12:42 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 15 Oct 2024 10:47:20 +0000 (11:47 +0100)
Sometimes default permissions on filesystems can be more permissive
e.g. 0644, this can make the private key file created here to inherit
those permissions and these permissions can then cause ssh server to
not allow ssh connections due to non-secure permissions on file.

Reported-by: Jean-Michel Papy <jean-michel.papy@exail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Jörg Sommer <joerg.sommer@navimatix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-connectivity/openssh/openssh/sshd_check_keys

index 606d1894b55d24d69429f5dd6ad50589e470d61d..bbb6a149088b18159a4662c4c3facf7a795d4427 100644 (file)
@@ -8,7 +8,7 @@ generate_key() {
     mkdir -p "$DIR"
     rm -f ${FILE}.tmp
     ssh-keygen -q -f "${FILE}.tmp" -N '' -t $TYPE
-
+    chmod go-rwx "$FILE.tmp"
     # Atomically rename file public key
     mv -f "${FILE}.tmp.pub" "${FILE}.pub"