Remix.run Logo
▲ aaronmdjones 2 hours ago

You would want to do that for key exchange too, not just authentication. OpenSSH already supports this for authentication; setting "AuthenticationMethods publickey,publickey" in sshd_config(5) will force users to supply 2 independent authorised keys. It also already supports hybrid key exchange.

▲stabbles 2 hours ago | parent [-]

AuthenticationMethods publickey,publickey does not require different types, so if you have two machines each with a unique (rsa, ed25199) pair, OpenSSH will also accept (rsa, rsa) or (ed25199, ed25199).

▲aaronmdjones 17 minutes ago | parent [-]

It can require different types if that's how you set up your authorized_keys file. You can then mark it immutable so that it can't be changed.

You should also create an empty authorized_keys2 file in this case (since OpenSSH will read both by default), unless you set e.g. "AuthorizedKeysFile .ssh/authorized_keys" in sshd_config(5) too.

It can't accept rsa,rsa in your example since neither machine has 2 RSA authentication keys in your example.

EDIT: There's also the AuthorizedKeysCommand directive instead, if you want to write a fancier program to constrain the permitted keys on offer. For example, it could look at all of the authorized keys listed in your file and offer only RSA ones, then later offer only Ed25519 ones.