SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
OpenSSH: keep your secrets safe
Giovanni Bechis
<giovanni@openbsd.org>
OpenSourceDay 2015
About Me
sys admin and developer @SNB
OpenBSD developer
Open Source developer in several other projects
What is OpenSSH ?
Free SSH implementation,
used for secure communications and transfer files.
What is OpenSSH ?
free license
strong crypto inside (3Des, Blowfish, AES, Arcfour)
X11 forwarding
port forwarding (cryptography for plain text
protocols)
strong authentication (Public key, One time
password, Kerberos)
file transfer
data compression
a bit of history
1995
Tatu Ylonen releases ssh-1.0.0
SSH Communications Security Inc.
1999
OpenSSH project birth, based on ssh-1 source code
2000
SSH version 2 protocol has been added to OpenSSH
2002
SSH added support to Solaris 9 (based on OpenSSH
source code)
2006
SSH version 2 protocol has been defined standard
IETF
2015
Microsoft announces support for ssh protocol in
Powershell
SSH protocol
connection starts on port 22
client and server determine protocol version to use
server always have private/public key pair
public key is sent during connection phase
client caches server’s public key to prevent ”man in
the middle” attacks
SSH protocol
The protocol version is determined based on banner
SSH protocol
SSH-1.5 ⇒ ssh version 1
SSH-1.99 ⇒ ssh version 1 and 2
SSH-2.0 ⇒ ssh version 2
SSH version 1
do not use it !!
version 1 is the original protocol version as released
by Tatu Ylonen
modified between 1995 and 1997
final version is 1.5
it has never become a standard
monolithic structure
SSH version 2, modular structure
transport protocol
manages cryptography, compression and integrity
provides ”services”
authentication protocol
permits the authentication of the client
supports many authentication methods
Password
Public key
Challenge-response
Host based
connection protocol
interactive logins
command execution
port forwarding
X11 forwarding
SSH versions
weak integrity checks in ssh 1.x crc
packets can be spoofed
lot of complex tricks to detect attacks
attacks cannot be prevented, only checked
man in the middle attacks are easier with ssh 1.x
the problem is before public key exchange phase
key exchange with D-H in ssh 2.x removes this
problem if publick keys are used
SSH 2.x is recommended because:
a lot more secure
the protocol is an IETF standard
extensible protocol
but it has more per packet overhead
SSH anatomy
SSH code security
code audit
input validation
no buffer overflows
no memory leaks
no unsecure functions used
all unsecure functions has been removed, and the
secure counterpart has been used instead
strcpy ⇒ strlcpy
atoi ⇒ strtonum
sandboxing techniques are used
setrlimit(2)
pledge(2)
other sandboxing techniques in portable version
complex code removal
openssl ASN.1 parser has been replaced by a minimal
parser
SSH code security
process separation
monitor process runs as uid 0
slave process chroots in /var/empty
slave process is executed as dedicated user in
pre-auth or as logged-in user in post-auth phase
changes to the protocol
protocol compression is activated only in post-auth
phase to minimize the effects of possible bugs in zlib
sshd double exec is used to better use mitigation
techniques available in some operating systems
(OpenBSD, recent Windows versions, Linux +
patches, ...)
OpenSSH configuration
Server configuration file is /etc/ssh/sshd config
Port 22
ListenAddress 0.0.0.0
Protocol 2
UsePrivilegeSeparation sandbox
StrictModes yes
PermitRootLogin prohibit-password
OpenSSH configuration
Some other useful feautures
certificate and S/Key authentication
chroot
X11 forwarding
port forwarding
socks proxy
persistent connections
visual fingerprints
vpn
Using certificates
$ ssh-keygen
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
SHA256:uuNH/ECxy0i1T19EHXovdbfs3e134b4Yv++PpB1dPtc giovanni@ssh-test.org
The key’s randomart image is:
+---[RSA 2048]----+
| ..o.|
| o o .|
| . + o .+|
| . + . +.=|
| . =S+ . ..oo|
| ..* . . .=*|
| .. o .+oE|
| ... . ++==|
| .oo ..+*%|
+----[SHA256]-----+
$ ssh-add
Enter passphrase for /home/giovanni/.ssh/id_rsa:
Identity added: /home/giovanni/.ssh/id_rsa (/home/giovanni/.ssh/id_rsa)
$
sftp chroot
In some situations you should not permit a user to explore
the whole filesystem
Subsystem sftp internal
Match user giovanni
ForceCommand internal-sftp
ChrootDirectory /chroot
port forwarding
If a firewall is blocking some services you need to access,
you could use a machine that will act as a bridge.
ssh -L 9025:mail.example.net:25 shell.example.net
dynamic port forwarding
Using ”dynamic port forwarding” you can tell sshd to act as
a socks proxy. This way you can use Firefox to browse the
internet with the public ip address of the remote machine.
ssh -D 8080 shell.example.net
using a ”bridge” machine
Sometimes it could be useful to use a ”bridge” machine to
be able to reach a remote shell without a public ip.
Host public-ip
ServerAliveInterval 60
ProxyCommand ssh machine-lan nc -w 180 %h %p
persistent connections
If you connect more than a time to the same machine you
can avoid typing the same password all the times.
Host *
ControlMaster auto
ControlPath /tmp/%r@%h:%p
visual fingerprints
Using the visualfingerprint parameter in /etc/ssh/ssh config
you a visual fingerprint of the server you connect to will be
printed.
$ ssh shell.example.net
+---[RSA 2048]----+
| ..o.|
| o o .|
| . + o .+|
| . + . +.=|
| . =S+ . ..oo|
| ..* . . .=*|
| .. o .+oE|
| ... . ++==|
| .oo ..+*%|
+----[SHA256]-----+
ClusterSSH
ClusterSSH opens terminal windows with connections to
specified hosts and an administration console. Any text
typed into the administration console is replicated to all
other connected and active windows.
OpenSSH: keep your secrets safe

