SlideShare a Scribd company logo
Importance of SSHFP
And
Configuring SSHFP for Network Devices
Muhammad Moinur Rahman
moin@bofh.im
SSHFP
root@ns:~ # ssh root@pdr.bofh.network
The authenticity of host 'pdr.bofh.network (2604:6800:0:162:0:1:0:1)'
can't be established.
ECDSA key fingerprint is
SHA256:AlzRr/ZNFC9fjs89jYAD1o2dFDs4vu3gUVUD7gI2QBk.
No matching host key fingerprint found in DNS.
Are you sure you want to continue connecting (yes/no)?
●
Have you ever logged in that host or device ?
●
Have you ever checked the public key ?
●
Do you know the SHA256 Fingerprint of the ECDSA Public Key?
●
99.9% Sysadmin or Network admin never checks it @ console
●
Victm of MITM Atack
SSHFP
●
First came up in 2006
●
Defined in RFC 4255
●
Creates a DNS record of type SSHFP
●
Distributed by DNS, Verified by DNS lookup and
secured by DNSSEC
Previous Usage
●
Distributed known_hosts file
●
Easily modify
●
No access, no verification
●
Maybe use a bastion host
known_hosts file
pdr.bofh.network ecdsa-sha2-nistp256
AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdH
AyNTYAAABBBLGgYTGJQyJFOGAn3C31QG1aw/LQDl+x
q+M1pvM6RAW8vGvuaMsS5c23PjcR0zEfsjhKCV33vY
hXf7hxshcDZVI=
●
Host
●
Algorithm
●
Public Key
Why SSHFP?
●
SSH Public Key size are large to distribute via DNS
●
So need the fingerprint
●
Fingerprint method
– Base64
– sha1/sha256 checksum
What we need?
●
Fingerprints of the host
●
Proper SSHFP DNS records
●
Zone must be DNSSEC signed
●
A DNSSEC validator DNS server or ldns support in
ssh client
●
A SSH client capable to verify DNSSEC validated
fingerprint
Fingerprints of the host?
root@pdr:~ # ssh-keygen -r pdr.bofh.network
pdr.bofh.network IN SSHFP 1 1 2cfb54c336799bf601a17a6b2723d096ed23ce55
pdr.bofh.network IN SSHFP 1 2
95a39495ec59ad717c0990bfe1f3c8ddd9e2b1201065e0ca5fc381cbc7ea8d8b
pdr.bofh.network IN SSHFP 2 1 90eb07d57e037aacbec479ed3a4c6a1264edf4f0
pdr.bofh.network IN SSHFP 2 2
eccdc4d93bb9af3eb4791e30f66aa327d9f0c9c388f5e950159ec285bb746783
pdr.bofh.network IN SSHFP 3 1 491ff6cd714362c5bae223fc2c942dbf78c3ba0e
pdr.bofh.network IN SSHFP 3 2
597d44db5b0e28f787ad5b1535e8b201e509373f8a8e711c71c950556ecdf799
pdr.bofh.network IN SSHFP 4 1 c63d32f031cc3fc7fe867baf2d0cd23d4ef25213
pdr.bofh.network IN SSHFP 4 2
15d249791d60bc46ec400c3a16a66b1cca191b2d30464707e8e5ba204dea1433
Dissecting Fingerprints
●
Hostname
●
Record CLASS (Internet)
●
Record Type (SSHFP)
●
Algorithm
– 1 – RSA
– 2 – DSA
– 3 – ECDSA
– 4 – Ed25519
●
Fingerprint TYPE
– SHA1
– SHA256
●
Key
Algorithm
●
Most modern OS will show all 4
●
Old OS might show only RSA and DSA
●
ECDSA and Ed25519 are modern Cryptographic
algorithm
●
Ed25519 added in RFC7479
●
For ECDSA and Ed25519 we need OpenSSH=>6.7
Distributing via DNS
root@pdr:~ # drill -D pdr.bofh.network sshfp
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 60914
;; flags: qr rd ra ad ; QUERY: 1, ANSWER: 9, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; pdr.bofh.network. IN SSHFP
;; ANSWER SECTION:
pdr.bofh.network. 3599 IN SSHFP 2 1 90eb07d57e037aacbec479ed3a4c6a1264edf4f0
pdr.bofh.network. 3599 IN SSHFP 3 2 597d44db5b0e28f787ad5b1535e8b201e509373f8a8e711c71c950556ecdf799
pdr.bofh.network. 3599 IN SSHFP 3 1 491ff6cd714362c5bae223fc2c942dbf78c3ba0e
pdr.bofh.network. 3599 IN SSHFP 4 2 15d249791d60bc46ec400c3a16a66b1cca191b2d30464707e8e5ba204dea1433
pdr.bofh.network. 3599 IN SSHFP 1 2 95a39495ec59ad717c0990bfe1f3c8ddd9e2b1201065e0ca5fc381cbc7ea8d8b
pdr.bofh.network. 3599 IN SSHFP 4 1 c63d32f031cc3fc7fe867baf2d0cd23d4ef25213
pdr.bofh.network. 3599 IN SSHFP 1 1 2cfb54c336799bf601a17a6b2723d096ed23ce55
pdr.bofh.network. 3599 IN SSHFP 2 2 eccdc4d93bb9af3eb4791e30f66aa327d9f0c9c388f5e950159ec285bb746783
pdr.bofh.network. 3599 IN RRSIG SSHFP 8 3 3600 20171114225917 20171031212226 15678 dzcrd.net.
QBTRbj8xtyEN/9WH/PL39n1mC0XOKmGDj5TzgP/Kkvo7ac3wPwZ92dEcVnKyi1H2e8wP6532NIMjmuveyundnavCCbstOUfFyN17fBuEtHQTJzLmp8XQ7JxDgXbzbp6bvaKrck/XBFbRfk895oI9+Spg09fYkfseN4axEVoscQY=
;; AUTHORITY SECTION:
;; ADDITIONAL SECTION:
;; Query time: 1750 msec
;; EDNS: version 0; flags: do ; udp: 512
;; SERVER: 127.0.0.1
;; WHEN: Wed Nov 1 21:35:20 2017
;; MSG SIZE rcvd: 530
SSHFP Validation with ssh client
root@ns:~ # ldd /usr/bin/ssh
/usr/bin/ssh:
libprivatessh.so.5 => /usr/lib/libprivatessh.so.5 (0x80084f000)
libgssapi.so.10 => /usr/lib/libgssapi.so.10 (0x800aee000)
libcrypto.so.8 => /lib/libcrypto.so.8 (0x800e00000)
libc.so.7 => /lib/libc.so.7 (0x801269000)
libprivateldns.so.5 => /usr/lib/libprivateldns.so.5 (0x801621000)
libcrypt.so.5 => /lib/libcrypt.so.5 (0x80187f000)
libz.so.6 => /lib/libz.so.6 (0x801a9e000)
If ldns is supported ..
●
Need to maintain a trust-anchor
● Run unbound-anchor
●
Add to /etc/resolv.conf
anchor /etc/unbound/root.key [*BSD]
anchor /var/lib/unbound/root.key [Linux]
Else ..
●
Run a validating resolver like Unbound
server:
auto-trust-anchor-file:
"/etc/unbound/root.key"
Test
● root@pdr:~$ ssh root@pdr.bofh.network
The authenticity of host 'pdr.bofh.network
(2003:51:6012:110::9)' can't be established.
ECDSA key fingerprint is
SHA256:T09/p/ZSubnkraG3oslDMehfIiLRe6UiVn1dGZvtjZE.
Are you sure you want to continue connecting (yes/no)?
^C
● root@pdr:~$ ssh -o VerifyHostKeyDNS=yes
root@pdr.bofh.network
root@pdr:~$
Test Successful
● DNSSEC Validation Works
● SSH login without .known_host works
SSH/SSHFP Demystified
●
SSH Creates Public/Private Keys
– For Linux/Unix under /etc/ssh/ssh_host_<ALGORITHM>.*
– Normally during first run of sshd service
– This part is automatic and hidden
●
ssh-keygen creates fingerprints for those keys
SSHFP for Network Equipments
●
Network Equipments don’t have ssh-keygen command
●
Equipments comes with limited subset of ssh
●
Configure ssh service for devices preferably version 2
●
Create the public/private keys normally RSA only
●
Gather the public key connecting through console or
direct point-to-point connectivity
●
Generate the Fingerprints for SSHFP records
Configuring Router
R1#conf t
R1(config)#ip domain-name bofh.network
R1(config)#crypto key generate rsa modulus 4096
R1(config)#crypto key generate rsa modulus 4096
R1(config)#crypto key generate rsa modulus 4096
R1#show ip ssh
SSH Enabled - version 2.0
Authentication timeout: 120 secs; Authentication retries: 3
Minimum expected Diffie Hellman key size : 1024 bits
IOS Keys in SECSH format(ssh-rsa, base64 encoded):
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1pb6dZ01nHBPZUZXcTxf7swq3NoNc6Geiz9C006YS
gCwz47msZn7YGIlPtrhw+GGT2jZo+34xSXekVYV9Cie+e8NI4UgD7b+aXma6aNPGfDN338jAmWBN7SDB
sZvLJnjDYndNqRtYXby8uhvzWfGNtPwIZCXgbX+nOTmCR9Ap0iFF4zxzPppwPko41xdyAaOc4qros8aR
ocLP8hrEeEz9R7WWZZ5ui/+ya3wa/SFjOZIcnv/7BKl1E5z+CM0OneDUfktw6lEd3hYGr347sz5I4Obj
ia3HJ1D3lQKtRcT8zqavdlDyaYZEvYbg4eMp6aSMjJ79BOhhGgiFJ/Mxw7isMikfd6iKisdU+pd3XxQN
mNlDywfuRKl9RYfYAVNG3PvOAqzECplh4s5+jl1+SWeKIg3ah7iFv7ddEVdBtaOrCsVxaOJuIMYPioTH
aoDNmeOpfZJa/VIqker78bTlIgIGALybnnniFYhAb9ztYJv8g14pmu7cZol3lGg9pa/Qi6sdCAVyizdj
0wsS/s8Sl8VhwoZpxEUs0XQIHEsKP47XpJdmKAWG3vYopWYz7JCRmpwl8+oRCHLL35zV4Em+BO4aH/gt
+nRQuEaVFBwaHGbe0A77d4ABIHLWAvuFb4wr+oOGoD57kDolrFYq7IfW/d261+DMr11Ip0kJEncXIgZc
Extracting Key
●
Connect with Console
●
Connect directly with point to point LAN
●
Use show ip ssh
– Copy the string starting with “ssh-rsa” and ending till last line
●
For remote connection add the key with prompt and verify
the keys
●
Save the file in a Linux/Unix host with filename like
hostname_rsa_key.pub
Using the script
#!/usr/local/bin/bash
HOST="${1}"
if [[ "$1" == "-h" || "$1" == "--help" ]]
then
echo "Usage: sshfpgen <hostname>"
fi
for pubkey in *_key.pub
do
echo "$HOST IN SSHFP 1 1 $(cut -f2 -d ' ' "$pubkey" | base64 --decode | shasum | cut -f 1 -d ' ')"
echo "$HOST IN SSHFP 1 2 $(cut -f2 -d ' ' "$pubkey" | base64 --decode | shasum -a 256 | cut -f 1 -d ' ')"
done
Running the script
root@ns:~ # ./sshfpgen r1.bofh.network
r1.bofh.network IN SSHFP 1 1 96898fe4604ed5e7b1a1c80374b1200fae3f4adb
r1.bofh.network IN SSHFP 1 2 ebfca263706e4e12c7189ae377014f30467af6e6243d3b8a7e5f763d2813023b
Adding to DNS
●
Following records were added into the DNS
r1.bofh.network IN SSHFP 1 1 96898fe4604ed5e7b1a1c80374b1200fae3f4adb
r1.bofh.network IN SSHFP 1 2 ebfca263706e4e12c7189ae377014f30467af6e6243d3b8a7e5f763d2813023b
●
DNS Query Test
$ dig SSHFP +noadditional +noquestion +nocomments +nocmd +nostats r1.bofh.network
r1.bofh.network. 3600 IN SSHFP 1 1 96898fe4604ed5e7b1a1c80374b1200fae3f4adb
r1.bofh.network. 3600 IN SSHFP 1 2 ebfca263706e4e12c7189ae377014f30467af6e6243d3b8a7e5f763d2813023b
Connectivity Test
●
Connecting without DNSSEC validation
$ ssh VerifyHostKeyDNS=yes r1.bofh.network
The authenticity of host 'r1.bofh.network (192.168.100.100)' can't be established.
RSA key fingerprint is SHA256:y2STsQ4RA/8durhpic+pb6UjcKwz7+bUaKX3C40yOGk.
Matching host key fingerprint found in DNS.
Are you sure you want to continue connecting (yes/no)?
Connectivity Test
●
Connecting with DNSSEC validation
$ ssh VerifyHostKeyDNS=yes r1.bofh.network
Username:
●
Also no records will be added in .known_host file
Live Demonstration & Questions

More Related Content

PDF
SSH: Seguranca no Acesso Remoto
Tiago Cruz
 
ODP
SSH Tunnel-Fu [NoVaH 2011]
Vincent Batts
 
PDF
SIP Attack Handling (Kamailio World 2021)
Fred Posner
 
ODP
Getting started with RDO Havana
Dan Radez
 
PDF
Da APK al Golden Ticket
Giuseppe Trotta
 
PDF
Using Kamailio for Scalability and Security
Fred Posner
 
PDF
Kamailio - SIP Firewall for Carrier Grade Traffic
Daniel-Constantin Mierla
 
PDF
Part 3 - Local Name Resolution in Linux, FreeBSD and macOS/iOS
Men and Mice
 
SSH: Seguranca no Acesso Remoto
Tiago Cruz
 
SSH Tunnel-Fu [NoVaH 2011]
Vincent Batts
 
SIP Attack Handling (Kamailio World 2021)
Fred Posner
 
Getting started with RDO Havana
Dan Radez
 
Da APK al Golden Ticket
Giuseppe Trotta
 
Using Kamailio for Scalability and Security
Fred Posner
 
Kamailio - SIP Firewall for Carrier Grade Traffic
Daniel-Constantin Mierla
 
Part 3 - Local Name Resolution in Linux, FreeBSD and macOS/iOS
Men and Mice
 

