change permissions of /etc/pve/priv/known_hosts

proxmix

New Member
Nov 23, 2023
19
4
3
Hi,

we use ssh certificates (aka signed host keys) in our server infrastructure. Thus we would like to set the permissions of /etc/ssh/ssh_known_hosts (which is a symlink to /etc/pve/priv/known_hosts, which is located on proxmox cluster file system) to world readable: "chmod 644 /etc/pve/priv/known_hosts".

Is pmcfs permission aware? If so, how can the permissions be changed?
Is it save/supported to remove the symlink and use /etc/ssh/ssh_known_hosts directly? Are there any serious side-effects foreseeable regarding proxmox?

Note:
Using ssh certificates there is no need to synchronize /etc/ssh/ssh_known_hosts anymore: Using ssh certificates /etc/ssh/ssh_known_hosts' content becomes constant throughout the infrastructure (restricted to a cluster, a vlan, or all vlans/subdomain is up to you). Getting rid of each user's need to manage ~/.ssh/known_hosts is another huge advantage when deploying ssh certifcates. Our /etc/ssh/ssh_known_hosts (on regular debian systems) contains only one line that looks similar to this on _every_ host:

Code:
@cert-authority *.subdomainX.example.net,*subdomainY.example.net,subdom... ssh-ed25519 <SSH-CA-PUBKEY_SIGNATURE> <SSH-CA-Key-Comment>

But currently, as long as this line isn't world readable, this setup is of very limited use: only root-logins profit, a non-root (for example an ansible user account) can't access /etc/ssh/ssh_known_hosts, thus the host key authentication fails!

Conclusion:
Independent of the use of ssh certificates I suggest to set /etc/ssh/ssh_known_hosts world readable by default. And no, world readablity doesn't harm, neither in regard of security, nor in regard of privacy - at least as long as the hostkeys are stored along hashed hostnames (what's the default in current debian/proxmox releases).

What do you think?

Best regards,
proxmix
 
Did some investigations, and just answering myself:

Replacing the symlink /etc/ssh/ssh_known_hosts by a regular file, doesn't work as expected: It works just as long as "pvecm updatecerts" hasn't been executed, which re-replaces the regular file by the symlink from time to time.

Conclusion: I didn't know, and never ever thought that proxmox's clustering/migration mechanisms under the hood rely on ssh. I thought ssh is used for interactive management access only.

I'm glad to hear, that the Proxmox-Developers "plan to move away from SSH in the mid-term, avoiding this issue at all." Nice!

Hopefully mid-term means as soon as possible. ;-)
 
Last edited:
  • Like
Reactions: leesteken
as a workaround, you can point ssh at a different known hosts file.

see https://lists.proxmox.com/pipermail/pve-devel/2024-January/061319.html for more details

I would suggest he actually does it with user based config entry in his case. It is UserKnownHostsFile option in the ssh_config(5).

The ~/.ssh/config is not linked to anywhere.

EDIT:

And of course, you can neatly use KnownHostsCommand if you wanted to feed from multiple files. Be aware it will be called multiple times during SSH invocation.
 
Last edited: