PortGate

Blueprints · Reverse Proxy & SSL

Beginner 10 min · openssl / curl

Multi-domain TLS and security header audit

Reads TLS version, certificate days remaining, HSTS, CSP, and X-Frame-Options for each domain in a list. It does not change DNS or server config. The bundle does not run it.

Live config

Baked-in protections

Step 1 · text

Domain list

/root/portgate-domains.txt

One hostname per line.

example.com

Step 2 · bash

Audit script

/root/portgate-blueprints/tls-audit.sh

openssl and curl are read-only here. A non-zero curl status is reported and the next domain is checked.

#!/bin/sh
set -eu
while IFS= read -r host; do
  [ -n "$host" ] || continue
  echo "== $host =="
  echo | openssl s_client -connect "$host:443" -servername "$host" 2>/dev/null | openssl x509 -noout -dates -subject || echo "certificate: unavailable"
  end="$(echo | openssl s_client -connect "$host:443" -servername "$host" 2>/dev/null | openssl x509 -noout -enddate | cut -d= -f2 || true)"
  if [ -n "$end" ]; then
    end_epoch="$(date -d "$end" +%s 2>/dev/null || date -j -f "%b %d %T %Y %Z" "$end" +%s 2>/dev/null || echo 0)"
    now="$(date +%s)"
    if [ "$end_epoch" -gt 0 ]; then
      echo "days_remaining=$(( (end_epoch - now) / 86400 ))"
    fi
  fi
  headers="$(curl -fsSI --max-time 15 "https://$host" || true)"
  printf '%s\n' "$headers" | awk 'BEGIN{IGNORECASE=1} /^strict-transport-security:|^content-security-policy:|^x-frame-options:/{print}'
  echo "$headers" | grep -qi '^strict-transport-security:' || echo "HSTS: absent"
  echo "$headers" | grep -qi '^content-security-policy:' || echo "CSP: absent"
  echo "$headers" | grep -qi '^x-frame-options:' || echo "X-Frame-Options: absent"
done < /root/portgate-domains.txt