From 5001ed54028a7de43eb60e66e883f68f8b85e278 Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Wed, 28 Dec 2016 12:20:42 +0100 Subject: [PATCH] Update weechat config script. Can now automatically retrieve certificate fingerprints. --- weechat.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/weechat.sh b/weechat.sh index bb6f968..b3c3d68 100755 --- a/weechat.sh +++ b/weechat.sh @@ -1,5 +1,18 @@ #!/bin/bash +get_fingerprints() +{ + local hosts=$(host $1 | rev | cut -f 1 -d " " | rev) + + for ip in $hosts; do + openssl x509 -in <(openssl s_client -connect $ip:9999 2>/dev/null) -text -noout -fingerprint + done 2>/dev/null | \ + grep -F 'SHA1 Fingerprint=' | \ + cut -d "=" -f 2 | \ + tr -d ':' | \ + paste -sd "," +} + weechat -d "$HOME/.config/weechat" -r "$(cat <