summaryrefslogblamecommitdiffstats
path: root/bin/hostcert
blob: 61f519da800d1440ebf72e3d558306ff229e971e (plain) (tree)
1
2
3
4
5
6
7
8


               
 


                
                                                                                                                                                                                                                   
#!/bin/sh
set -eu
set -o pipefail

host="$1"
port="${2:-443}"

openssl s_client -connect "$host:$port" </dev/null 2>/dev/null | perl -nle 'print if /BEGIN CERTIFICATE/../END CERTIFICATE/' | openssl x509 -text | perl -nle 'print unless /BEGIN CERTIFICATE/../END CERTIFICATE/'