changeset 242:96f00cdb6614

Cert check function
author Steve Huston <huston@astro.princeton.edu>
date Fri, 01 Mar 2024 16:26:52 -0500
parents c36986d268eb
children af82d3d9a70c
files .bash_aliases
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.bash_aliases	Thu Jan 25 13:26:06 2024 -0500
+++ b/.bash_aliases	Fri Mar 01 16:26:52 2024 -0500
@@ -137,7 +137,7 @@
       --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE localhost" \
       --user-data-dir="${PROXY_PATH}" > /dev/null 2>&1
     $PROXY_UMOUNT
-    # Maybe leave this off, so what if the port is left open if there's no
+    # Maybe leave this off, so what if the port is left open if there are no
     # conflicts...
     # ssh -O cancel -D $PROXY_PORT $PROXY_HOST
   ) &
@@ -194,6 +194,18 @@
 
 # Other Functions
 
+certcheck() {
+  if [ -z "$1" ] ; then
+    echo "Usage: certcheck <hostname>[:port]"
+    echo "       Defaults to port 443 if not specified."
+    return
+  fi
+  H=$1
+  [[ $1 =~ :[0-9]+$ ]] || \
+    H=$1":443"
+  echo -n Q | openssl s_client -connect $H | openssl x509 -noout -dates
+}
+
 mc-backup() { 
   pushd ~/Dropbox/Saves/minecraft/saves;
   if [ -d $1 ]; then