Skip to content
ssldays

Guide

Check TLS cert expiry with nmap

Use nmap ssl certificate expiry scripts to read notAfter from a live handshake on any TCP port—handy for inventories, non-443 services, and quick LAN audits.

Updated Apr 10, 2026 806 words

nmap ssl certificate expiry scanning reads the X.509 dates the target returns during the Nmap SSL handshake—ideal when you need many hosts, odd ports, or a quick audit without writing custom OpenSSL loops.

Security and platform teams already use Nmap for port discovery. The ssl-cert script piggybacks on that workflow so certificate notAfter lands beside open 443 (or 8443, 465, 636) in one run. Unlike parsing static PEM files, Nmap always negotiates TLS like a client.

This guide assumes a recent Nmap build with the ssl-cert and ssl-date scripts enabled. You will scan only hosts you own or have permission to test; aggressive scanning on third-party networks creates abuse complaints.

Outputs are starting points, not PKIX verdicts: Nmap shows dates and subjects but does not fully validate trust paths. Pair results with OpenSSL verify when chain errors matter.

Nmap fits well in quarterly exposure reviews where security wants open TLS ports and upcoming expiries in one report. Tie script output to owners by reverse DNS only when PTR records are trustworthy; otherwise map IPs back through your CMDB.

What to check

Focus on expiry (ssl-cert notAfter), hostname alignment (CN/SAN versus the DNS name you scanned), and clock skew (ssl-date when enabled). For nmap ssl certificate expiry, record the port and SNI hostname because virtual hosting serves different certificates on the same IP.

Distinguish expired leaf certificates from expired intermediates. Nmap typically reports the leaf presented first; use scripts or follow-up OpenSSL with -showcerts if validation fails despite a future leaf date.

Registration expiry is out of scope for Nmap; use RDAP separately for registrar clocks.

When scanning internal ranges for nmap ssl certificate expiry, remember that corporate TLS inspection proxies re-sign traffic. You may read the appliance’s certificate instead of the origin. Tag internal scans separately from external customer checks.

Step-by-step

Install Nmap on your workstation or jump host. Verify scripts are present:

nmap --script-help ssl-cert | head -n 5

Single host on 443

nmap -p 443 --script ssl-cert -Pn www.example.com

Add -v for script debug output when results look empty (filtered port, TLS required on another port).

Specify SNI when the IP is known

When scanning by IP, pass the intended hostname so Nmap sends Server Name Indication:

nmap -p 443 --script ssl-cert --script-args tls.servername=www.example.com -Pn 203.0.113.10

Without tls.servername, you may see a default certificate unrelated to production traffic.

Non-standard ports

nmap -p 8443,9443 --script ssl-cert -Pn api.example.com

Mail and LDAP often expose STARTTLS on 25/587/389; use dedicated scripts or OpenSSL STARTTLS modes when Nmap’s plain TLS probe is insufficient.

Network sweep (inventory)

nmap -p 443 --script ssl-cert -iL production-web.txt -oN ssl-cert-scan.txt

Keep rate limits reasonable; large sweeps belong in maintenance windows with stakeholder notice.

Document scan policy in your security handbook: max packets per second, allowed CIDRs, and escalation when ssl-cert finds unexpected services on database VLANs. Certificate expiry on an admin port you forgot about is a common surprise.

Export XML with -oX when feeding results into vulnerability platforms. Parsing plain text ssl-cert lines with regex is fragile across Nmap versions.

Compare clock skew (optional)

nmap -p 443 --script ssl-date -Pn www.example.com

Large skew between server time and real UTC can cause false “not yet valid” errors unrelated to renewal.

How to read the output

In ssl-cert script output, look for lines such as Not valid after and Subject. The subject common name and listed SANs should include the service name customers use. Issuer tells you whether you are on a public CA or an internal PKI.

Output signal Meaning
Not valid after in the past Clients with default trust stores reject the handshake for date reasons
SAN missing your hostname Name mismatch errors even with future dates
Unexpected issuer Possible MITM appliance, wrong VIP, or corporate proxy in the path
No script output Port closed, TLS behind TCP proxy, or need -Pn / correct SNI

Nmap does not grade cipher suites; it is not a replacement for SSL Labs style policy review when you need protocol baselines.

