changeset 312:b9e92b79bb00

misc: holding ground for misc shell tricks Right now just a function to dump the SSL certs for a given host:port.
author Augie Fackler <raf@durin42.com>
date Tue, 07 May 2013 14:39:15 -0400
parents 745e7cc9c2cd
children 615fee88aa08
files .shell.d/99.misc.sh
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
new file mode 100644
--- /dev/null
+++ b/.shell.d/99.misc.sh
@@ -0,0 +1,8 @@
+function certfor() {
+  if [ "x$1" = "x" ] ; then
+    echo 'abort: specify host:port pair as argument'
+    return 1
+  fi
+  openssl x509 -in <(echo | openssl s_client -showcerts -connect $1 | \
+    awk '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/') -noout -text
+}