cherry-pick.v9-2-gdc292ff.dont-attempt-to-create-temporary-files-in-the-user-s-home-directory.patch 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. Subject: Don't attempt to create temporary files in the user's home directory
  2. Origin: v9-2-gdc292ff
  3. Upstream-Author: Javier Martinez Canillas <javierm@redhat.com>
  4. Date: Tue Feb 20 16:51:10 2018 +0100
  5. To use the tpm2 pin, some temporary files need to be created due how the
  6. tpm2-tools work. Currently they are created in the user's home directory
  7. but the commands can be executed by a user that doesn't have a home dir.
  8. So it's better to just create the temporary directory in /tmp, which is
  9. mktemp default. The mktemp default permissions are u+rwx anyways, so it
  10. isn't less secure to have the temp dir at /tmp instead of the home dir.
  11. Fixes: #30
  12. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
  13. --- a/src/clevis-decrypt-tpm2
  14. +++ b/src/clevis-decrypt-tpm2
  15. @@ -82,7 +82,7 @@
  16. exit 1
  17. fi
  18. -if ! TMP=`mktemp -d -p ~`; then
  19. +if ! TMP=`mktemp -d`; then
  20. echo "Creating a temporary dir for TPM files failed!" >&2
  21. exit 1
  22. fi
  23. --- a/src/clevis-encrypt-tpm2
  24. +++ b/src/clevis-encrypt-tpm2
  25. @@ -92,7 +92,7 @@
  26. exit 1
  27. fi
  28. -if ! TMP=`mktemp -d -p ~`; then
  29. +if ! TMP=`mktemp -d`; then
  30. echo "Creating a temporary dir for TPM files failed!" >&2
  31. exit 1
  32. fi