Mais conteúdo relacionado

Mais procurados

Centralized Logging with syslog
Centralized Logging with syslogCentralized Logging with syslog
Centralized Logging with syslogamiable_indian
 
Securing the tunnel with Raccoon
Securing the tunnel with RaccoonSecuring the tunnel with Raccoon
Securing the tunnel with RaccoonGloria Stoilova
 
An introduction to SSH
An introduction to SSHAn introduction to SSH
An introduction to SSHnussbauml
 
Nagios Conference 2013 - Leland Lammert - Nagios in a Multi-Platform Enviornment
Nagios Conference 2013 - Leland Lammert - Nagios in a Multi-Platform EnviornmentNagios Conference 2013 - Leland Lammert - Nagios in a Multi-Platform Enviornment
Nagios Conference 2013 - Leland Lammert - Nagios in a Multi-Platform EnviornmentNagios
 
Secure shell
Secure shellSecure shell
Secure shellArjun Aj
 
Secure Shell(ssh)
Secure Shell(ssh)Secure Shell(ssh)
Secure Shell(ssh)Pina Parmar
 
Ssh and sshfp dns records v04
Ssh and sshfp dns records v04Ssh and sshfp dns records v04
Ssh and sshfp dns records v04Bob Novas
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemCyber Security Alliance
 
Fileextraction with suricata
Fileextraction with suricataFileextraction with suricata
Fileextraction with suricataMrArora Arjuna
 
Ssh And Rlogin
Ssh And RloginSsh And Rlogin
Ssh And RloginSourav Roy
 
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0Zabbix
 

Mais procurados (19)

Sockets intro
Sockets introSockets intro
Sockets intro
 
Introduction to SSH & PGP
Introduction to SSH & PGPIntroduction to SSH & PGP
Introduction to SSH & PGP
 
Centralized Logging with syslog
Centralized Logging with syslogCentralized Logging with syslog
Centralized Logging with syslog
 
Securing the tunnel with Raccoon
Securing the tunnel with RaccoonSecuring the tunnel with Raccoon
Securing the tunnel with Raccoon
 
Ssh tunnel
Ssh tunnelSsh tunnel
Ssh tunnel
 
An introduction to SSH
An introduction to SSHAn introduction to SSH
An introduction to SSH
 
Secure shell protocol
Secure shell protocolSecure shell protocol
Secure shell protocol
 
Nagios Conference 2013 - Leland Lammert - Nagios in a Multi-Platform Enviornment
Nagios Conference 2013 - Leland Lammert - Nagios in a Multi-Platform EnviornmentNagios Conference 2013 - Leland Lammert - Nagios in a Multi-Platform Enviornment
Nagios Conference 2013 - Leland Lammert - Nagios in a Multi-Platform Enviornment
 
Ssh
SshSsh
Ssh
 
Secure shell
Secure shellSecure shell
Secure shell
 
Secure SHell
Secure SHellSecure SHell
Secure SHell
 
Secure Shell(ssh)
Secure Shell(ssh)Secure Shell(ssh)
Secure Shell(ssh)
 
Ssh and sshfp dns records v04
Ssh and sshfp dns records v04Ssh and sshfp dns records v04
Ssh and sshfp dns records v04
 
Reverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande ModemReverse engineering Swisscom's Centro Grande Modem
Reverse engineering Swisscom's Centro Grande Modem
 
Fileextraction with suricata
Fileextraction with suricataFileextraction with suricata
Fileextraction with suricata
 
Ssh And Rlogin
Ssh And RloginSsh And Rlogin
Ssh And Rlogin
 
Python build your security tools.pdf
Python build your security tools.pdfPython build your security tools.pdf
Python build your security tools.pdf
 
Netcat cheat sheet_v1
Netcat cheat sheet_v1Netcat cheat sheet_v1
Netcat cheat sheet_v1
 
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
Rihards Olups - Encrypting Daemon Traffic With Zabbix 3.0
 

Destaque

Programa cs naturales marzo 2013 1
Programa cs naturales  marzo 2013 1Programa cs naturales  marzo 2013 1
Programa cs naturales marzo 2013 1profesoraudp
 
The place to be in love
The place to be in loveThe place to be in love
The place to be in loveMarius Enea
 
ΚΕΙΜΕΝΑ ΜΑΘΗΤΩΝ
ΚΕΙΜΕΝΑ ΜΑΘΗΤΩΝΚΕΙΜΕΝΑ ΜΑΘΗΤΩΝ
ΚΕΙΜΕΝΑ ΜΑΘΗΤΩΝgvlachos
 
Recursos naturales
Recursos naturalesRecursos naturales
Recursos naturalesprofesoraudp
 
Gayosso keren act.final_valores
Gayosso keren act.final_valoresGayosso keren act.final_valores
Gayosso keren act.final_valoresKeren Gacruz
 
Antiguo Egipto
Antiguo EgiptoAntiguo Egipto
Antiguo Egiptocrabielsa
 

Destaque (10)

Publicasion de poster
Publicasion de posterPublicasion de poster
Publicasion de poster
 
Propuesta TGGROUP para Mexicana
Propuesta TGGROUP para MexicanaPropuesta TGGROUP para Mexicana
Propuesta TGGROUP para Mexicana
 
Programa cs naturales marzo 2013 1
Programa cs naturales  marzo 2013 1Programa cs naturales  marzo 2013 1
Programa cs naturales marzo 2013 1
 
K p t
K p tK p t
K p t
 
The place to be in love
The place to be in loveThe place to be in love
The place to be in love
 
ΚΕΙΜΕΝΑ ΜΑΘΗΤΩΝ
ΚΕΙΜΕΝΑ ΜΑΘΗΤΩΝΚΕΙΜΕΝΑ ΜΑΘΗΤΩΝ
ΚΕΙΜΕΝΑ ΜΑΘΗΤΩΝ
 
Hospitality
HospitalityHospitality
Hospitality
 
