Chapt3-Transport Level Security-SSH
Chapt3-Transport Level Security-SSH
Chapt3-Transport Level Security-SSH
1/23
TELNET Overview
Secure Shell (SSH) Overview
❏ A protocol for secure network communications designed to
be relatively simple and inexpensive to implement
● initial version, SSH1 was focused on providing a secure remote
logon facility to replace TELNET and other remote logon
schemes that provided no security
● also provides a more general client/server capability and can be
used for network functions such as file transfer, e-mail
❏ SSH2 fixes a number of security flaws in SSH1 and is
documented as proposed standard in IETF RFCs 4250
through 4256
❏ SSH client and server applications are widely available for
most operating systems
● become method of choice for remote login and X tunneling
3/23
SSH-2 Security Goals
❏ Server always authenticated in transport layer protocol.
❏ Client always authenticated in authentication protocol.
● By public key (DSS, RSA, SPKI, OpenPGP).
● Or simple password for particular application over secure
channel.
❏ Establishment of a fresh, shared secret.
● Shared secret used to derive further keys, similar to
SSL/IPSec.
● For confidentiality and authentication in SSH transport layer
protocol.
❏ Secure ciphersuite negotiation.
● Encryption, MAC, and compression algorithms.
● Server authentication and key exchange methods.
4/23
SSH-2 Protocol Stack
SSH is
organized as 3
protocols run on
top of TCP
5/23
SSH Transport Layer Protocol-
HOST KEYS
❏ Server authentication occurs at the transport layer, based
on the server possessing a public/private key pair
❏ A server may have multiple host keys using multiple
different asymmetric encryption algorithms
❏ Multiple hosts may share the same host key
❏ The server host key is used during key exchange to
authenticate the identity of the host
● client must have a prior knowledge of server’s public host key.
❏ RFC 4251 dictates two alternative trust models:
❏ 1. The client has a local database that associates each host
name with the corresponding public host key
This method requires no centrally administered infrastructure and no third-party coordination. The downside
is that the database of name-to-key associations may become burdensome to maintain.
❏ 2. The host name-to-key association is certified by a trusted
certification authority (CA); the client only knows the CA root
key and can verify the validity of all host keys certified by
accepted CAs This alternative eases the maintenance problem, since ideally, only a single CA key
needs to be securely stored on the client. On the other hand, each host key must be
appropriately certified by a central authority before authorization is possible. 6/23
SSH Transport Layer Protocol-Packet Exchanges 1/2
Client establishes a TCP connection to the
server.
This is done via the TCP protocol and is not part of the Transport Layer Protocol. Once the
connection is established, the client and server exchange data, referred to as packets, in the
data field of a TCP segment.
7/23
SSH Transport Layer Protocol-Packet Exchanges 2/2
The next step is key exchange . The
specification allows for alternative
methods of key exchange, but at present,
only two versions of Diffie–Hellman key
exchange are specified.
As a result of these steps, the two sides
share a master key K .
* = Required
** = Recommended
❏ Channel mechanism
❏ All types of communication using SSH are supported using
separate channels
❏ Either side may open a channel
❏ For each channel, each side associates a unique channel
number which need not be the same on both ends.
❏ Channels are flow controlled using a window mechanism
❏ No data may be sent to a channel until a message is
received to indicate that window space is available
❏ The life of a channel progresses through three stages:
opening a channel, data transfer, and closing a channel
12/23
Example SSH Connection Protocol Message Exchange
When either side wishes to open a new channel,
it allocates a local number for the channel and
then sends a message of the form:
SSH_MSG_CHANNEL_OPEN
If the remote side is able to open the channel, it
returns a message,
SSH_MSG_CHANNEL_OPEN_CONFIRMATION
which includes the sender channel number, the
recipient channel number, and window and packet
size values for incoming traffic.
Otherwise, the remote side returns a
SSH_MSG_CHANNEL_OPEN_FAILURE message
with a reason code indicating the reason for
failure.
Once a channel is open, data transfer is
performed using a SSH_MSG_CHANNEL_DATA
message, which includes the recipient channel
number and a block of data. These messages, in
both directions, may continue as long as the
channel is open.
When either side wishes to close a channel, it
sends a SSH_MSG_CHANNEL_CLOSE message,
which includes the recipient channel number.
13/23
Channel Types
❏ Four channel types are recognized in the SSH Connection
Protocol specification
Session
○The remote execution of a program
○The program may be a shell, an application such as file transfer or e-mail, a system
command, or some built-in subsystem
○Once a session channel is opened, subsequent requests are used to start the remote
program
X11
○Refers to the X Window System, a computer software system and network protocol
that provides a graphical user interface (GUI) for networked computers
○X allows applications to run on a network server but to be displayed on a desktop
machine
Forwarded-tcpip
•Remote port forwarding
Direct-tcpip
•Local port forwarding
14/23
Port Forwarding
LS Login
server
UM User’s MI Mail in
machine server
17/23
SSH Port Forwarding Mechanism
❏ Recall: TCP port number ‘identifies’ application.
❏ SSH on local machine:
● Intercepts traffic bound for server.
● Translates standard TCP port numbers.
● e.g. port 113 ----> port 5113.
● Sends packets to SSH-enabled server through SSH secure
channel.
❏ SSH-enabled server:
● Receives traffic.
● Re-translates port numbers.
● e.g. port 5113 ----> port 113.
● Forwards traffic to appropriate server using internal
network.
18/23
With SSH and Port Forwarding
MI Mail in
server
UM User’s LS
machine SSH-enabled
MO Mail out
login
server
Src: UM Dest: LS Port: 23 server
19/23
Example of SSH Local Forwarding
❒ Suppose you have an email client on desktop and use it
to get email from mail server via POP3 port 110. We
can secure this traffic in the following way:
❒ 1. SSH client sets up a connection to the remote server.
❒ 2. Select an unused local port number, say 9999, and
configure SSH to accept traffic from this port destined for
port 110 on the server.
❒ 3. SSH client informs the SSH server to create a connection
to the destination, in this case mail server port 110.
❒ 4. Client takes any bits sent to local port 9999 and sends
them to the server inside the encrypted SSH session. SSH
server decrypts the incoming bits and sends the plaintext to
port 110.
❒ 5. In other direction, the SSH server takes any bits received
on port 110 and sends them inside the SSH session back to
the client, who decrypts and sends them to the process
connected to port 9999.
20/23
Example of SSH Remote Forwarding
❒ To access a server at work from home computer behind a
firewall, you can set up an SSH tunnel using remote
forwarding as follows:
❒ 1. From work computer, set up an SSH connection to home
computer. The firewall will allow this, because it is a
protected outgoing connection.
❒ 2. Configure the SSH server to listen on a local port, say 22,
and to deliver data across the SSH connection addressed to
remote port, say 2222.
❒ 3. At home computer, configure SSH to accept traffic on
port 2222.
❒ 4. You now have an SSH tunnel that can be used for remote
logon to the work server.
21/23
SSH Applications
❒ Anonymous ftp for software updates, patches…
−No client authentication needed, but clients want to be sure
of origin and integrity of software.
❒ Secure ftp.
− e.g. upload of webpages to webserver using sftp.
− Server now needs to authenticate clients.
−Username and password may be sufficient, transmitted over
secure SSH transport layer protocol.
❒ Secure remote administration.
− SysAdmin (client) sets up terminal on remote machine.
− SysAdmin password protected by SSH transport layer
protocol.
−SysAdmin commands protected by SSH connection protocol.
❒ Guerilla Virtual Private Network.
− e.g. use SSH + port forwarding to secure e-mail
communications.
22/23
Summary
23/23