Tls Certificate Expiry Checker
Pricing
$0.01 / actor start
Tls Certificate Expiry Checker
Pricing
$0.01 / actor start
Rating
0.0
(0)
Developer
Eichan Jolly
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
13 days ago
Last modified
Categories
Features
Share
Actor slug: tls-certificate-expiry-checker
Apify Store categories (declare on listing): DEVELOPER_TOOLS
Suggested price: $0.003 per run (one dataset result; recommendation only, not configured).
Audience: Website owners, DevOps teams, QA teams, and certificate-rotation operators.
What it does
Opens one TLS connection to a user-supplied public domain on port 443, receives the leaf certificate, decodes the X.509 validity dates, and reports whether the certificate has expired and how many days remain.
It reads DER ASN.1 notBefore / notAfter timestamps using Python standard library only. It deliberately does not verify CA trust or hostname ownership: expired or self-signed certificates must be readable to report their expiration. expired: false means the presented date is in the future; it does not mean the connection is trustworthy.
Tiny example input
{"domain": "example.com"}
Example output (from included local test fixture, not the live example.com certificate)
{"domain": "example.com","not_before": "2026-11-01T02:45:52Z","expires_at": "2036-10-29T02:45:52Z","days_remaining": 3650.0,"expired": false,"error": null}
days_remaining is the time difference in days, rounded to two decimals; it may be negative for expired certificates. Actual live result dates depend on the server certificate and the UTC time of execution. Failure items preserve the same keys, with unknown values set to null and error containing a plain-English message.
Limits and security
- Exactly one domain. Do not include
https://, paths, ports, query strings, or credentials. - Uses only port 443, one TLS handshake, one leaf certificate; reads no website content and makes no HTTP requests to the target.
- Uses SNI for the supplied domain; for IP literals, SNI behavior depends on TLS library/server support.
- Resolves the domain and pins the socket to a public IP. Rejects private, loopback, reserved/non-global, and mixed public/private DNS answers.
- Connection timeout: 8 seconds; certificate DER size limit: 100 KB. Uses supported DER UTCTime/GeneralizedTime encodings; nonstandard validity encodings cause an error item.
- This Actor is not a CA-chain validator, revocation checker, certificate transparency checker, TLS-grade scanner, or monitoring service. It does not check certificate trust, SAN coverage, issuer, or future renewal status.
- No third-party packages or Apify SDK; no target credentials, login, or destructive operations.
Run locally
From the Actor folder, set an input environment variable, then execute the script:
$ACTOR_INPUT_JSON='{"domain":"example.com"}' python src/main.py
Alternatively put {"domain":"example.com"} in storage/key_value_stores/default/INPUT.json, then run python src/main.py. The output is one JSON dataset item under storage/datasets/default/000000001.json or the next available numbered file. APIFY_LOCAL_STORAGE_DIR can override the base directory.
On Apify, the Actor reads the default input key-value store and posts one item to its own default dataset with the platform-provided APIFY_TOKEN; the visitor does not supply credentials. This platform token is only for Apify storage, never for TLS target authentication. No billing, publishing, or price configuration is included.
Reproducible verification
python tests/run_smoke.pypython -m unittest discover -s tests -p 'test_*.py' -v
The smoke test actually runs python src/main.py, with valid input and a local TLS fixture certificate for example.com. The offline fixture uses test-only socket redirection (tests/smoke_support/sitecustomize.py), not any production Actor changes. After verifying the output dataset, it writes the actual stdout, stderr and dataset item into verification/.
tests/ includes the full rerunnable test code and test certificate/key. The fixture private key is a public, disposable test key and is not copied into the production image. No Apify cloud build or live Internet TLS check is claimed.