What's hot (18)

PDF
Codified PostgreSQL Schema
Sean Chittenden
 
PDF
Ssh and sshfp dns records v04
Bob Novas
 
PDF
Part 2 - Local Name Resolution in Windows Networks
Men and Mice
 
PDF
Python Cryptography & Security
Jose Manuel Ortega Candel
 
PDF
Kamailio - Load Balancing Load Balancers
Daniel-Constantin Mierla
 
PPTX
Configuring ssh on switch
tcpipguru
 
PPT
Fileextraction with suricata
MrArora Arjuna
 
DOCX
NAS Botnet Revealed - Mining Bitcoin
Davide Cioccia
 
PDF
Ssh cookbook
Jean-Marie Renouard
 
PDF
Relayd: a load balancer for OpenBSD
Giovanni Bechis
 
PDF
Advanced open ssh
Dan Kaminsky
 
PDF
DNS High-Availability Tools - Open-Source Load Balancing Solutions
Men and Mice
 
PDF
DNSSEC signing Tutorial
Men and Mice
 
PDF
Instant DevOps
Ferenc Erki
 
PPTX
Ansible ssh y comandos ad-hoc
Raul Hugo
 
PDF
Centralized Logging with syslog
amiable_indian
 
PDF
Packet crafting of2013
Shteryana Shopova
 
PDF
Yeti DNS - Experimenting at the root
Men and Mice
 
Codified PostgreSQL Schema
Sean Chittenden
 
Ssh and sshfp dns records v04
Bob Novas
 
Part 2 - Local Name Resolution in Windows Networks
Men and Mice
 
Python Cryptography & Security
Jose Manuel Ortega Candel
 
Kamailio - Load Balancing Load Balancers
Daniel-Constantin Mierla
 
Configuring ssh on switch
tcpipguru
 
Fileextraction with suricata
MrArora Arjuna
 
NAS Botnet Revealed - Mining Bitcoin
Davide Cioccia
 
Ssh cookbook
Jean-Marie Renouard
 
Relayd: a load balancer for OpenBSD
Giovanni Bechis
 
Advanced open ssh
Dan Kaminsky
 
DNS High-Availability Tools - Open-Source Load Balancing Solutions
Men and Mice
 
DNSSEC signing Tutorial
Men and Mice
 
Instant DevOps
Ferenc Erki
 
Ansible ssh y comandos ad-hoc
Raul Hugo
 
Centralized Logging with syslog
amiable_indian
 
Packet crafting of2013
Shteryana Shopova
 
Yeti DNS - Experimenting at the root
Men and Mice
 
Ad

Similar to Importance of SSHFP for Network Devices (20)

PDF
Open ssh cheet sheat
Piyush Mittal
 
PDF
Dssh @ Confidence, Prague 2010
Juraj Bednar
 
PDF
An introduction to SSH
nussbauml
 
PDF
IBM Ported Tools for z/OS: OpenSSH User's Guide
IBM India Smarter Computing
 
PPT
Presentation nix
fangjiafu
 
PPT
Presentation nix
fangjiafu
 
PDF
OpenSSH: keep your secrets safe
Giovanni Bechis
 
DOCX
Research and Analysis of SSH
Matthew Chang
 
PPT
Secure shell ppt
sravya raju
 
PDF
tutorial-ssh.pdf
NigussMehari4
 
PDF
Passive SSH, a Fast-Lookup Database of SSH Key Materials to Support Incident ...
adulau
 
PPTX
SSh_part_1.pptx
Shelly119532
 
PPT
Bh usa-01-kaminsky
Dan Kaminsky
 
PDF
SSH - Secure Shell
Peter R. Egli
 
PDF
Secure shell(ssh) AND telnet AND CONSOLE
AmiraMohamedGalal
 
PPT
Ssh
gh02
 
PDF
Efficient System Monitoring in Cloud Native Environments
Gergely Szabó
 
PDF
Windowshadoop
arunkumar sadhasivam
 
PPTX
Cfgmgmtcamp 2023 — eBPF Superpowers
Raphaël PINSON
 
PDF
Service intergration
재민 장
 
Open ssh cheet sheat
Piyush Mittal
 
Dssh @ Confidence, Prague 2010
Juraj Bednar
 
An introduction to SSH
nussbauml
 
IBM Ported Tools for z/OS: OpenSSH User's Guide
IBM India Smarter Computing
 
Presentation nix
fangjiafu
 
Presentation nix
fangjiafu
 
OpenSSH: keep your secrets safe
Giovanni Bechis
 
Research and Analysis of SSH
Matthew Chang
 
Secure shell ppt
sravya raju
 
tutorial-ssh.pdf
NigussMehari4
 
Passive SSH, a Fast-Lookup Database of SSH Key Materials to Support Incident ...
adulau
 
SSh_part_1.pptx
Shelly119532
 
Bh usa-01-kaminsky
Dan Kaminsky
 
SSH - Secure Shell
Peter R. Egli
 
Secure shell(ssh) AND telnet AND CONSOLE
AmiraMohamedGalal
 
Ssh
gh02
 
Efficient System Monitoring in Cloud Native Environments
Gergely Szabó
 
Windowshadoop
arunkumar sadhasivam
 
Cfgmgmtcamp 2023 — eBPF Superpowers
Raphaël PINSON
 
Service intergration
재민 장
 
Ad

More from APNIC (20)

PDF
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
PDF
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
PDF
APNIC's Role in the Pacific Islands, presented at Pacific IGF 2205
APNIC
 
PDF
IPv6 Deployment and Best Practices, presented by Makito Lay
APNIC
 
PDF
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
PDF
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PDF
Transmission Control Protocol (TCP) and Starlink
APNIC
 
PDF
DDoS in India, presented at INNOG 8 by Dave Phelan
APNIC
 
PDF
Global Networking Trends, presented at the India ISP Conclave 2025
APNIC
 
PDF
Make DDoS expensive for the threat actors
APNIC
 
PDF
Fast Reroute in SR-MPLS, presented at bdNOG 19
APNIC
 
PDF
DDos Mitigation Strategie, presented at bdNOG 19
APNIC
 
PDF
ICP -2 Review – What It Is, and How to Participate and Provide Your Feedback
APNIC
 
PDF
APNIC Update - Global Synergy among the RIRs: Connecting the Regions
APNIC
 
PDF
Measuring Starlink Protocol Performance, presented at LACNIC 43
APNIC
 
PDF
Prop-154: Resizing of IPv4 assignments for IXPs
APNIC
 
PDF
Internet Exchange Points, presented at Peering Workshop at the PITA 29th AGM,...
APNIC
 
PDF
Exploring the Evolving Internet Landscape
APNIC
 
PDF
Regional Development for an Open, Stable, and Secure Internet
APNIC
 
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
APNIC's Role in the Pacific Islands, presented at Pacific IGF 2205
APNIC
 
IPv6 Deployment and Best Practices, presented by Makito Lay
APNIC
 
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
The Internet - By the numbers, presented at npNOG 11
APNIC
 
Transmission Control Protocol (TCP) and Starlink
APNIC
 
DDoS in India, presented at INNOG 8 by Dave Phelan
APNIC
 
Global Networking Trends, presented at the India ISP Conclave 2025
APNIC
 
Make DDoS expensive for the threat actors
APNIC
 
Fast Reroute in SR-MPLS, presented at bdNOG 19
APNIC
 
DDos Mitigation Strategie, presented at bdNOG 19
APNIC
 
ICP -2 Review – What It Is, and How to Participate and Provide Your Feedback
APNIC
 
APNIC Update - Global Synergy among the RIRs: Connecting the Regions
APNIC
 
Measuring Starlink Protocol Performance, presented at LACNIC 43
APNIC
 
Prop-154: Resizing of IPv4 assignments for IXPs
APNIC
 
Internet Exchange Points, presented at Peering Workshop at the PITA 29th AGM,...
APNIC
 
Exploring the Evolving Internet Landscape
APNIC
 
Regional Development for an Open, Stable, and Secure Internet
APNIC
 

Recently uploaded (20)

PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PPTX
Crypto Recovery California Services.pptx
lionsgate network
 
PPTX
Pengenalan perangkat Jaringan komputer pada teknik jaringan komputer dan tele...
Prayudha3
 
PPTX
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
PPTX
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
PPTX
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
PDF
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PPTX
ppt lighfrsefsefesfesfsefsefsefsefserrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrt.pptx
atharvawafgaonkar
 
PPTX
Parallel & Concurrent ...
yashpavasiya892
 
PPTX
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
PDF
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
PDF
LOGENVIDAD DANNYFGRETRRTTRRRTRRRRRRRRR.pdf
juan456ytpro
 