If Not valid after is within your change window, open a renewal ticket immediately even when other vulnerability scores look fine. Expiry is a calendar fact, not a severity opinion.

Common mistakes

Scanning the IP without SNI and concluding the wrong cert is “expired” for your brand—that is often just the load balancer default. Always set tls.servername or scan by hostname when possible.

Assuming ssl-cert proves trust. A self-signed or captive-portal cert may display dates while browsers fail authority checks. Follow suspicious issuers with openssl s_client and your trust store.

Running massive sweeps through a corporate VPN that re-encrypts traffic. You may fingerprint the inspection proxy, not the origin. Use external vantage points for customer-visible names.

Ignoring STARTTLS services. Raw TLS on 443 is only one pattern; IMAP/SMTP may need different Nmap arguments or OpenSSL -starttls smtp.

Treating Nmap as authorization to test arbitrary addresses. Scope scans to inventory you operate.

Comparing Nmap dates to PEM inventory without hostname context. A scan by IP reports whatever default cert answers; always prefer hostname-driven checks for production brands.

When to use automation

One-off Nmap inventories help quarterly audits, but certificates drift daily as ACME renews and autoscaling replaces nodes. Schedule continuous live TLS checks per hostname with alerting at 30, 14, 7, and 1 day before notAfter.

Encode Nmap findings into your CMDB once, then let a monitor detect when the served serial changes without a ticket. ssldays complements scripted scans by validating the same names your users and APIs call, including redirects—not only open ports on a spreadsheet.

Re-run targeted Nmap after renewals on non-443 services. Teams remember web listeners but forget MQTT, LDAPS, or metrics endpoints until monitoring pages.

Scenario walkthrough

A healthcare integrator scanned its VPN address space with nmap ssl certificate expiry after acquiring a startup. Results showed dozens of appliances whose management UIs used certificates ten years past notAfter. Customer-facing web properties were fine, but auditors focused on the dark red spreadsheet. Remediation prioritized reachable management planes and replaced defaults with corporate PKI or publicly trusted names, with repeat scans monthly.

SaaS companies running multi-tenant SMTP listeners often bind thousands of certificates behind one IP. Nmap without SNI reports a random tenant’s material. The scan looked alarming until operators scripted SNI per customer domain. The lesson is to align scan inputs with hostname ownership records, not only with IP spreadsheets.

During data center migration, security reruns port scans to prove no stray HTTPS remains on legacy subnets. One forgotten VM still answered on 443 with an OV cert issued to a brand that sold two years prior. Nmap dates triggered legal review as well as technical renewal, because the hostname implied an active product surface.

For OT environments, scan windows must be short and gentle. Even read-only TLS probes can upset fragile SCADA gateways. Coordinate with operations, target explicit IPs, and archive outputs for safety regulators who ask whether encryption endpoints were known.

After every acquisition integration, treat Nmap expiry output as a to-do list tied to CMDB ownership. Unknown services with imminent notAfter become either decommission tickets or onboarding into centralized monitoring, never ignored rows in a one-time PDF.

Fleet scanning discipline

Segment large nmap ssl certificate expiry jobs by data center and owner team. Parsing one monolithic file encourages everyone to assume someone else fixed row four hundred twelve. Tagged outputs per VLAN land in the right Slack channel with engineer on-call mentions when Not valid after is inside fourteen days.

Version-control your Nmap command templates. Scanner upgrades change script output formatting; diffs in Git explain why a parser broke after a laptop brew upgrade. Pin versions on CI runners that emit compliance artifacts.

Correlate scan findings with certificate transparency timelines when you discover unknown names. Sometimes the surprise cert is a forgotten ACME lineage still published in CT, pointing you at an orphaned directory on disk.

Educate developers that local Docker compose files exposing TLS on high ports may appear in subnet scans after they plug laptops into lab switches. Not every red cell is production; labels matter.

Pair Nmap discovery with explicit owner acknowledgement in the CMDB. A host cannot move to monitored status until a human confirms the service name customers expect and the renewal runbook path.

When leadership asks for risk trending, graph count of endpoints expiring inside thirty days rather than only expired today. Trend lines motivate budget for centralized monitoring before headlines arrive.

Network address translation and floating IPs complicate scans. A service may answer on one public IP during the scan and fail over to another with different material before renewal completes. Tag scans with the IP observed and reconcile against anycast topology in your diagrams.