Recursos naturales
Recursos naturalesRecursos naturales
Recursos naturales
 
Gayosso keren act.final_valores
Gayosso keren act.final_valoresGayosso keren act.final_valores
Gayosso keren act.final_valores
 
Antiguo Egipto
Antiguo EgiptoAntiguo Egipto
Antiguo Egipto
 

Semelhante a OpenSSH: keep your secrets safe

Ssh
SshSsh
Sshgh02
 
Unit 13 network client
Unit 13 network clientUnit 13 network client
Unit 13 network clientroot_fibo
 
Presentation nix
Presentation nixPresentation nix
Presentation nixfangjiafu
 
Presentation nix
Presentation nixPresentation nix
Presentation nixfangjiafu
 
Ssh (The Secure Shell)
Ssh (The Secure Shell)Ssh (The Secure Shell)
Ssh (The Secure Shell)Mehedi Farazi
 
Unix Security
Unix SecurityUnix Security
Unix Securityreplay21
 
0696-ssh-the-secure-shell.pdf
0696-ssh-the-secure-shell.pdf0696-ssh-the-secure-shell.pdf
0696-ssh-the-secure-shell.pdfAnasElbaz
 
Server hardening
Server hardeningServer hardening
Server hardeningTeja Babu
 
Share File easily between computers using sftp
Share File easily between computers using sftpShare File easily between computers using sftp
Share File easily between computers using sftpTushar B Kute
 
Introducing bastion hosts for oracle cloud infrastructure v1.0
Introducing bastion hosts for oracle cloud infrastructure v1.0Introducing bastion hosts for oracle cloud infrastructure v1.0
Introducing bastion hosts for oracle cloud infrastructure v1.0maaz khan
 
Using Secure Shell on Linux: What Everyone Should Know
Using Secure Shell on Linux: What Everyone Should KnowUsing Secure Shell on Linux: What Everyone Should Know
Using Secure Shell on Linux: What Everyone Should KnowNovell
 

Semelhante a OpenSSH: keep your secrets safe (20)

Ssh
SshSsh
Ssh
 
Windowshadoop
WindowshadoopWindowshadoop
Windowshadoop
 
tutorial-ssh.pdf
tutorial-ssh.pdftutorial-ssh.pdf
tutorial-ssh.pdf
 
Unit 13 network client
Unit 13 network clientUnit 13 network client
Unit 13 network client
 
Meeting 5.2 : ssh
Meeting 5.2 : sshMeeting 5.2 : ssh
Meeting 5.2 : ssh
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
 
Presentation nix
Presentation nixPresentation nix
Presentation nix
 
ssh
sshssh
ssh
 
SSH.ppt
SSH.pptSSH.ppt
SSH.ppt
 
Remote Login
Remote LoginRemote Login
Remote Login
 
Ssh (The Secure Shell)
Ssh (The Secure Shell)Ssh (The Secure Shell)
Ssh (The Secure Shell)
 
Intro to SSH
Intro to SSHIntro to SSH
Intro to SSH
 
OpenSSH tricks
OpenSSH tricksOpenSSH tricks
OpenSSH tricks
 
Unix Security
Unix SecurityUnix Security
Unix Security
 
0696-ssh-the-secure-shell.pdf
0696-ssh-the-secure-shell.pdf0696-ssh-the-secure-shell.pdf
0696-ssh-the-secure-shell.pdf
 
Linux Workshop , Day 3
Linux Workshop , Day 3Linux Workshop , Day 3
Linux Workshop , Day 3
 
Server hardening
Server hardeningServer hardening
Server hardening
 
Share File easily between computers using sftp
Share File easily between computers using sftpShare File easily between computers using sftp
Share File easily between computers using sftp
 
Introducing bastion hosts for oracle cloud infrastructure v1.0
Introducing bastion hosts for oracle cloud infrastructure v1.0Introducing bastion hosts for oracle cloud infrastructure v1.0
Introducing bastion hosts for oracle cloud infrastructure v1.0
 
Using Secure Shell on Linux: What Everyone Should Know
Using Secure Shell on Linux: What Everyone Should KnowUsing Secure Shell on Linux: What Everyone Should Know
Using Secure Shell on Linux: What Everyone Should Know
 

Mais de Giovanni Bechis

SpamAssassin 4.0 new features
SpamAssassin 4.0 new featuresSpamAssassin 4.0 new features
SpamAssassin 4.0 new featuresGiovanni Bechis
 
ACME and mod_md: tls certificates made easy
ACME and mod_md: tls certificates made easyACME and mod_md: tls certificates made easy
ACME and mod_md: tls certificates made easyGiovanni Bechis
 
Scaling antispam solutions with Puppet
Scaling antispam solutions with PuppetScaling antispam solutions with Puppet
Scaling antispam solutions with PuppetGiovanni Bechis
 
What's new in SpamAssassin 3.4.3
What's new in SpamAssassin 3.4.3What's new in SpamAssassin 3.4.3
What's new in SpamAssassin 3.4.3Giovanni Bechis
 
Fighting Spam for fun and profit
Fighting Spam for fun and profitFighting Spam for fun and profit
Fighting Spam for fun and profitGiovanni Bechis
 
Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)Giovanni Bechis
 
Pf: the OpenBSD packet filter
Pf: the OpenBSD packet filterPf: the OpenBSD packet filter
Pf: the OpenBSD packet filterGiovanni Bechis
 
ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management frameworkGiovanni Bechis
 
SOGo: sostituire Microsoft Exchange con software Open Source
SOGo: sostituire Microsoft Exchange con software Open SourceSOGo: sostituire Microsoft Exchange con software Open Source
SOGo: sostituire Microsoft Exchange con software Open SourceGiovanni Bechis
 
Cloud storage, i tuoi files, ovunque con te
Cloud storage, i tuoi files, ovunque con teCloud storage, i tuoi files, ovunque con te
Cloud storage, i tuoi files, ovunque con teGiovanni Bechis
 
Npppd: easy vpn with OpenBSD
Npppd: easy vpn with OpenBSDNpppd: easy vpn with OpenBSD
Npppd: easy vpn with OpenBSDGiovanni Bechis
 
Openssh: comunicare in sicurezza
Openssh: comunicare in sicurezzaOpenssh: comunicare in sicurezza
Openssh: comunicare in sicurezzaGiovanni Bechis
 
Ipv6: il futuro di internet
Ipv6: il futuro di internetIpv6: il futuro di internet
Ipv6: il futuro di internetGiovanni Bechis
 
L'ABC della crittografia
L'ABC della crittografiaL'ABC della crittografia
L'ABC della crittografiaGiovanni Bechis
 
Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD Giovanni Bechis
 
Pf e netfilter, analisi dei firewall open source
Pf e netfilter, analisi dei firewall open sourcePf e netfilter, analisi dei firewall open source
Pf e netfilter, analisi dei firewall open sourceGiovanni Bechis
 

Mais de Giovanni Bechis (20)

the Apache way
the Apache waythe Apache way
the Apache way
 
SpamAssassin 4.0 new features
SpamAssassin 4.0 new featuresSpamAssassin 4.0 new features
SpamAssassin 4.0 new features
 
ACME and mod_md: tls certificates made easy
ACME and mod_md: tls certificates made easyACME and mod_md: tls certificates made easy
ACME and mod_md: tls certificates made easy
 
Scaling antispam solutions with Puppet
Scaling antispam solutions with PuppetScaling antispam solutions with Puppet
Scaling antispam solutions with Puppet
 
What's new in SpamAssassin 3.4.3
What's new in SpamAssassin 3.4.3What's new in SpamAssassin 3.4.3
What's new in SpamAssassin 3.4.3
 
Fighting Spam for fun and profit
Fighting Spam for fun and profitFighting Spam for fun and profit
Fighting Spam for fun and profit
 
Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)
 
