You are browsing a read-only backup copy of Wikitech. The live site can be found at

Help:SSH Fingerprints

From Wikitech-static
Revision as of 21:12, 1 May 2018 by imported>Krinkle
Jump to navigation Jump to search

New fingerprint pages should be fully-protected. Here is a list of all sub-pages:

To find this information, locally you can just run this:


on any host (from ./modules/base/files/environment/gen_fingerprints), or...:

for file in /etc/ssh/*; do ssh-keygen -lf $file; done

To get the ECDSA base64 fingerprint, login to the bastion for the host, then run the following command:

ssh-keyscan -t ecdsa <hostname> 2>/dev/null | awk '{print $3}' | base64 -d | sha256sum -b | awk '{print $1}' | xxd -r -p | base64

If that doesn't work, you might try using ssh -o FingerprintHash=md5 and comparing the MD5 checksum against the fingerprints on subpages here (or the fingerprint derived when attempting to SSH from the bastion host), or try the following Python code.

Remotely (and to format it for these pages), something like this should work:

import sys
if len(sys.argv) == 0:
	print('Must specify hostname')
hostname = sys.argv[1]
port = 22
if len(sys.argv) > 2:
	port = sys.argv[2]

import collections, subprocess, tempfile
with tempfile.NamedTemporaryFile() as tf:
	keyscanCommand = 'ssh-keyscan', '-t', 'rsa,ecdsa,ed25519', '-p', str(port), hostname, stdout = tf.file, stderr = open('/dev/null'))

	fingerprints = collections.defaultdict(list)
	for fingerprintHash in ['md5', 'sha256']:
		keygenCommand = ['ssh-keygen', '-l', '-E', fingerprintHash, '-f',]
		keygenProcess = subprocess.Popen(keygenCommand, stdout = subprocess.PIPE)
		stdout, stderr = keygenProcess.communicate()
		for line in stdout.decode('ascii').splitlines():
			bitlen, fingerprint, hostname, type = line.split(' ')

	for type, keys in fingerprints.items():
		print(';' + type + ':')
		for key in keys:
			print('* <code>' + key + '</code>')

Assuming you have OpenSSH 6.8+ (Ubuntu 15.10 provides 6.9). If you don't, you'll need to get rid of the 'sha256' list entry and remove the "'-E', fingerprintHash, ".