Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
SSH That Wonderful Thing
Search
Marc Cluet
June 09, 2013
Technology
92
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SSH That Wonderful Thing
Marc Cluet
June 09, 2013
More Decks by Marc Cluet
See All by Marc Cluet
FOSDEM'14 - Autoscaling Best Practices
lynxman
1
120
A metadata ocean in Chef and Puppet
lynxman
0
64
Rackspace Hack Night - Vagrant & Packer
lynxman
0
150
Innovation in the Cloud - Rackspace Zurich Event
lynxman
0
110
Introduction to DevOps - Rackspace Tech Night
lynxman
1
85
Introduction To Hadoop
lynxman
1
120
Hadoop Operations
lynxman
0
120
Networking & DNS 101
lynxman
0
100
Juju and Puppet - Rapid Harmonious Deployment
lynxman
0
110
Other Decks in Technology
See All in Technology
SoccerMaster: A Vision Foundation Model for Soccer Understanding
kzykmyzw
0
130
カードゲーム作りが教えてくれた プロダクトオーナーシップ
moritamasami
0
110
Oracle Exadata Database Service on Cloud@Customer X11M (ExaDB-C@C) サービス概要
oracle4engineer
PRO
2
8.4k
ゴールデンパスは敷いただけでは道にならない ─ 企画部門のエンジニアが技術標準を事業価値に変えるまで
mhrtech
1
200
凡エンジニアがこの先生きのこるためには。〜TypeScript完全に理解したい〜
alchemy1115
2
310
CSに"SLO"は要らない、経営層に"99.9%"は伝わらない - SREを全社に"翻訳"する3原則
cscengineer
PRO
1
5k
しぶいSRE: サーバから見えない障害にどう向き合うか。ラストワンマイルのデバッグ実践 / Shibui SRE
kanny
13
6.5k
発表と総括 / Presentations and Summary
ks91
PRO
0
140
非定型なドキュメントを効率よくリファクタする 〜えぇ!?仕様書27本の移行が1日で終わったって!?〜
subroh0508
2
550
アップデートで何が変わった?デモで学んで使いこなすIBM Bob2.0
muehara
0
110
誤解だらけの開発生産性 / Myths and Misconceptions about Developer Productivity
i35_267
2
780
AI、CDK と協働する Full TypeScript アプリケーション開発 / Full TypeScript Application with AI and CDK
geekplus_tech
2
360
Featured
See All Featured
Practical Orchestrator
shlominoach
191
11k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
870
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.4k
What's in a price? How to price your products and services
michaelherold
247
13k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
150
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
180
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
360
Embracing the Ebb and Flow
colly
88
5.1k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
A Tale of Four Properties
chriscoyier
163
24k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Transcript
Marc Cluet – Lynx Consultants How I learned to
stop worrying and love the shell
What we’ll cover? ¡ Understand how SSH works ¡
Get a clear picture of how ssh bastion hosts work ¡ Be able to do more awesome stuff with SSH! Lynx Consultants © 2013
What is SSH? ¡ Secure Shell (SSH) is a cryptographic
network protocol for secure data communication, remote shell services or command execution and other secure network services between two networked computers that it connects via a secure channel over an insecure network: a server and a client (running SSH server and SSH client programs, respectively).[1] The protocol specification distinguishes two major versions that are referred to as SSH-‐1 and SSH-‐2…. *whew* Lynx Consultants © 2013
But really, what is SSH? ¡ SSH opens a terminal
connection to a remote host ¡ It does so using cryptography to avoid any break or leak in communication ¡ It is a very powerful tool for remote execution ¡ It is awesome! Lynx Consultants © 2013
How does SSH create a connection? ¡ You run your
SSH command ssh user@host ¡ SSH client connects to host ¡ SSH client negotiates with host crypto and version ¡ SSH host requests authentication (password, certificates) ¡ SSH client replies with the crypto challenge ¡ Communication is open! Lynx Consultants © 2013
Authentication methods ¡ Password § Typical manual password
§ Turing keyboard test ¡ Certificates § Public Key certificates (RSA1, RSA, DSA, GSS) § Host-‐based certificates Lynx Consultants © 2013
Certificates ¡ A certificate ensures your identity by providing a
crypto key divided in public and private parts (asymmetric cryptography) ¡ A public crypto key can be shared and is mathematically linked to the private key ¡ A private key shouldn’t be shared and is able to unlock and decipher the ciphertext Lynx Consultants © 2013
Certificates ¡ A certificate can be generated for each host
or group of hosts you want to access ¡ Each certificate can and should be protected by a password for extra security ¡ Certificates are easy to revoke, so in case of any incident a new certificate can be generated Lynx Consultants © 2013
Certificates ¡ Run the command § ssh-‐keygen –t rsa
~/.ssh/id_foryournetwork ¡ This will create a unique certificate for network hosts ¡ All your other hosts or keys (github, etc) are safely different Lynx Consultants © 2013
Security risks of running an infrastructure ¡ If we leave
password authentication open we’re subject to dictionary attacks § The whole system strength is defined by the weakest password ¡ Each host that has ssh open is another security risk ¡ All this can be resolved by Bastion Hosts! Lynx Consultants © 2013
What is a Bastion Host? Lynx Consultants © 2013
What is a Bastion Host? ¡ A Bastion Host sits
between two networks, one trusted and one untrusted ¡ It regulates traffic between those networks, highlighting any malicious traffic and refusing it ¡ It is the first line of defence in a system Lynx Consultants © 2013
SSH Configuration ¡ Here’s an example # Config to
access bastion host! Host bastionhost! !User myuser! !IdentityFile ~/.ssh/id_mynetwork! !Hostname 1.2.3.4! Lynx Consultants © 2013
How to Diagnose connections ¡ Always run ssh –v (-‐v
for verbose) ¡ Make sure you test each point of your connection Lynx Consultants © 2013
How to Diagnose connections ¡ Always run ssh –v (-‐v
for verbose) ¡ Make sure you test each point of your connection § First bastion host § Then proceed further up ¡ Regular issues § Lack of Certificate § DNS problem § Internets is broken Lynx Consultants © 2013
Awesome Stuff – Port Redirection ¡ You can redirect a
port from your machine to the remote host or the other way around § -‐L myport:destination:destport ▪ Forwards a connection made to localhost 8080 to myhost port 80 (-‐ L 8080:myhost:80) Lynx Consultants © 2013
Awesome Stuff – Port Redirection ¡ You can redirect a
port from your machine to the remote host or the other way around § -‐R remoteport:destination:destport ▪ Forwards a connection made to destination port 8080 to localhost port 80 (-‐R 80:myhost:8080) Lynx Consultants © 2013
Awesome Stuff – Socks Proxy ¡ You can create a
SOCKS Proxy transparently with SSH § This will allow you to navigate the remote network as if it was your own ¡ ssh –D2222 user@myhost ¡ Configure your browser to use a SOCKS proxy at localhost port 2222 ¡ Navigate to all internal network pages! Lynx Consultants © 2013
Questions? Lynx Consultants © 2013