ssh key validation error when porting proxmox to arm64 architecture

peio

New Member
Apr 14, 2023
2
1
3
Hello,

I noticed a bug in proxmox when it's been ported on arm64, creating CT fails in the end because ssh-key didn't pass validation (Error 500).
Reading the scripts, I realized /usr/share/perl5/PVE/Tools.pm is checking the key with ssh-keygen, using a temporary file, created with O_TMPFILE flag. But this flag is hardcoded in the script itself, and it looks like the value is different on arm64. I think the perl Fcntl library doesn't provide a correct flag, which would explain why this value was hardcoded. But it looks like the architecture-dependent value is actually O_DIRECTORY (which completes this flag), which looks like correctly defined.

That's why I propose this patch, which would have no negative effect on amd64, but would correct arm64 ports :
Code:
--- /usr/share/perl5/PVE/Tools.pm.orig    2023-04-14 11:29:28.388000000 +0200
+++ /usr/share/perl5/PVE/Tools.pm    2023-04-14 15:26:47.736000000 +0200
@@ -100,7 +100,7 @@

 use constant {O_PATH    => 0x00200000,
               O_CLOEXEC => 0x00080000,
-              O_TMPFILE => 0x00410000}; # This includes O_DIRECTORY
+              O_TMPFILE => 0x00400000 | O_DIRECTORY};

 use constant {AT_EMPTY_PATH => 0x1000,
               AT_FDCWD => -100};

Thank you for your work
 
Last edited: