OpenSSH – Public Key Authentication ● Jonathan Schipp ● Dubois County Linux User Group ● Nov 7 th 2010 ● jonschipp (at) gmail.com.

Slides:



Advertisements
Similar presentations
Sonny J Zambrana University of Pennsylvania ISC-SEO November 2008.
Advertisements

1 Automated SFTP Windows and SUN Linux and SUN. 2 Vocabulary  Client = local=the machine generating the SFTP request  Server = remote = the machine.
SSH Operation and Techniques - © William Stearns 1 SSH Operation and Techniques The Swiss Army Knife of encryption tools…
Secure Shell – SSH Tam Ngo Steve Licking cs265. Overview Introduction Brief History and Background of SSH Differences between SSH-1 and SSH- 2 Brief Overview.
SSH : The Secure Shell By Rachana Maheswari CS265 Spring 2003.
Remote access and file transfer Getting files on and off Bio-Linux.
Firewalls, Perimeter Protection, and VPNs - SANS © SSH Operation The Swiss Army Knife of encryption tools…
Ssh: secure shell. overview Purpose Protocol specifics Configuration Security considerations Other uses.
SSH Keys William Stearns
SUSE Linux Enterprise Desktop Administration Chapter 5 Manage the Network Configuration.
SSH. Review 1-minute exercise: Find the open ports on you own VM [Good] nmap [Better] netstat -lpunt.
Building service testbeds on FIRE D5.2.5 Virtual Cluster on Federated Cloud Demonstration Kit August 2012 Version 1.0 Copyright © 2012 CESGA. All rights.
SUSE Linux Enterprise Server Administration (Course 3037) Chapter 10 Manage Remote Access.
The Saigon CTT Chapter 16 Remote Connectivity. The Saigon CTT  Objectives  Explain : telnet rsh ssh  Configure FTP.
Authentication and Authorization Authentication is the process of verifying a principal’s identity (but how to define “identity”?) –Who the person is –Or,
Secure Shell for Computer Science Nick Czebiniak Sung-Ho Maeung.
Andreas Steffen, , 11-SSH.pptx 1 Internet Security 1 (IntSi1) Prof. Dr. Andreas Steffen M. Liebi Institute for Internet Technologies and Applications.
Implementing a Port Knocking System in C Honors Thesis Defense by Matt Doyle.
We will now practice the following concepts: - The use of known_hosts files - SSH connection with password authentication - RSA version 2 protocol key.
Linux Services Muhammad Amer. 2 xinetd Programs  In computer networking, xinetd, the eXtended InterNET Daemon, is an open-source super-server daemon.
1 Securing Data and Communication. 2 Module - Securing Data and Communication ♦ Overview Data and communication over public networks like Internet can.
CSCE 815 Network Security Lecture 26 SSH and SSH Implementation April 24, 2003.
Linux Networking Security Sunil Manhapra & Ling Wang Project Report for CS691X July 15, 1998.
Application Services COM211 Communications and Networks CDA College Theodoros Christophides
Secure Shell (SSH) Presented By Scott Duckworth April 19, 2007.
SSH Operation The Swiss Army Knife of encryption tools…
SSH Tricks Slide 1 SSH Tricks Matthew G. Marsh. SSH Tricks Slide 2 Overview  SSH –What is it –How does it work  Discussion of Network Topology –Tricks.
Phil Hurvitz Securing UNIX Servers with the Secure.
SSH Tricks for CSF Slide 1 NEbraskaCERT SSH Tricks Matthew G. Marsh 05/21/03.
Hepix LAL April 2001 An alternative to ftp : bbftp Gilles Farrache In2p3 Computing Center
XWN740 X-Windows Configuring and Using Remote Access (Chapter 13: Pages )‏
SECURE SHELL MONIKA GUPTA COT OUTLINE What is SSH ? What is SSH ? History History Functions of Secure Shell ? Functions of Secure Shell ? Elements.
COOKIES AND SESSIONS.
SSH. 2 SSH – Secure Shell SSH is a cryptographic protocol – Implemented in software originally for remote login applications – One most popular software.
1 Example security systems n Kerberos n Secure shell.
Linux Basics Part 2. VIM Editor vi improved Installed on most Linux machines Can be a bit confusing at first... o Cheat sheets FTW Other popular editors:
1 Free Electrons. Kernel, drivers and embedded Linux development, consulting, training and support. http//free-electrons.com SSH Thomas Petazzoni Free.
Security with SSH Unix System Administration Workshop AfNOG 2007 Hervey Allen.
Security with SSH ISP Services Workshop SANOG 9 Hervey Allen.
SSH - Lab We will now practice the following concepts: - The use of known_hosts files - SSH connection with password authentication - RSA version 2.
Ssh: secure shell.
Programming Tools Most of the programming assignments will require using the C language. We will use a current version of the GCC C compiler. What’s GCC?
Gnucash Is a nice home accounting system to track financial information and here's a way to let more than one person to access it. In this presentation,
CReSIS Git Tutorial.
Tutorial on Creating Certificates SSH Kerberos
Hillsborough Community College
cctld Workshop Georgetown, Guyana Hervey Allen
SECURE SHELL MONIKA GUPTA COT 4810.
Outline What does the OS protect? Authentication for operating systems
AFNOG 5 Workshop Hervey Allen
Radius, LDAP, Radius used in Authenticating Users
Part 3 – Remote Connection, File Transfer, Remote Environments
XWN740 X-Windows Configuring and Using Remote Access
Fundamental Concepts in Security and its Application Cloud Computing
Getting SSH to Work Between Computers
Tutorial on Creating Certificates SSH Kerberos
SSSD and OpenSSH Integration
Outline What does the OS protect? Authentication for operating systems
Using SSL – Secure Socket Layer
SSH SSH is “Secure SHell” Secure, compressed, widely supported, fast
SSH: SECURE LOGIN CONNECTIONS OVER THE INTERNET
Cookies and sessions Saturday, February 23, 2019Saturday, February 23,
SSH Foo KW-LUG Presentation Epoch jasoneckert.net.
Chapter 7 Network Applications
Preventing Privilege Escalation
Presentation transcript:

