Skip to content

Instantly share code, notes, and snippets.

View MelindaShore's full-sized avatar

Melinda Shore MelindaShore

  • No Mountain Software
  • Two Rivers, AK
View GitHub Profile
@MelindaShore
MelindaShore / ocspchecker
Created May 28, 2020 05:29
ocsp checker shell script - convenient but not very robust
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo Usage: $0 servername
exit 1
fi
servername=$1
cert=$servername.pem
openssl s_client -connect $servername:443 2>&1 < /dev/null | sed -n '/-----BEGIN/,/-----END/p' >$cert
import getdns
u = [ { 'address_data': '9.9.9.9', 'address_type': 'IPv4', } ] # TLS-capable public DNS resolver
c = getdns.Context()
c.resolution_type = getdns.RESOLUTION_STUB # these three lines are all the setup
c.dns_transport_list = [ getdns.TRANSPORT_TLS ] # needed to execute a query over TLS
c.upstream_recursive_servers = u
r = c.address('getdnsapi.net')
if r.status == getdns.RESPSTATUS_GOOD: