dotfiles/dot_bashrc.d/09.functions

14 lines
461 B
Bash
Executable File

#!/usr/bin/env bash
#
# Bash Functions sourced by .bashrc / .sshrc
#
# Get SSL Certificate information
# Based on https://serverfault.com/questions/661978/displaying-a-remote-ssl-certificate-details-using-cli-tools
function getCertInfo() {
local myServer=${1:?a Servername is required}
local myPort=${2:-443}
echo | openssl s_client -showcerts -servername $myServer -connect $myServer:$myPort 2>/dev/null | openssl x509 -inform pem -noout -text
}