You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
51 lines
1.1 KiB
7 years ago
|
#!/bin/bash
|
||
|
|
||
|
echo '<?xml version="1.0"?>'
|
||
|
echo '<!DOCTYPE cscpage SYSTEM "../csc.dtd">'
|
||
|
echo '<cscpage title="SSH Key Fingerprints">'
|
||
|
echo '<header />'
|
||
|
echo '<section title="Machine SSH Key Fingerprints">'
|
||
|
|
||
|
echo '<table>'
|
||
|
echo '<tr>'
|
||
|
echo '<th>Machine Name</th>'
|
||
|
echo '<th>Key Type</th>'
|
||
|
echo '<th>Fingerprint</th>'
|
||
|
echo '</tr>'
|
||
|
|
||
|
for host in $(ls fingerprints | egrep -oh '[^_]+' | egrep -v '.pub' | sort -u )
|
||
|
do
|
||
|
for ktype in rsa ed25519
|
||
|
do
|
||
|
none=0
|
||
|
sha256=$(ssh-keygen -lE sha256 -f fingerprints/${host}_${ktype}.pub)
|
||
|
md5=$(ssh-keygen -lE md5 -f fingerprints/${host}_${ktype}.pub)
|
||
|
|
||
|
if [ ! $? -eq 0 ]
|
||
|
then
|
||
|
none=1
|
||
|
fi
|
||
|
|
||
|
echo '<tr>'
|
||
|
echo '<td>' ${host} '</td>'
|
||
|
echo '<td>' ${ktype} '</td>'
|
||
|
|
||
|
if [ ${none} -eq 0 ]
|
||
|
then
|
||
|
echo '<td><pre>'
|
||
|
echo $(echo ${sha256} | awk '{print $2}')
|
||
|
echo $(echo ${md5} | awk '{print $2}')
|
||
|
echo '</pre></td>'
|
||
|
else
|
||
|
echo '<td><pre>(none)</pre></td>'
|
||
|
fi
|
||
|
|
||
|
echo '</tr>'
|
||
|
done
|
||
|
done
|
||
|
echo '</table>'
|
||
|
|
||
|
echo '</section>'
|
||
|
echo '<footer />'
|
||
|
echo '</cscpage>'
|