ssh key-exchange - how can the server verify the client?

I thought I understood how ssh key exchange works; Once a connection is established, the server encrypts messages with the clients public key so only the client can decrypt it.

But what if more that one client has a copy of that private key? Either by design, or if a client system is cloned (or even just renamed), the copy of the key works - so a client cloned for a test environment still has a key to the production server. The "tag" in id_rsa.pub, e.g. "root@myPC" doesn't necessarily relate to "myPC"

A client system checks the fingerprint of the server and will complain if it changes (ssh_config - StrictHostKeyChecking - unless that has been disabled); But can it be set up the other way around, so a key is only usable by a fingerprinted client?

Who is Participating?

Thanks to all for your comments and insights. To be fair, I didn't set up this environment so the copies of keys lying around aren't my doing, but I need to clean it up and only allow key-pair "trust" relationships where they are truly appropriate.

I think my answer lies in `man sshd`: The section on the authorized_keys file describes the "from" option that can be put in that file on the server, e.g

would only allow that key to be used from client "tfewsters_PC.example.net". Wildcards and IP addresses could be used, so I could specify 'from="192.168.1.*"' to say 'If that have the key AND they're on the (e.g. production) subnet, they're trustworthy'.

I did think about iptables, or internal firewalls, but this seems quite simple to administer and I can manage the distribution of the authorized_keys file to a group of servers

The short answer is - there should never exist more than one copy of your private key. The whole point of the public key cryptography is to assure authenticity and non-repudiability of communications, based on the fact that a specific private key is unique to a specific client. Easiest way (and, arguably, the only correct way) to fix the predicament you're describing (multiple copies of the private key existing) is to revoke and replace the compromised key. Other than that, your only chance at differentiating systems would be by a public IP address (which wouldn't help if both systems are connecting from the same NAT-ed/public IP address).

not quite how it works. the public key of the server is used to authenticate to the client & also protect the setup of a symmetric key used to encrypt the rest of the conversation. over that encrypted channel, the client authenticates using a supported method - password, pki, kerberos token, whatever; if that is compromised, then the server won't know different than from the genuine user, but that is true of all systems.

GDPR? That's a regulation for the European Union. But, if you collect data from customers or employees within the EU, then you need to know about GDPR and make sure your organization is compliant by May 2018. Check out our preparation checklist to make sure you're on track today!

Yes. that can help a lot - if a given key is associated with a given source ip range, then limiting logins to that range can help prevent abuse. Of course, if you don't need ssh from outside your own IP range, you can lock that down completely using iptables then you won't get half of chinanet knocking on the door.... :)

Found the solution myself. None of the Expert comments helped toward that, though they confirmed my views so partial points have been awarded.

To clarify my example scenario, I'm not really talking about PCs and end-user clients: If you have a client-server application environment or a server cluster, you may want trust relationships between the servers so e.g. a Cluster master can distribute config files to its peers/subordinates. If the Production systems are cloned to set up a Test environment, the keys _should_ be revoked - but that step may be missed.