SlideShare a Scribd company logo
1 of 65
 
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Goals of the presentation
What is SSH?
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],What is SSH?
What is SSH Not
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],What SSH is NOT
History
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],History
Terminology
SSH  - Generic term used for SSH protocols ssh  - Client command for running remote command sshd  - Server program SSH-1  - Version 1 of the protocol SSH-2  - Version 2 of the protocol OpenSSH  - Product from open BSD project Terminology
SSH Architecture
SSH Architecture The brown fox jumped over the cow The brown fox jumped over the cow Anw@dc%9r&6cbditop*dekisn@h Network ??? ssh client ssh server Authentication
SSH Layers Ethernet Network Access Layer IP Internet Layer TCP Transport Layer ssh-transport Initial key exchange and server authentication, setup encryption ssh-userauth User authentication using public key, password, host based, etc. ssh-connection Session multiplexing, X11 and port forwarding, remote command execution, SOCKS proxy, etc. Application Layer
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],SSH Connection Sequence
[object Object],[object Object],[object Object],[object Object],[object Object],SSH Features
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],SSH will protect against
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],SSH will not protect against
Installing SSH
You may download the source from  	 http://www.openssh.com/ Read installation instructions to check if you have pre-requisite packages and libraries. Downloading Source Code
gtar -xzf openssh-4.5p1.tar.gz cd openssh-4.5p1 ./configure make make install Building and installing OpenSSH
Configuration files
[object Object],[object Object],[object Object],SSH Configuration Files
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],System wide configuration files
sshd.pid  - Server's PID is stored in this file System wide configuration files
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],User specific configuration files
config  - Client configuration file User specific configuration files
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Configuration files
IMPORTANT The ~/.ssh directory and the files in it must be owned by user and must be unreadable by anybody else. The ssh server will simply ignore the files with incorrect permissions.  chmod -R og=  ~/.ssh Configuration Permissions
Key Management
[object Object],[object Object],[object Object],Key pairs
[object Object],[object Object],[object Object],Key management commands
shahhe@kubuntu1:~$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/shahhe/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/shahhe/.ssh/id_dsa. Your public key has been saved in /home/shahhe/.ssh/id_dsa.pub. The key fingerprint is: 99:51:ac:02:10:0c:d4:55:09:cc:86:36:cf:59:d0:33 Generating key pairs
shahhe@kubuntu1:~$ cat ~/.ssh/id_dsa -----BEGIN DSA PRIVATE KEY----- MIIBuwIBAAKBgQDPmC7jSBnJMoQ8o6/cF4GUDP/gsCqonA0UGs2g/92N8qVTxxZg U3MgZAQ96FAsaGKFDfsxoqbp1eXX7IXUS+erPOMQnDtbooLgZN3VpvStvV/hulnn HoFJoDmoE5MnrY0Su93jZe2mPp4hOrYYQu0/8r3YRFtAzz6TCauHFxO4DQIVAJYo apGVvbg8J1rAefSBReOef/iXAoGBAJUXbyDtR0wpyz5UKT11FmVS/a34ST9Lfzld OjR38c9sRCf8klRZ6IuqoLUZZ3jSo56+SRsraFQReCB5GLWPx5qKzHz9xi9XFseT aCb3Qh70EbiP3uAFqnTvk2K8voKC4dNIEXZ7SZXZUsWBImLaYXf/scvL7fMlMy9d fCMf8By2AoGAGEdK17lrlD7zfWUVyJm+26ZaQ/QU4Yhff6Cfoe1lnq/1UmT6SEVf SZWsj9n8fj7Ez8l03gU/g+otZXDcsS6OmNMooWkADIbkHfQ6oeoK1h/3z0hV8TY4 HnOtMZuHJMf1LPFNvINbenLS+qldGvi19aTxZUkcQJiHdpr6GR3jn9cCFE9xHd8q Y8klJEyIPYK+KQ4UrbhZ -----END DSA PRIVATE KEY----- Generating key pairs
shahhe@kubuntu1:~$ cat ~/.ssh/id_dsa.pub ssh–dss AAAAB3NzaC1kc3MAAACBAM+YLuNIGckyhDyjr9wXgZQM/+CwKqicDRQazaD/3Y3ypVPHFmBTcyBkBD3oUCxoYoUN+zGipunV5dfshdRL56s84xCcO1uiguBk3dWm9K29X+G6WecegUmgOagTkyetjRK73eNl7aY+niE6thhC7T/yvdhEW0DPPpMJq4cXE7gNAAAAFQCWKGqRlb24PCdawHn0gUXjnn/4lwAAAIEAlRdvIO1HTCnLPlQpPXUWZVL9rfhJP0t/OV06NHfxz2xEJ/ySVFnoi6qgtRlneNKjnr5JGytoVBF4IHkYtY/HmorMfP3GL1cWx5NoJvdCHvQRuI/e4AWqdO+TYry+goLh00gRdntJldlSxYEiYtphd/+xy8vt8yUzL118Ix/wHLYAAACAGEdK17lrlD7zfWUVyJm+26ZaQ/QU4Yhff6Cfoe1lnq/1UmT6SEVfSZWsj9n8fj7Ez8l03gU/g+otZXDcsS6OmNMooWkADIbkHfQ6oeoK1h/3z0hV8TY4HnOtMZuHJMf1LPFNvINbenLS+qldGvi19aTxZUkcQJiHdpr6GR3jn9c= shahhe@kubuntu1 Generating key pairs
Executing commands
shahhe@kubuntu1:~$ ssh  [email_address] Last login: Mon Jun 18 21:26:33 2007 from d47-69-253-190. * Problems? Questions?  Email:  [email_address] * Type "whatsup" to see information posted to our "What's Up?" page. You have mail. You have 17 read messages. You have no new mail. /home/customer/shah {shah@typhoon} 1> Logging into remote system
shahhe@kubuntu1:~$ scp .profile shah@xnet.com:tmp/profile.kubuntu .profile                         100%  566  0.6KB/s  00:00 shahhe@kubuntu1:~$ scp shah@xnet.com:tmp/profile.kubuntu tmp/. profile.kubuntu                  100%  566  0.6KB/s  00:00 Copying file to remote system
shahhe@kubuntu1:~$ ssh shah@xnet.com ls Mail News bin mail public_html tmp Executing commands on remote system
shahhe@kubuntu1:~$ ssh -Y shah@xnet.com /opt/sfw/bin/xterm Executing commands on remote system
Force execution of command
[object Object],[object Object],Force execution of command
[object Object],[object Object],Force execution of command
Options for authorized_keys2 file Disable X11 forwarding no-x11-forwarding Do not allocate TTY no-pty Disable port forwarding no-port-forwarding Disable forwarding agent no-agent-forwarding Limit incoming hosts from="host or ip address" Set environment variable environment="variable=value" Specify a force command command="command name" Meaning Option
Port forwarding
Port forwarding Insecure Client App Server App ssh client ssh server Secure
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Port forwarding
[object Object],[object Object],Port forwarding
Agent forwarding
You want to login to the computer at work from your home computer or from from hotel while traveling. The computer at work is behind the firewall so you cannot connect to it directly. You are allowed to connect to a bastion host, but are not allowed to store private keys on it. What can you do?  Agent forwarding
Agent Forwarding ssh  ssh sshd (proxy agent) sshd ssh Login ssh  Work Bastion Home
The configuration is stored in  /etc/ssh/sshd_config  file. Port 46464 Protocol 2 PasswordAuthentication no ForwardX11 yes ForwardAgent yes Compression no sshd configuration on bastion host
The configuration is stored in  ~/.ssh/tunnel.cfg  file. Host * ForwardX11 yes ForwardAgent yes NoHostAuthenticationForLocalhost yes User RemoteUser IdentityFile /home/LocalUser/.ssh/work_dsa Host bastionhost  HostName 69.2.50.60 Port  46464 LocalForward 10001 10.60.80.101:22 ssh tunnel configuration on home system
The configuration is stored in  ~/.ssh/config  file. Host * ForwardX11 yes ForwardAgent yes NoHostAuthenticationForLocalhost yes IdentityFile /home/LocalUser/.ssh/work_dsa Host portmap HostName localhost port 10001 LocalForward 18080 10.60.80.101:22 LocalForward 18081 10.60.80.102:22 Host host1 User RemoteUser HostName localhost Port 18080 Host host2 User RemoteUser HostName localhost Port 18081 ssh client configuration on home system
[object Object],[object Object],[object Object],[object Object],Setting Key Pair
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Login into work systems
Environment variables
Environment variables /dev/pts/48 Name of TTY SSH_TTY 10.90.10.107 45756 22 Client socket information SSH_CLIENT /tmp/ssh-FcRCI22249/agent.22249 Path to socket SSH_AUTH_SOCK 10.90.10.107 45756 10.90.10.182 22 Client and server socket information SSH_CONNECTION Example Meaning Variable
Other ssh based applications
[object Object],[object Object],[object Object],[object Object],Other ssh based applications
PuTTY TTSSH Cygwin MSSH WinSCP FileZilla OpenSSH alternatives for windows
Advantages of using ssh
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Advantages
Disadvantages of using ssh
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Disadvantages
http://www.openssh.com/ http://fuse.sourceforge.net/sshfs.html Barrett, D., Silverman, R., & Byrnes, R. (2005). SSH The Definitive Guide, Second Edition. O'Reilly Media, Inc. SSH FAQ http://www.employees.org/~satch/ssh/faq/ssh-faq.html Excellent agent forwarding tutorial http://unixwiz.net/techtips/ssh-agent-forwarding.html Turotial on building OpenSSH http://unixwiz.net/techtips/openssh.html Resources

More Related Content

What's hot

Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and ssl
Mohd Arif
 
Basic Linux Security
Basic Linux SecurityBasic Linux Security
Basic Linux Security
pankaj009
 

What's hot (20)

Ssh (The Secure Shell)
Ssh (The Secure Shell)Ssh (The Secure Shell)
Ssh (The Secure Shell)
 
Secure shell
Secure shellSecure shell
Secure shell
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
NFS(Network File System)
NFS(Network File System)NFS(Network File System)
NFS(Network File System)
 
SSL And TLS
SSL And TLS SSL And TLS
SSL And TLS
 
What is SSL ? The Secure Sockets Layer (SSL) Protocol
What is SSL ? The Secure Sockets Layer (SSL) ProtocolWhat is SSL ? The Secure Sockets Layer (SSL) Protocol
What is SSL ? The Secure Sockets Layer (SSL) Protocol
 
Linux User Management
Linux User ManagementLinux User Management
Linux User Management
 
SSL TLS Protocol
SSL TLS ProtocolSSL TLS Protocol
SSL TLS Protocol
 
Ssl (Secure Sockets Layer)
Ssl (Secure Sockets Layer)Ssl (Secure Sockets Layer)
Ssl (Secure Sockets Layer)
 
Simple Network Management Protocol
Simple Network Management ProtocolSimple Network Management Protocol
Simple Network Management Protocol
 
Transport layer security (tls)
Transport layer security (tls)Transport layer security (tls)
Transport layer security (tls)
 
Metasploit seminar
Metasploit seminarMetasploit seminar
Metasploit seminar
 
Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and ssl
 
Metasploit framwork
Metasploit framworkMetasploit framwork
Metasploit framwork
 
Basic Linux Security
Basic Linux SecurityBasic Linux Security
Basic Linux Security
 
Samba server
Samba serverSamba server
Samba server
 
SSL intro
SSL introSSL intro
SSL intro
 
Understanding NMAP
Understanding NMAPUnderstanding NMAP
Understanding NMAP
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Introduction to Shell script
Introduction to Shell scriptIntroduction to Shell script
Introduction to Shell script
 

Viewers also liked

Practical unix utilities for text processing
Practical unix utilities for text processingPractical unix utilities for text processing
Practical unix utilities for text processing
Anton Arhipov
 
Unix command-line tools
Unix command-line toolsUnix command-line tools
Unix command-line tools
Eric Wilson
 

Viewers also liked (20)

Secure Shell(ssh)
Secure Shell(ssh)Secure Shell(ssh)
Secure Shell(ssh)
 
Introduction To SELinux
Introduction To SELinuxIntroduction To SELinux
Introduction To SELinux
 
Security protocols in constrained environments
Security protocols in constrained environments Security protocols in constrained environments
Security protocols in constrained environments
 
Night Vision Technology
Night Vision TechnologyNight Vision Technology
Night Vision Technology
 
3D-Doctor
3D-Doctor3D-Doctor
3D-Doctor
 
CMS and Joomla
CMS and JoomlaCMS and Joomla
CMS and Joomla
 
Joomla CMS SEMINAR PPT
Joomla CMS SEMINAR PPTJoomla CMS SEMINAR PPT
Joomla CMS SEMINAR PPT
 
Web Application Security with PHP
Web Application Security with PHPWeb Application Security with PHP
Web Application Security with PHP
 
Defeating The Network Security Infrastructure V1.0
Defeating The Network Security Infrastructure  V1.0Defeating The Network Security Infrastructure  V1.0
Defeating The Network Security Infrastructure V1.0
 
class12_Networking2
class12_Networking2class12_Networking2
class12_Networking2
 
Unix Command Line Productivity Tips
Unix Command Line Productivity TipsUnix Command Line Productivity Tips
Unix Command Line Productivity Tips
 
Practical unix utilities for text processing
Practical unix utilities for text processingPractical unix utilities for text processing
Practical unix utilities for text processing
 
PHP Secure Programming
PHP Secure ProgrammingPHP Secure Programming
PHP Secure Programming
 
Web Application Security: Introduction to common classes of security flaws an...
Web Application Security: Introduction to common classes of security flaws an...Web Application Security: Introduction to common classes of security flaws an...
Web Application Security: Introduction to common classes of security flaws an...
 
Unix command-line tools
Unix command-line toolsUnix command-line tools
Unix command-line tools
 
Practical Example of grep command in unix
Practical Example of grep command in unixPractical Example of grep command in unix
Practical Example of grep command in unix
 
Sed & awk the dynamic duo
Sed & awk   the dynamic duoSed & awk   the dynamic duo
Sed & awk the dynamic duo
 
Learning sed and awk
Learning sed and awkLearning sed and awk
Learning sed and awk
 
How to Setup A Pen test Lab and How to Play CTF
How to Setup A Pen test Lab and How to Play CTF How to Setup A Pen test Lab and How to Play CTF
How to Setup A Pen test Lab and How to Play CTF
 
Brain chips ppt
Brain chips pptBrain chips ppt
Brain chips ppt
 

Similar to Introduction to SSH

Ssh
SshSsh
Ssh
gh02
 
Unit 13 network client
Unit 13 network clientUnit 13 network client
Unit 13 network client
root_fibo
 
SSH for pen-testers
SSH for pen-testersSSH for pen-testers
SSH for pen-testers
E D Williams
 
7 unixsecurity
7 unixsecurity7 unixsecurity
7 unixsecurity
richarddxd
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
fangjiafu
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
fangjiafu
 

Similar to Introduction to SSH (20)

0696-ssh-the-secure-shell.pdf
0696-ssh-the-secure-shell.pdf0696-ssh-the-secure-shell.pdf
0696-ssh-the-secure-shell.pdf
 
Ssh
SshSsh
Ssh
 
How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7
 
SSH.pdf
SSH.pdfSSH.pdf
SSH.pdf
 
How to increase security with SSH
How to increase security with SSHHow to increase security with SSH
How to increase security with SSH
 
tutorial-ssh.pdf
tutorial-ssh.pdftutorial-ssh.pdf
tutorial-ssh.pdf
 
SSH how to 2011
SSH how to 2011SSH how to 2011
SSH how to 2011
 
Unit 13 network client
Unit 13 network clientUnit 13 network client
Unit 13 network client
 
Introduction to SSH & PGP
Introduction to SSH & PGPIntroduction to SSH & PGP
Introduction to SSH & PGP
 
OpenSSH tricks
OpenSSH tricksOpenSSH tricks
OpenSSH tricks
 
OpenSSH: keep your secrets safe
OpenSSH: keep your secrets safeOpenSSH: keep your secrets safe
OpenSSH: keep your secrets safe
 
Windowshadoop
WindowshadoopWindowshadoop
Windowshadoop
 
SSH for pen-testers
SSH for pen-testersSSH for pen-testers
SSH for pen-testers
 
Unix Security
Unix SecurityUnix Security
Unix Security
 
Linux Interview Questions and Answers.pdf
Linux Interview Questions and Answers.pdfLinux Interview Questions and Answers.pdf
Linux Interview Questions and Answers.pdf
 
linux
linuxlinux
linux
 
7 unixsecurity
7 unixsecurity7 unixsecurity
7 unixsecurity
 
Logging remotely open ssh
Logging remotely open sshLogging remotely open ssh
Logging remotely open ssh
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
 

Introduction to SSH

  • 1.  
  • 2.
  • 4.
  • 6.
  • 8.
  • 10. SSH - Generic term used for SSH protocols ssh - Client command for running remote command sshd - Server program SSH-1 - Version 1 of the protocol SSH-2 - Version 2 of the protocol OpenSSH - Product from open BSD project Terminology
  • 12. SSH Architecture The brown fox jumped over the cow The brown fox jumped over the cow Anw@dc%9r&6cbditop*dekisn@h Network ??? ssh client ssh server Authentication
  • 13. SSH Layers Ethernet Network Access Layer IP Internet Layer TCP Transport Layer ssh-transport Initial key exchange and server authentication, setup encryption ssh-userauth User authentication using public key, password, host based, etc. ssh-connection Session multiplexing, X11 and port forwarding, remote command execution, SOCKS proxy, etc. Application Layer
  • 14.
  • 15.
  • 16.
  • 17.
  • 19. You may download the source from http://www.openssh.com/ Read installation instructions to check if you have pre-requisite packages and libraries. Downloading Source Code
  • 20. gtar -xzf openssh-4.5p1.tar.gz cd openssh-4.5p1 ./configure make make install Building and installing OpenSSH
  • 22.
  • 23.
  • 24. sshd.pid - Server's PID is stored in this file System wide configuration files
  • 25.
  • 26. config - Client configuration file User specific configuration files
  • 27.
  • 28. IMPORTANT The ~/.ssh directory and the files in it must be owned by user and must be unreadable by anybody else. The ssh server will simply ignore the files with incorrect permissions. chmod -R og= ~/.ssh Configuration Permissions
  • 30.
  • 31.
  • 32. shahhe@kubuntu1:~$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/shahhe/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/shahhe/.ssh/id_dsa. Your public key has been saved in /home/shahhe/.ssh/id_dsa.pub. The key fingerprint is: 99:51:ac:02:10:0c:d4:55:09:cc:86:36:cf:59:d0:33 Generating key pairs
  • 33. shahhe@kubuntu1:~$ cat ~/.ssh/id_dsa -----BEGIN DSA PRIVATE KEY----- MIIBuwIBAAKBgQDPmC7jSBnJMoQ8o6/cF4GUDP/gsCqonA0UGs2g/92N8qVTxxZg U3MgZAQ96FAsaGKFDfsxoqbp1eXX7IXUS+erPOMQnDtbooLgZN3VpvStvV/hulnn HoFJoDmoE5MnrY0Su93jZe2mPp4hOrYYQu0/8r3YRFtAzz6TCauHFxO4DQIVAJYo apGVvbg8J1rAefSBReOef/iXAoGBAJUXbyDtR0wpyz5UKT11FmVS/a34ST9Lfzld OjR38c9sRCf8klRZ6IuqoLUZZ3jSo56+SRsraFQReCB5GLWPx5qKzHz9xi9XFseT aCb3Qh70EbiP3uAFqnTvk2K8voKC4dNIEXZ7SZXZUsWBImLaYXf/scvL7fMlMy9d fCMf8By2AoGAGEdK17lrlD7zfWUVyJm+26ZaQ/QU4Yhff6Cfoe1lnq/1UmT6SEVf SZWsj9n8fj7Ez8l03gU/g+otZXDcsS6OmNMooWkADIbkHfQ6oeoK1h/3z0hV8TY4 HnOtMZuHJMf1LPFNvINbenLS+qldGvi19aTxZUkcQJiHdpr6GR3jn9cCFE9xHd8q Y8klJEyIPYK+KQ4UrbhZ -----END DSA PRIVATE KEY----- Generating key pairs
  • 34. shahhe@kubuntu1:~$ cat ~/.ssh/id_dsa.pub ssh–dss AAAAB3NzaC1kc3MAAACBAM+YLuNIGckyhDyjr9wXgZQM/+CwKqicDRQazaD/3Y3ypVPHFmBTcyBkBD3oUCxoYoUN+zGipunV5dfshdRL56s84xCcO1uiguBk3dWm9K29X+G6WecegUmgOagTkyetjRK73eNl7aY+niE6thhC7T/yvdhEW0DPPpMJq4cXE7gNAAAAFQCWKGqRlb24PCdawHn0gUXjnn/4lwAAAIEAlRdvIO1HTCnLPlQpPXUWZVL9rfhJP0t/OV06NHfxz2xEJ/ySVFnoi6qgtRlneNKjnr5JGytoVBF4IHkYtY/HmorMfP3GL1cWx5NoJvdCHvQRuI/e4AWqdO+TYry+goLh00gRdntJldlSxYEiYtphd/+xy8vt8yUzL118Ix/wHLYAAACAGEdK17lrlD7zfWUVyJm+26ZaQ/QU4Yhff6Cfoe1lnq/1UmT6SEVfSZWsj9n8fj7Ez8l03gU/g+otZXDcsS6OmNMooWkADIbkHfQ6oeoK1h/3z0hV8TY4HnOtMZuHJMf1LPFNvINbenLS+qldGvi19aTxZUkcQJiHdpr6GR3jn9c= shahhe@kubuntu1 Generating key pairs
  • 36. shahhe@kubuntu1:~$ ssh [email_address] Last login: Mon Jun 18 21:26:33 2007 from d47-69-253-190. * Problems? Questions? Email: [email_address] * Type "whatsup" to see information posted to our "What's Up?" page. You have mail. You have 17 read messages. You have no new mail. /home/customer/shah {shah@typhoon} 1> Logging into remote system
  • 37. shahhe@kubuntu1:~$ scp .profile shah@xnet.com:tmp/profile.kubuntu .profile                         100% 566 0.6KB/s 00:00 shahhe@kubuntu1:~$ scp shah@xnet.com:tmp/profile.kubuntu tmp/. profile.kubuntu                  100% 566 0.6KB/s 00:00 Copying file to remote system
  • 38. shahhe@kubuntu1:~$ ssh shah@xnet.com ls Mail News bin mail public_html tmp Executing commands on remote system
  • 39. shahhe@kubuntu1:~$ ssh -Y shah@xnet.com /opt/sfw/bin/xterm Executing commands on remote system
  • 41.
  • 42.
  • 43. Options for authorized_keys2 file Disable X11 forwarding no-x11-forwarding Do not allocate TTY no-pty Disable port forwarding no-port-forwarding Disable forwarding agent no-agent-forwarding Limit incoming hosts from="host or ip address" Set environment variable environment="variable=value" Specify a force command command="command name" Meaning Option
  • 45. Port forwarding Insecure Client App Server App ssh client ssh server Secure
  • 46.
  • 47.
  • 49. You want to login to the computer at work from your home computer or from from hotel while traveling. The computer at work is behind the firewall so you cannot connect to it directly. You are allowed to connect to a bastion host, but are not allowed to store private keys on it. What can you do? Agent forwarding
  • 50. Agent Forwarding ssh ssh sshd (proxy agent) sshd ssh Login ssh Work Bastion Home
  • 51. The configuration is stored in /etc/ssh/sshd_config file. Port 46464 Protocol 2 PasswordAuthentication no ForwardX11 yes ForwardAgent yes Compression no sshd configuration on bastion host
  • 52. The configuration is stored in ~/.ssh/tunnel.cfg file. Host * ForwardX11 yes ForwardAgent yes NoHostAuthenticationForLocalhost yes User RemoteUser IdentityFile /home/LocalUser/.ssh/work_dsa Host bastionhost HostName 69.2.50.60 Port 46464 LocalForward 10001 10.60.80.101:22 ssh tunnel configuration on home system
  • 53. The configuration is stored in ~/.ssh/config file. Host * ForwardX11 yes ForwardAgent yes NoHostAuthenticationForLocalhost yes IdentityFile /home/LocalUser/.ssh/work_dsa Host portmap HostName localhost port 10001 LocalForward 18080 10.60.80.101:22 LocalForward 18081 10.60.80.102:22 Host host1 User RemoteUser HostName localhost Port 18080 Host host2 User RemoteUser HostName localhost Port 18081 ssh client configuration on home system
  • 54.
  • 55.
  • 57. Environment variables /dev/pts/48 Name of TTY SSH_TTY 10.90.10.107 45756 22 Client socket information SSH_CLIENT /tmp/ssh-FcRCI22249/agent.22249 Path to socket SSH_AUTH_SOCK 10.90.10.107 45756 10.90.10.182 22 Client and server socket information SSH_CONNECTION Example Meaning Variable
  • 58. Other ssh based applications
  • 59.
  • 60. PuTTY TTSSH Cygwin MSSH WinSCP FileZilla OpenSSH alternatives for windows
  • 62.
  • 64.
  • 65. http://www.openssh.com/ http://fuse.sourceforge.net/sshfs.html Barrett, D., Silverman, R., & Byrnes, R. (2005). SSH The Definitive Guide, Second Edition. O'Reilly Media, Inc. SSH FAQ http://www.employees.org/~satch/ssh/faq/ssh-faq.html Excellent agent forwarding tutorial http://unixwiz.net/techtips/ssh-agent-forwarding.html Turotial on building OpenSSH http://unixwiz.net/techtips/openssh.html Resources

Editor's Notes

  1. He designed the protocol because of a password-sniffing attack at the university. The goal was to replace telnet, rlogin, rsh commands. He documented SSH1 as an IETF internet draft. SSH-2 features both security and feature improvements over SSH-1. New features of SSH-2 include the ability to run any number of shell sessions over a single SSH connection. SCS sells its SSH products under the name Tectia There are dozens of SSH implementations but OpenSSH it the most used version.
  2. SSH-1 Original protocol, it has serious limitation. Not recommended anymore. SSH-2 Version 2 of the protocol. Currently in use. Most common protocol in use. Defined by draft standards of IETF SECSH working group.
  3. 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: Keys are exchanged The public key encryption algorithm is determined The symmetric encryption algorithm is determined The message authentication algorithm is determined The hash algorithm to be used is determined During the key exchange, the server identifies itself to the client with a unique host key. If the client has never communicated with this particular server before, the server's key will be unknown to the client and it will not connect. OpenSSH gets around this problem by accepting the server's host key after the user is notified and verifies the acceptance of the new host key. In subsequent connections, the server's host key is checked against the saved version on the client, providing confidence that the client is indeed communicating with the intended server. If, in the future, the host key no longer matches, the user must remove the client's saved version before a connection can occur. 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 then tries to authenticate itself to the server using one of these supported methods. SSH servers and clients can be configured to allow different types of authentication, which gives each side the optimal 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 and password-based authentication, are safe to use.
  4. Uses public/private key. OpenSSH supports 3DES, Blowfish, AES and arcfour as encryption algorithms. These are patent free. Encryption is started before authentication, and no passwords or other information is transmitted in the clear. Encryption is also used to protect against spoofed packets. The authentication methods are: .rhosts together with RSA based host authentication, pure RSA authentication, one-time passwords with s/key, and finally authentication using Kerberos.
  5. For more configuration parameters read INSTALL file or run configure --help --disable-suid-ssh To prevent a local root compromise if a vulnerability is found with the ssh(1) command, do not install OpenSSH with the setuid bit. The setuid bit is only needed for regression to the rsh protocol, which is disabled by the following option. --without-rsh This argument prevents the regression to the insecure rsh protocol if you are unable to connect by using the Secure Shell protocol.
  6. Private key represents your identity for outgoing connection. Client users the private key. Public key represents your identity to incoming connection. Client sends private key to the server, server then matches it with public key, according to cryptographic test, authentication succeeds and connection is allowed. Private key must be protected, public key do not need to be secret, it cannot be used to break into an account.
  7. Using ssh-agent saves you from typing your passphrase repeatedly.
  8. Starts xterm (X11 application) on the remote system and displays on client display. -X enables X11 forwarding. Does not use . Xauthority file and attacker may be able to monitor key strokes. -Y enables trusted X11 forwarding. Uses . Xauthority file.
  9. sshfs is based on FUSE - userspace file system framework. Do not run is as root, run it as a user.