Pledge in OpenBSD
Pledge in OpenBSDPledge in OpenBSD
Pledge in OpenBSD
 
Pf: the OpenBSD packet filter
Pf: the OpenBSD packet filterPf: the OpenBSD packet filter
Pf: the OpenBSD packet filter
 
ELK: a log management framework
ELK: a log management frameworkELK: a log management framework
ELK: a log management framework
 
LibreSSL
LibreSSLLibreSSL
LibreSSL
 
SOGo: sostituire Microsoft Exchange con software Open Source
SOGo: sostituire Microsoft Exchange con software Open SourceSOGo: sostituire Microsoft Exchange con software Open Source
SOGo: sostituire Microsoft Exchange con software Open Source
 
Cloud storage, i tuoi files, ovunque con te
Cloud storage, i tuoi files, ovunque con teCloud storage, i tuoi files, ovunque con te
Cloud storage, i tuoi files, ovunque con te
 
Npppd: easy vpn with OpenBSD
Npppd: easy vpn with OpenBSDNpppd: easy vpn with OpenBSD
Npppd: easy vpn with OpenBSD
 
Openssh: comunicare in sicurezza
Openssh: comunicare in sicurezzaOpenssh: comunicare in sicurezza
Openssh: comunicare in sicurezza
 
Ipv6: il futuro di internet
Ipv6: il futuro di internetIpv6: il futuro di internet
Ipv6: il futuro di internet
 
L'ABC della crittografia
L'ABC della crittografiaL'ABC della crittografia
L'ABC della crittografia
 
Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD Relayd: a load balancer for OpenBSD
Relayd: a load balancer for OpenBSD
 
Pf e netfilter, analisi dei firewall open source
Pf e netfilter, analisi dei firewall open sourcePf e netfilter, analisi dei firewall open source
Pf e netfilter, analisi dei firewall open source
 
Mysql diventa grande
Mysql diventa grandeMysql diventa grande
Mysql diventa grande
 

Último

Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburgmasabamasaba
 

Último (20)

Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 

