Check certificate expiry on many hosts

Print the notAfter date for every host in hosts.txt to see which certificates expire soon.

for h in $(cat hosts.txt); do echo -n "$h "; echo | openssl s_client -connect $h:443 -servername $h 2>/dev/null | openssl x509 -noout -enddate; done

tool
troubleshooting32 commands
tags
troubleshootingtlssecuritymonitoring

More troubleshooting commands

  • cut -d. -f2 <<<"$JWT" | tr '_-' '/+' | base64 -d 2>/dev/null | jq .

    Decode the payload to check exp, iss and aud; it converts base64url but does not check the signature.

  • grpcurl -plaintext <host>:<port> list; grpcurl -plaintext <host>:<port> describe <svc>

    List services and methods using server reflection; -plaintext turns off TLS for debugging.

  • pidstat -t -p <pid> 1

    Show CPU% for each thread to find the hot TID in a busy process before using jstack or perf.

  • top -H -p <pid>

    Watch a process's threads live; convert the hot TID to hex (printf %x) to match nid in jstack.

  • mpstat -P ALL 1

    Show %usr, %sys and %iowait per core to tell one maxed-out core from evenly spread load.

all 32 troubleshooting commands