
This changes all output write-ssh-key-fingerprints to go to its stdout by redirecting stderr to stdout. The reason for this is that cc_keys_to_console.py was swallowing stderr and not replaying it to /dev/console. Ideally, we'd have a way in 'util.subp' to do effectively the same thing as we're doing here in the shell script.
30 lines
879 B
Bash
Executable File
30 lines
879 B
Bash
Executable File
#!/bin/sh
|
|
exec 2>&1
|
|
fp_blist=",${1},"
|
|
key_blist=",${2},"
|
|
{
|
|
echo
|
|
echo "#############################################################"
|
|
echo "-----BEGIN SSH HOST KEY FINGERPRINTS-----"
|
|
for f in /etc/ssh/ssh_host_*key.pub; do
|
|
[ -f "$f" ] || continue
|
|
read ktype line < "$f"
|
|
# skip the key if its type is in the blacklist
|
|
[ "${fp_blist#*,$ktype,}" = "${fp_blist}" ] || continue
|
|
ssh-keygen -l -f "$f"
|
|
done
|
|
echo "-----END SSH HOST KEY FINGERPRINTS-----"
|
|
echo "#############################################################"
|
|
|
|
echo -----BEGIN SSH HOST KEY KEYS-----
|
|
for f in /etc/ssh/ssh_host_*key.pub; do
|
|
[ -f "$f" ] || continue
|
|
read ktype line < "$f"
|
|
# skip the key if its type is in the blacklist
|
|
[ "${key_blist#*,$ktype,}" = "${key_blist}" ] || continue
|
|
cat $f
|
|
done
|
|
echo -----END SSH HOST KEY KEYS-----
|
|
|
|
} | logger -p user.info --stderr -t "ec2"
|