From 8a48996008d413319369c3f7eb0548c64a245aed Mon Sep 17 00:00:00 2001 From: Mikaela Suomalainen Date: Fri, 27 Feb 2015 12:49:31 +0200 Subject: [PATCH] rc: update serversslcertfp Closes #64 --- rc/bashrc | 16 +++++++++------- rc/zshrc | 16 +++++++++------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/rc/bashrc b/rc/bashrc index 20f124a6..1de3f921 100644 --- a/rc/bashrc +++ b/rc/bashrc @@ -865,13 +865,15 @@ github-add-pulls() { # Get server SSL certificate fingerprint in MD5, SHA1 and SHA256. # Note that OpenSSL doesn't support IPv6 at time of writing (2015-01-13). -serversslcertfp() { - SSSLCFFN="/tmp/$(date -Is).pem" - openssl s_client -showcerts -connect $1 < /dev/null|tee $SSSLCFFN - cat $SSSLCFFN|openssl x509 -md5 -fingerprint -noout - cat $SSSLCFFN|openssl x509 -sha1 -fingerprint -noout - cat $SSSLCFFN|openssl x509 -sha256 -fingerprint -noout - rm $SSSLCFFN +serversslcertfp () { +SSSLCFFN=$(openssl s_client -showcerts -connect $1 < /dev/null) + # To see all validity information + echo $SSSLCFFN + # For getting the fingerprints + echo $SSSLCFFN | openssl x509 -md5 -fingerprint -noout + echo $SSSLCFFN | openssl x509 -sha1 -fingerprint -noout + echo $SSSLCFFN | openssl x509 -sha256 -fingerprint -noout + unset SSSLCFFN } # The same for local certificate file diff --git a/rc/zshrc b/rc/zshrc index ebc7e077..a654f764 100644 --- a/rc/zshrc +++ b/rc/zshrc @@ -843,13 +843,15 @@ github-add-pulls() { # Get server SSL certificate fingerprint in MD5, SHA1 and SHA256. # Note that OpenSSL doesn't support IPv6 at time of writing (2015-01-13). -serversslcertfp() { - SSSLCFFN="/tmp/$(date -Is).pem" - openssl s_client -showcerts -connect $1 < /dev/null|tee $SSSLCFFN - cat $SSSLCFFN|openssl x509 -md5 -fingerprint -noout - cat $SSSLCFFN|openssl x509 -sha1 -fingerprint -noout - cat $SSSLCFFN|openssl x509 -sha256 -fingerprint -noout - rm $SSSLCFFN +serversslcertfp () { + SSSLCFFN=$(openssl s_client -showcerts -connect $1 < /dev/null) + # To see all validity information + echo $SSSLCFFN + # For getting the fingerprints + echo $SSSLCFFN | openssl x509 -md5 -fingerprint -noout + echo $SSSLCFFN | openssl x509 -sha1 -fingerprint -noout + echo $SSSLCFFN | openssl x509 -sha256 -fingerprint -noout + unset SSSLCFFN } # The same for local certificate file