PPTX
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PPTX
Blue and Dark Blue Modern Technology Presentation.pptx
ap177979
 
PPTX
The Monk and the Sadhurr and the story of how
BeshoyGirgis2
 
PDF
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
PDF
Slides: PDF Eco Economic Epochs for World Game (s) pdf
Steven McGee
 
PPTX
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
PDF
Data Protection & Resilience in Focus.pdf
AmyPoblete3
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
Crypto Recovery California Services.pptx
lionsgate network
 
Pengenalan perangkat Jaringan komputer pada teknik jaringan komputer dan tele...
Prayudha3
 
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
ppt lighfrsefsefesfesfsefsefsefsefserrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrt.pptx
atharvawafgaonkar
 
Parallel & Concurrent ...
yashpavasiya892
 
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
LOGENVIDAD DANNYFGRETRRTTRRRTRRRRRRRRR.pdf
juan456ytpro
 
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
Blue and Dark Blue Modern Technology Presentation.pptx
ap177979
 
The Monk and the Sadhurr and the story of how
BeshoyGirgis2
 
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
Slides: PDF Eco Economic Epochs for World Game (s) pdf
Steven McGee
 
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
Data Protection & Resilience in Focus.pdf
AmyPoblete3
 

Importance of SSHFP for Network Devices

  • 1. Importance of SSHFP And Configuring SSHFP for Network Devices Muhammad Moinur Rahman [email protected]
  • 2. SSHFP root@ns:~ # ssh [email protected] The authenticity of host 'pdr.bofh.network (2604:6800:0:162:0:1:0:1)' can't be established. ECDSA key fingerprint is SHA256:AlzRr/ZNFC9fjs89jYAD1o2dFDs4vu3gUVUD7gI2QBk. No matching host key fingerprint found in DNS. Are you sure you want to continue connecting (yes/no)? ● Have you ever logged in that host or device ? ● Have you ever checked the public key ? ● Do you know the SHA256 Fingerprint of the ECDSA Public Key? ● 99.9% Sysadmin or Network admin never checks it @ console ● Victm of MITM Atack
  • 3. SSHFP ● First came up in 2006 ● Defined in RFC 4255 ● Creates a DNS record of type SSHFP ● Distributed by DNS, Verified by DNS lookup and secured by DNSSEC
  • 4. Previous Usage ● Distributed known_hosts file ● Easily modify ● No access, no verification ● Maybe use a bastion host
  • 6. Why SSHFP? ● SSH Public Key size are large to distribute via DNS ● So need the fingerprint ● Fingerprint method – Base64 – sha1/sha256 checksum
  • 7. What we need? ● Fingerprints of the host ● Proper SSHFP DNS records ● Zone must be DNSSEC signed ● A DNSSEC validator DNS server or ldns support in ssh client ● A SSH client capable to verify DNSSEC validated fingerprint
  • 8. Fingerprints of the host? root@pdr:~ # ssh-keygen -r pdr.bofh.network pdr.bofh.network IN SSHFP 1 1 2cfb54c336799bf601a17a6b2723d096ed23ce55 pdr.bofh.network IN SSHFP 1 2 95a39495ec59ad717c0990bfe1f3c8ddd9e2b1201065e0ca5fc381cbc7ea8d8b pdr.bofh.network IN SSHFP 2 1 90eb07d57e037aacbec479ed3a4c6a1264edf4f0 pdr.bofh.network IN SSHFP 2 2 eccdc4d93bb9af3eb4791e30f66aa327d9f0c9c388f5e950159ec285bb746783 pdr.bofh.network IN SSHFP 3 1 491ff6cd714362c5bae223fc2c942dbf78c3ba0e pdr.bofh.network IN SSHFP 3 2 597d44db5b0e28f787ad5b1535e8b201e509373f8a8e711c71c950556ecdf799 pdr.bofh.network IN SSHFP 4 1 c63d32f031cc3fc7fe867baf2d0cd23d4ef25213 pdr.bofh.network IN SSHFP 4 2 15d249791d60bc46ec400c3a16a66b1cca191b2d30464707e8e5ba204dea1433
  • 9. Dissecting Fingerprints ● Hostname ● Record CLASS (Internet) ● Record Type (SSHFP) ● Algorithm – 1 – RSA – 2 – DSA – 3 – ECDSA – 4 – Ed25519 ● Fingerprint TYPE – SHA1 – SHA256 ● Key
  • 10. Algorithm ● Most modern OS will show all 4 ● Old OS might show only RSA and DSA ● ECDSA and Ed25519 are modern Cryptographic algorithm ● Ed25519 added in RFC7479 ● For ECDSA and Ed25519 we need OpenSSH=>6.7
  • 11. Distributing via DNS root@pdr:~ # drill -D pdr.bofh.network sshfp ;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 60914 ;; flags: qr rd ra ad ; QUERY: 1, ANSWER: 9, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;; pdr.bofh.network. IN SSHFP ;; ANSWER SECTION: pdr.bofh.network. 3599 IN SSHFP 2 1 90eb07d57e037aacbec479ed3a4c6a1264edf4f0 pdr.bofh.network. 3599 IN SSHFP 3 2 597d44db5b0e28f787ad5b1535e8b201e509373f8a8e711c71c950556ecdf799 pdr.bofh.network. 3599 IN SSHFP 3 1 491ff6cd714362c5bae223fc2c942dbf78c3ba0e pdr.bofh.network. 3599 IN SSHFP 4 2 15d249791d60bc46ec400c3a16a66b1cca191b2d30464707e8e5ba204dea1433 pdr.bofh.network. 3599 IN SSHFP 1 2 95a39495ec59ad717c0990bfe1f3c8ddd9e2b1201065e0ca5fc381cbc7ea8d8b pdr.bofh.network. 3599 IN SSHFP 4 1 c63d32f031cc3fc7fe867baf2d0cd23d4ef25213 pdr.bofh.network. 3599 IN SSHFP 1 1 2cfb54c336799bf601a17a6b2723d096ed23ce55 pdr.bofh.network. 3599 IN SSHFP 2 2 eccdc4d93bb9af3eb4791e30f66aa327d9f0c9c388f5e950159ec285bb746783 pdr.bofh.network. 3599 IN RRSIG SSHFP 8 3 3600 20171114225917 20171031212226 15678 dzcrd.net. QBTRbj8xtyEN/9WH/PL39n1mC0XOKmGDj5TzgP/Kkvo7ac3wPwZ92dEcVnKyi1H2e8wP6532NIMjmuveyundnavCCbstOUfFyN17fBuEtHQTJzLmp8XQ7JxDgXbzbp6bvaKrck/XBFbRfk895oI9+Spg09fYkfseN4axEVoscQY= ;; AUTHORITY SECTION: ;; ADDITIONAL SECTION: ;; Query time: 1750 msec ;; EDNS: version 0; flags: do ; udp: 512 ;; SERVER: 127.0.0.1 ;; WHEN: Wed Nov 1 21:35:20 2017 ;; MSG SIZE rcvd: 530
  • 12. SSHFP Validation with ssh client root@ns:~ # ldd /usr/bin/ssh /usr/bin/ssh: libprivatessh.so.5 => /usr/lib/libprivatessh.so.5 (0x80084f000) libgssapi.so.10 => /usr/lib/libgssapi.so.10 (0x800aee000) libcrypto.so.8 => /lib/libcrypto.so.8 (0x800e00000) libc.so.7 => /lib/libc.so.7 (0x801269000) libprivateldns.so.5 => /usr/lib/libprivateldns.so.5 (0x801621000) libcrypt.so.5 => /lib/libcrypt.so.5 (0x80187f000) libz.so.6 => /lib/libz.so.6 (0x801a9e000)
  • 13. If ldns is supported .. ● Need to maintain a trust-anchor ● Run unbound-anchor ● Add to /etc/resolv.conf anchor /etc/unbound/root.key [*BSD] anchor /var/lib/unbound/root.key [Linux]
  • 14. Else .. ● Run a validating resolver like Unbound server: auto-trust-anchor-file: "/etc/unbound/root.key"
  • 15. Test ● root@pdr:~$ ssh [email protected] The authenticity of host 'pdr.bofh.network (2003:51:6012:110::9)' can't be established. ECDSA key fingerprint is SHA256:T09/p/ZSubnkraG3oslDMehfIiLRe6UiVn1dGZvtjZE. Are you sure you want to continue connecting (yes/no)? ^C ● root@pdr:~$ ssh -o VerifyHostKeyDNS=yes [email protected] root@pdr:~$
  • 16. Test Successful ● DNSSEC Validation Works ● SSH login without .known_host works
  • 17. SSH/SSHFP Demystified ● SSH Creates Public/Private Keys – For Linux/Unix under /etc/ssh/ssh_host_<ALGORITHM>.* – Normally during first run of sshd service – This part is automatic and hidden ● ssh-keygen creates fingerprints for those keys
  • 18. SSHFP for Network Equipments ● Network Equipments don’t have ssh-keygen command ● Equipments comes with limited subset of ssh ● Configure ssh service for devices preferably version 2 ● Create the public/private keys normally RSA only ● Gather the public key connecting through console or direct point-to-point connectivity ● Generate the Fingerprints for SSHFP records
  • 19. Configuring Router R1#conf t R1(config)#ip domain-name bofh.network R1(config)#crypto key generate rsa modulus 4096 R1(config)#crypto key generate rsa modulus 4096 R1(config)#crypto key generate rsa modulus 4096 R1#show ip ssh SSH Enabled - version 2.0 Authentication timeout: 120 secs; Authentication retries: 3 Minimum expected Diffie Hellman key size : 1024 bits IOS Keys in SECSH format(ssh-rsa, base64 encoded): ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1pb6dZ01nHBPZUZXcTxf7swq3NoNc6Geiz9C006YS gCwz47msZn7YGIlPtrhw+GGT2jZo+34xSXekVYV9Cie+e8NI4UgD7b+aXma6aNPGfDN338jAmWBN7SDB sZvLJnjDYndNqRtYXby8uhvzWfGNtPwIZCXgbX+nOTmCR9Ap0iFF4zxzPppwPko41xdyAaOc4qros8aR ocLP8hrEeEz9R7WWZZ5ui/+ya3wa/SFjOZIcnv/7BKl1E5z+CM0OneDUfktw6lEd3hYGr347sz5I4Obj ia3HJ1D3lQKtRcT8zqavdlDyaYZEvYbg4eMp6aSMjJ79BOhhGgiFJ/Mxw7isMikfd6iKisdU+pd3XxQN mNlDywfuRKl9RYfYAVNG3PvOAqzECplh4s5+jl1+SWeKIg3ah7iFv7ddEVdBtaOrCsVxaOJuIMYPioTH aoDNmeOpfZJa/VIqker78bTlIgIGALybnnniFYhAb9ztYJv8g14pmu7cZol3lGg9pa/Qi6sdCAVyizdj 0wsS/s8Sl8VhwoZpxEUs0XQIHEsKP47XpJdmKAWG3vYopWYz7JCRmpwl8+oRCHLL35zV4Em+BO4aH/gt +nRQuEaVFBwaHGbe0A77d4ABIHLWAvuFb4wr+oOGoD57kDolrFYq7IfW/d261+DMr11Ip0kJEncXIgZc
  • 20. Extracting Key ● Connect with Console ● Connect directly with point to point LAN ● Use show ip ssh – Copy the string starting with “ssh-rsa” and ending till last line ● For remote connection add the key with prompt and verify the keys ● Save the file in a Linux/Unix host with filename like hostname_rsa_key.pub
  • 21. Using the script #!/usr/local/bin/bash HOST="${1}" if [[ "$1" == "-h" || "$1" == "--help" ]] then echo "Usage: sshfpgen <hostname>" fi for pubkey in *_key.pub do echo "$HOST IN SSHFP 1 1 $(cut -f2 -d ' ' "$pubkey" | base64 --decode | shasum | cut -f 1 -d ' ')" echo "$HOST IN SSHFP 1 2 $(cut -f2 -d ' ' "$pubkey" | base64 --decode | shasum -a 256 | cut -f 1 -d ' ')" done
  • 22. Running the script root@ns:~ # ./sshfpgen r1.bofh.network r1.bofh.network IN SSHFP 1 1 96898fe4604ed5e7b1a1c80374b1200fae3f4adb r1.bofh.network IN SSHFP 1 2 ebfca263706e4e12c7189ae377014f30467af6e6243d3b8a7e5f763d2813023b
  • 23. Adding to DNS ● Following records were added into the DNS r1.bofh.network IN SSHFP 1 1 96898fe4604ed5e7b1a1c80374b1200fae3f4adb r1.bofh.network IN SSHFP 1 2 ebfca263706e4e12c7189ae377014f30467af6e6243d3b8a7e5f763d2813023b ● DNS Query Test $ dig SSHFP +noadditional +noquestion +nocomments +nocmd +nostats r1.bofh.network r1.bofh.network. 3600 IN SSHFP 1 1 96898fe4604ed5e7b1a1c80374b1200fae3f4adb r1.bofh.network. 3600 IN SSHFP 1 2 ebfca263706e4e12c7189ae377014f30467af6e6243d3b8a7e5f763d2813023b
  • 24. Connectivity Test ● Connecting without DNSSEC validation $ ssh VerifyHostKeyDNS=yes r1.bofh.network The authenticity of host 'r1.bofh.network (192.168.100.100)' can't be established. RSA key fingerprint is SHA256:y2STsQ4RA/8durhpic+pb6UjcKwz7+bUaKX3C40yOGk. Matching host key fingerprint found in DNS. Are you sure you want to continue connecting (yes/no)?
  • 25. Connectivity Test ● Connecting with DNSSEC validation $ ssh VerifyHostKeyDNS=yes r1.bofh.network Username: ● Also no records will be added in .known_host file
  • 26. Live Demonstration & Questions