If your organization blocks inbound Nmap from the Internet, schedule equivalent checks from internal jump hosts and from an external monitor. nmap ssl certificate expiry inside the perimeter never substitutes for what payment gateways see.

Document who may request ad hoc scans. Sales engineering labs spin up TLS endpoints for demos that linger past quarter end. A lightweight self-service form that triggers a scoped ssl-cert script prevents surprise expiries on forgotten demo DNS.

Teach analysts to export both human and machine-readable outputs. CSV extracts with hostname, port, notAfter, and owner field feed data warehouses better than screenshots for leadership QBR decks.

When certificates use short lifetimes, increase scan cadence for critical tiers. Ninety-day lifetimes punish quarterly scanning habits; monthly or continuous live TLS fits modern ACME estates better than port scans alone.

Finally, when Nmap shows ample validity remaining, still schedule work before busy retail seasons. Calendar risk overlaps marketing freezes; scanning during Halloween tells you whether Black Friday listeners are safe.

Coordinating with certificate owners

Export scan rows into ticketing when owners are known. Unknown owners go to a security backlog reviewed weekly until every listener has a named team.

Align nmap ssl certificate expiry schedules with change windows. Announcing scans prevents abuse complaints when security touches fragile lab subnets.

Educate owners that scan expiry is advisory until live hostname checks confirm presentation. Nmap seeds the queue; OpenSSL with SNI closes tickets.

For containers, map published host ports to orchestration service names in scan output. Raw IP:port lists decay quickly when clusters autoscale.

Integrate scan metadata with vulnerability severity models only when dates are within policy thresholds. Ancient expired certs on isolated VLANs may be low priority while customer edges stay urgent.

Quarterly executive summaries benefit from one chart: expired today, expiring inside seven, inside thirty. Nmap can populate historical snapshots if archived diligently.

Partner networks may forbid scanning but allow targeted SSL scripts on agreed IPs. Negotiate written scope rather than skipping partners entirely.

After certificate automation rolls out, shrink broad scans but keep spot checks. New listeners appear daily via IaC mistakes.

Document false positives where devices speak TLS-ish handshakes without proper certificates. Analysts waste less time once non-PEM responders are cataloged.

Plain-language summary

Port scanning culture varies widely across organizations. Security teams embrace Nmap while application teams fear disruption. Clear scheduling and scope documents keep ssl-cert scripts constructive rather than adversarial.

Expiry dates from scans should feed the same renewal backlog TLS monitors use. Duplicate ticket systems breed ignored rows.

Nonstandard ports remain blind spots in many TLS programs. Marketing microservices on high ports expire quietly until a partner integration probes them.

Leadership metrics should highlight risk reduction: fewer expired listeners quarter over quarter. Celebrate trends, not only firefighting heroes.

Scanning teaches junior analysts how TLS sprawl looks in the wild before they inherit production on-call rotations.

Cloud ephemeral infrastructure challenges scan inventories. Tag-driven discovery beats static IP spreadsheets for container estates.

Responsible disclosure applies internally too: report scary findings to service owners with remediation offers, not only red bar charts.

Nmap is a bridge tool toward continuous monitoring, not the final form of observability for modern short-lived certificates.

Schedule a five-minute leadership briefing after each quarterly scan: top three upcoming expiries, owners assigned, and whether live hostname monitoring confirms risk. Short briefings keep scanning relevant.

Frequently asked questions

Why does ssl-cert show nothing on 443?

The port may be filtered, TLS may require client certs, or the service expects HTTP first on another port. Try -Pn, verify DNS, and test with openssl s_client manually.

Can Nmap check wildcard certificates?

It reports the leaf presented for the SNI you supply. A wildcard *.example.com may cover api.example.com; confirm SANs in output rather than assuming coverage.

Does ssl-cert detect expired intermediates?

Usually you see only the leaf unless scripts extract the chain. If clients report untrusted errors with valid leaf dates, run OpenSSL with -showcerts or see Certificate chain incomplete in the browser.

Are UDP or QUIC services supported?

Nmap’s classic SSL scripts target TCP TLS. QUIC/HTTP3 requires different tooling; use HTTP clients or OpenSSL 3.x where QUIC is supported for those endpoints.

See what the server presents right now

Free live certificate check — no signup.