
Chapter 10. SSH Protocol 133
Once an SSH client contacts a server, key information is exchanged so that the two systems can
correctly construct the transport layer. The following steps occur during this exchange:
• Key exchange
• The public key algorithm to be used
• The symmetric encryption algorithm to be used
• The message authentication algorithm to be used
• The hash algorithm to be used
During the key exchange, the server identifies itself to the client with a host key. Of course, if this client
has never communicated with this particular server before, then the server’s key will be unknown to the
client. OpenSSH gets around this problem by allowing the client to accept the server’s host key the first
time an SSH connection occurs. Then, in subsequent connections, the server’s host key can be checked
with a saved version on the client, providing confidence that the client is indeed communicating with
the intended server.
Caution
It is possible for an attacker to masquerade as the SSH server during the initial contact since the
local system does not know the difference between the intended server and a false one set up by an
attacker. To help prevent this you should verify the integrity of a new SSH server by contacting the
server administrator before connecting for the first time.
SSH is designed to work with almost any kind of public key algorithm or encoding format. After
an initial key exchange creates a hash value used for exchanges and a shared secret value, the two
systems immediately begin calculating new keys and algorithms to protect authentication and future
data sent over the connection.
After a certain amount of data has been transmitted using a particular key and algorithm (the exact
amount depends on the SSH implementation), another key exchange occurs, which generates another
set of hash values and a shared secret value. Even if an attack is able to determine the hash and shared
secret values, the attacker would have to determine this information each time a new key exchange is
made to continue to monitor the communication.
10.3.2. Authentication
Once the transport layer has constructed a secure tunnel to pass information between the two systems,
the server tells the client the different authentication methods supported, such as using a private key-
encoded signature or typing a password. The client will then try to authenticate itself to the server
using any of the supported methods.
Servers can be configured to allow different types of authentication, which gives each side the opti-
mal amount of control. The server can decide which encryption methods it will support based on its
security model, and the client can choose the order of authentication methods to attempt from among
the available options. Thanks to the secure nature of the SSH transport layer, even seemingly insecure
authentication methods, such as a host-based authentication, are safe to use.
Most users requiring a secure shell will authenticate using a password. Since the password is encrypted
when moving over the the transport layer, it can be safely sent across any network.
Commenti su questo manuale