그냥 (에 따라 서버에서 허용 된 모든 키 암호의 지문을 가진 테이블을 인쇄합니다 작은 bash는 스크립트를 만들어 /etc/ssh/sshd_config
모두) SSH-256
와 MD5
너 한테을. 다음은 예제 출력입니다.
+---------+---------+-----------------------------------------------------+
| Cipher | Algo | Fingerprint |
+---------+---------+-----------------------------------------------------+
| RSA | MD5 | MD5:15:66:80:fd:79:d8:c0:92:e8:39:4a:bc:4e:c4:00:15 |
| RSA | SHA-256 | SHA256:G+rKuLGk+8Z1oxUV3cox0baNsH0qGQWm/saWPr4qZMM |
+---------+---------+-----------------------------------------------------+
| ECDSA | MD5 | MD5:f5:90:5c:03:2e:38:1b:c9:86:bd:86:47:5d:22:79:17 |
| ECDSA | SHA-256 | SHA256:GGmuOzsG4EGeRV9KD1WK7tRf3nIc40k/5jRgbTZDpTo |
+---------+---------+-----------------------------------------------------+
| ED25519 | MD5 | MD5:d1:5a:04:56:37:f4:75:19:22:e6:e5:d7:41:fd:79:fa |
| ED25519 | SHA-256 | SHA256:QVdqYeVzvsP4n5yjuN3D2fu8hDhskOxQCQAV5f9QK7w |
+---------+---------+-----------------------------------------------------+
+---[RSA 2048]----+ +---[RSA 2048]----+ +---[ECDSA 256]---+ +---[ECDSA 256]---+ +--[ED25519 256]--+ +--[ED25519 256]--+
|.oE. +.++ | | .o+= | | ... Eoo | | .. o.o.. .| | ooo++o.+*| | .o++o. +oo |
| . o +oo. | | .o= = | | +.=.=.o . | | . .o *.. ..| | . oo.+o.o=| | ...o.+ |
| + . . o.= | | ... X + | | . X.o.* | |o o ++o .. | | . o. ...+| | ..oo.o . |
| = + .+ o | | .. = + o | | + = o o | |.+ .o.o .o | | + ..o| | =oo .+ |
| o o .S . | | . .S o o | | . = S . | |... oo.S .E* * | | S ..| | .SO . . |
| + | | . E. =o.. | | o | | .. o. . o *.O o| | . | | o B .o.. |
| o | | .o. *.o. *. | | | | ... . o * * | | . | | E *..=.o|
| . | | oo=... +. | | | | +. o + o| | E| | . +.+B+|
| | |o+=.o....o+o | | | | .o+ . | | | | o.ooOX|
+------[MD5]------+ +----[SHA256]-----+ +------[MD5]------+ +----[SHA256]-----+ +------[MD5]------+ +----[SHA256]-----+
스크립트는 옵션이 추가 되기 전에 SSH
아래 버전의 서버에서도 실행됩니다 .6.8
-E md5
편집 : ASCII 이미지 지원으로 기본 암호를 전환 한 최신 버전의 SSH 용 버전이 업데이트되었습니다.
#!/bin/bash
# server_ssh_fingerprints
#
# Version 0.2
#
# 2016 Kepi <kepi@igloonet.cz
# MIT License
#
# Print fingerprint matrix for all allowed Host Keys
# with all allowed ciphers and MD5 and SHA-256 algos
#
# Changelog:
#
# 2018-03-11 (0.2):
# - Support for newer versions of OpenSSH
# - Added visual keys for all algos too - only in recent OpenSSH versions
# standard sshd config path
SSHD_CONFIG=/etc/ssh/sshd_config
# helper functions
function tablize {
awk '{printf(" | %-7s | %-7s | %-51s |\n", $1, $2, $3)}'
}
LINE=" +---------+---------+-----------------------------------------------------+"
# header
echo "$LINE"
echo "Cipher" "Algo" "Fingerprint" | tablize
echo "$LINE"
declare -A ALGOS
declare -a ASCII
# fingerprints
while read -r host_key; do
cipher=$(echo "$host_key" | sed -r 's/^.*ssh_host_([^_]+)_key\.pub$/\1/'| tr 'a-z' 'A-Z')
if [[ -f "$host_key" ]]; then
if ssh-keygen -E md5 -l -f "$host_key" &>/dev/null; then
IFS=$'\n'
for algo in md5 sha256; do
n=0
for line in $(ssh-keygen -E $algo -lv -f "$host_key"); do
n=$(( n + 1))
if [[ $n -eq 1 ]]; then
ALGOS[$algo]=$(echo "$line" | awk '{print $2}')
else
ASCII[$n]="${ASCII[$n]} ${line}"
fi
done
done
else
ALGOS[md5]=$(ssh-keygen -l -f "$host_key" | awk '{print $2}')
ALGOS[sha256]=$(awk '{print $2}' "$host_key" | base64 -d | sha256sum -b | awk '{print $1}' | xxd -r -p | base64)
fi
echo "$cipher" MD5 "${ALGOS[md5]}" | tablize
echo "$cipher" SHA-256 "${ALGOS[sha256]}" | tablize
echo "$LINE"
fi
done < <(awk '/^HostKey/ {sub(/^HostKey\s+/,"");print $0".pub"};' $SSHD_CONFIG)
echo
for line in "${ASCII[@]}"; do
echo "$line"
done
이것은 JonnyJD
의 답변 정보를 사용하여 예쁜 인쇄 입니다. 감사.