OpenSSH: keep your secrets safe

  • 1. OpenSSH: keep your secrets safe Giovanni Bechis <giovanni@openbsd.org> OpenSourceDay 2015
  • 2. About Me sys admin and developer @SNB OpenBSD developer Open Source developer in several other projects
  • 3. What is OpenSSH ? Free SSH implementation, used for secure communications and transfer files.
  • 4. What is OpenSSH ? free license strong crypto inside (3Des, Blowfish, AES, Arcfour) X11 forwarding port forwarding (cryptography for plain text protocols) strong authentication (Public key, One time password, Kerberos) file transfer data compression
  • 5. a bit of history 1995 Tatu Ylonen releases ssh-1.0.0 SSH Communications Security Inc. 1999 OpenSSH project birth, based on ssh-1 source code 2000 SSH version 2 protocol has been added to OpenSSH 2002 SSH added support to Solaris 9 (based on OpenSSH source code) 2006 SSH version 2 protocol has been defined standard IETF 2015 Microsoft announces support for ssh protocol in Powershell
  • 6. SSH protocol connection starts on port 22 client and server determine protocol version to use server always have private/public key pair public key is sent during connection phase client caches server’s public key to prevent ”man in the middle” attacks
  • 7. SSH protocol The protocol version is determined based on banner
  • 8. SSH protocol SSH-1.5 ⇒ ssh version 1 SSH-1.99 ⇒ ssh version 1 and 2 SSH-2.0 ⇒ ssh version 2
  • 9. SSH version 1 do not use it !! version 1 is the original protocol version as released by Tatu Ylonen modified between 1995 and 1997 final version is 1.5 it has never become a standard monolithic structure
  • 10. SSH version 2, modular structure transport protocol manages cryptography, compression and integrity provides ”services” authentication protocol permits the authentication of the client supports many authentication methods Password Public key Challenge-response Host based connection protocol interactive logins command execution port forwarding X11 forwarding
  • 11. SSH versions weak integrity checks in ssh 1.x crc packets can be spoofed lot of complex tricks to detect attacks attacks cannot be prevented, only checked man in the middle attacks are easier with ssh 1.x the problem is before public key exchange phase key exchange with D-H in ssh 2.x removes this problem if publick keys are used SSH 2.x is recommended because: a lot more secure the protocol is an IETF standard extensible protocol but it has more per packet overhead
  • 13. SSH code security code audit input validation no buffer overflows no memory leaks no unsecure functions used all unsecure functions has been removed, and the secure counterpart has been used instead strcpy ⇒ strlcpy atoi ⇒ strtonum sandboxing techniques are used setrlimit(2) pledge(2) other sandboxing techniques in portable version complex code removal openssl ASN.1 parser has been replaced by a minimal parser
  • 14. SSH code security process separation monitor process runs as uid 0 slave process chroots in /var/empty slave process is executed as dedicated user in pre-auth or as logged-in user in post-auth phase changes to the protocol protocol compression is activated only in post-auth phase to minimize the effects of possible bugs in zlib sshd double exec is used to better use mitigation techniques available in some operating systems (OpenBSD, recent Windows versions, Linux + patches, ...)
  • 15. OpenSSH configuration Server configuration file is /etc/ssh/sshd config Port 22 ListenAddress 0.0.0.0 Protocol 2 UsePrivilegeSeparation sandbox StrictModes yes PermitRootLogin prohibit-password
  • 16. OpenSSH configuration Some other useful feautures certificate and S/Key authentication chroot X11 forwarding port forwarding socks proxy persistent connections visual fingerprints vpn
  • 17. Using certificates $ ssh-keygen Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in id_rsa. Your public key has been saved in id_rsa.pub. The key fingerprint is: SHA256:uuNH/ECxy0i1T19EHXovdbfs3e134b4Yv++PpB1dPtc giovanni@ssh-test.org The key’s randomart image is: +---[RSA 2048]----+ | ..o.| | o o .| | . + o .+| | . + . +.=| | . =S+ . ..oo| | ..* . . .=*| | .. o .+oE| | ... . ++==| | .oo ..+*%| +----[SHA256]-----+ $ ssh-add Enter passphrase for /home/giovanni/.ssh/id_rsa: Identity added: /home/giovanni/.ssh/id_rsa (/home/giovanni/.ssh/id_rsa) $
  • 18. sftp chroot In some situations you should not permit a user to explore the whole filesystem Subsystem sftp internal Match user giovanni ForceCommand internal-sftp ChrootDirectory /chroot
  • 19. port forwarding If a firewall is blocking some services you need to access, you could use a machine that will act as a bridge. ssh -L 9025:mail.example.net:25 shell.example.net
  • 20. dynamic port forwarding Using ”dynamic port forwarding” you can tell sshd to act as a socks proxy. This way you can use Firefox to browse the internet with the public ip address of the remote machine. ssh -D 8080 shell.example.net
  • 21. using a ”bridge” machine Sometimes it could be useful to use a ”bridge” machine to be able to reach a remote shell without a public ip. Host public-ip ServerAliveInterval 60 ProxyCommand ssh machine-lan nc -w 180 %h %p
  • 22. persistent connections If you connect more than a time to the same machine you can avoid typing the same password all the times. Host * ControlMaster auto ControlPath /tmp/%r@%h:%p
  • 23. visual fingerprints Using the visualfingerprint parameter in /etc/ssh/ssh config you a visual fingerprint of the server you connect to will be printed. $ ssh shell.example.net +---[RSA 2048]----+ | ..o.| | o o .| | . + o .+| | . + . +.=| | . =S+ . ..oo| | ..* . . .=*| | .. o .+oE| | ... . ++==| | .oo ..+*%| +----[SHA256]-----+
  • 24. ClusterSSH ClusterSSH opens terminal windows with connections to specified hosts and an administration console. Any text typed into the administration console is replicated to all other connected and active windows.