Format of private_key fingerprint in JSON export file


#1

Is there a way to generate the ssh ‘private_key’ as shown in the JSON export file programatically?


(Yang.Y) #2

The private_key actually a SHA hash code of the file, so of course yes you can.

May I ask why do you need generating the hash code programmatically?


#3

Many thanks!

Sure - We have a team using SSH Tunnel to connect to a set of remote hosts.
We generate a csv of the local -> remote ip and port mappings and from that
auto-generate the ssh tunnel config, /etc/hosts entries and useful bash
profile aliases.

This allows the team to just generate configs and import when the remote
host set changes (or a new member joins).

  • Peter


(Yang.Y) #4

Which programming language do you use for the automation script?

If that is the one I’m just familiar with, I could write a sample code for generating the hash code.


#5

Thanks, no problem, all set now. I had realized it was a sha1 but was
hashing the content instead of the file. A sha1_file() works as expected in
php…


(Yang.Y) #6

Exactly :slight_smile:

Additional note: the imported private key files are located at the folder ~/Library/Group\ Containers/E78WKS7W4U.com.codinn.ssh/, SSH Tunnel always rescans this folder at launch.