OpenSSH – Public Key Authentication ● Jonathan Schipp ● Dubois County Linux User Group ● Nov 7 th 2010 ● jonschipp (at) gmail.com

Why use Pub-Keys ● More “secure” than using password authentication. ● Passwords aren't sent over the wire ● Passwords attacks are ineffective(dictionary, bruteforce) ● Keys are much harder to guess than passwords ● Helps circumvent MITM attacks (assuming the attacker ● doesn't have your public key.

Other benefits? ● Automatic login is possible via the ssh-agent. ● Also, its possible to have automatic logins for multiple machines and through multiple machines by agent forwarding

● A user creates a pair of public and private keys, and installs the public key in his $HOME/.ssh/authorized_keys file on the target server. This is nonsensitive information which need not be guarded, but the other half — the private key — is protected on the local machine by a (hopefully) strong passphrase. ● A public key is a long string of bits encoded in ASCII, and it's stored on one long line (though represented here on three continued lines for readability). It includes a type (ssh-rsa, or others), the key itself, and a comment: ● ssh-rsa AzAAB3NzaC1yc2EaaaabiWaaaieaX9AyNR7xWnW0eI3x2NGXrJ 4gkQpK/EqpkveGCvvbMoH84zqu3Us8jSaQD392JZAEAhGSoe0d WMBFm9Y41VGZYmncwkfTQPFH1P07vDw49aTAa2RJNFyVQA NZCbSocDeuT0Q7usuUj/v8h27+PqsUUl9XVQSDIhXBkWV+bJa wc1c= Steve's key

How it works ● 1.The user makes an initial connection and sends a username along with a request to use a key. ● 2. The ssh daemon on the server looks in the user's authorized_keys file, constructs a challenge based on the public key found there, and sends this challenge back to the user's ssh client. ● 3. The ssh client receives the key challenge. It finds the user's private key on the local system, but it's protected by an encrypting passphrase. ● 4. The user is prompted for the passphrase to unlock the private key. ● 5. ssh uses the private key to construct a key response, and sends it to the waiting sshd on the other end of the connection. It does not send the private key itself! ● 6. sshd validates the key response, and if valid, grants access to the system.

ssh-keygen ● We must generate our ssh keys, one private and one public. ● Generate RSA keys: ssh-keygen -t rsa ● Generate DSA keys: ssh-keygen -t dsa ● You will now have a pair of keys located your home ● directory: ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub ● or ~/.ssh/id_dsa and ~/.ssh/id_dsa.pub ●

ssh-keygen ● You can set the key bit length with -b ● ssh-keygen -b t dsa ● And of course, the.pub is the public key and the other is the private. ● Technically, the private key also has the public key in the same file. ● Keep your private key safe, you will be authenticating to it! When you create your key, you will be asked to create a password. This password will be used to unlock the private key.

Next step ● You must copy your public key to the remote ssh server. Log into the remote machine and copy your public key to your home directory on the remote server. ● In your home directory create a file called authorized_keys2 or authorized_keys (depending on openssh version) and move it to ~/.ssh/authorized_keys2 ● Now, check your server's sshd_config file and make sure that the PubKeyAuthentication directive is set to Yes.

That's it! ● It's not too hard. ● Now, when you use the ssh client and it asks for your password you will be giving the password to unlock the private key. ● If you have multiple private keys for multiple servers append them to your authorized_keys(2) file.

ssh-agent ● This tool runs in the background with the purpose of keeping your private key in memory, so that you can avoid unlocking your key each time you would like to connect to your ssh server. ● You can launch ssh-agent by calling it from a shell, but unfortunately, it is only good for that shell session. ● The idea is that ssh-agent is started in the beginning of an X-session or a login session, and all other windows or programs are started as clients to the ssh-agent program. ● To avoid having to launch each all the time (defeating its purpose) you can use a script or run it from your.xsession script or do what I do and create an alias for X. Add this line to your.bash_profile or.profile etc ● alias startx=”ssh-agent startx”

ssh-add ● Next we must add the key to the agent. ● When run without arguments, it adds the files ● ~/.ssh/id_rsa, ~/.ssh/id_dsa and ~/.ssh/identity. ● The identity file is a version 1 RSA key file. The others are version 2(DSA and RSA) ● The server also authenticates itself to you with its ● identity file. ● Of course, you must authenticate once.

ssh-add cont. ● If you have more keys for other servers, you can use ● ssh-add to add them individually into the agent. ● You can list the keys public keys held by the agent: -L ● List key fingerprints of keys held by the agent: -l ● Remove all keys from the agent: -D ● To remove a specific key: -d ● To add individual keys use: ssh-add

Agent forwarding ● Now, say we want to log into a machine and then from that machine into another and so on and so forth. ● We can still avoid having to use passwords by using what is called agent forwarding. You just need one agent in memory with all the necessary keys, and the necessary public keys on the server. ● On each server make sure AgentForwarding is set to Yes in the sshd_config file. ● Also, make sure the client file is set to use forwarding as well, /etc/ssh/ssh_config (global) or one in your ~/.ssh/config (local user)

resources ● ● forwarding.html ●