Bug#982392: ssh-copy-id: create ~/.ssh with default SELinux context

Christian Göttsche <[email protected]>
Newsgroups gmane.linux.debian.devel.ssh
Message-ID <CAJ2a_Df-KrwfQDrE38v-J4g6k13MH3hh=rh5-5yPwCGphi0HFw__16025.038277597$1612889844$gmane$org@mail.gmail.com>
Package: openssh-client
Version: 1:8.4p1-3
File: /usr/bin/ssh-copy-id
User: [email protected]
Usertags: selinux

Dear Maintainer,

ssh-copy-id(1) does create the directory ~/.ssh if it not already
exists. It also runs later, if available, restorecon(8) on the
directory, to correct the SELinux context of it.
It would however be idiomatic to create the directory already with the
default SELinux context, to prepare for restorecon failures and avoid
potential races.

Best regards,
    Christian Göttsche

--- /usr/bin/ssh-copy-id        2021-02-09 17:19:48.653799557 +0100
+++ ssh-copy-id 2021-02-09 17:45:38.360891272 +0100
@@ -250,7 +250,7 @@
  INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF
       cd;
       umask 077;
-       mkdir -p $(dirname "${AUTH_KEY_FILE}") &&
+       mkdir -pZ $(dirname "${AUTH_KEY_FILE}") &&
         { [ -z \`tail -1c ${AUTH_KEY_FILE} 2>/dev/null\` ] || echo >>
${AUTH_KEY_FILE}; } &&
         cat >> ${AUTH_KEY_FILE} ||
         exit 1;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.