Last active
March 23, 2021 07:59
-
-
Save jsrjenkins/a29a3b27a10d0b815acf551b1fda938d to your computer and use it in GitHub Desktop.
Obtain the server certificate for offlineimap. Takes server as first argument, optional second argument for port.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/bin/bash | |
## The first argument is the server | |
## the second [optional] argument is the port, default is 993. | |
server=$1 | |
port=${2:-993} | |
SSL_CERT_DIR="" | |
openssl s_client -connect $server:$port </dev/null 2>/dev/null | openssl x509 -fingerprint -noout -text -in /dev/stdin | grep "^SHA1 Fingerprint=" | awk -F"=" '{split($2,a," ");gsub(/"/, "", a[1]);print a[1]}' | sed 's/://g' | xclip | |
echo "The certificate signature is now on the clipboard." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment