tlsninja
Diff the TLS configuration between two hosts.
sslyze and testssl.sh scan one host. tlsninja scans two and shows you what changed. Built for DevOps/SRE teams during migrations, blue/green deploys, and TLS regression testing in CI.
Why
When teams migrate services between providers (AWS ALB → Cloudflare, old nginx → new Caddy, prod → staging), TLS configuration silently regresses: HSTS weakens, cipher suites disappear, OCSP stapling turns off, certificate chains lose intermediates. Every existing tool scans one host at a time. tlsninja replaces the eyeball-two-terminal-windows workflow with one command.
Install
uv tool install tlsninja
# or
pipx install tlsninja
tlsninja requires Python 3.11+.
Quick usage
tlsninja diff cloudflare.com mozilla.org
A side-by-side terminal table prints, grouped by category, with rows colored:
- red for regressions (e.g. HSTS shortened, OCSP turned off)
- green for improvements (e.g. TLS 1.0 dropped, RSA → ECDSA)
- yellow for neutral changes (e.g. issuer rotated, SANs reordered)
Output flags
| Flag | Effect |
|---|---|
--json |
Emit machine-readable JSON to stdout instead of the table. Schema is tlsninja.v1. |
--junit PATH |
Write a JUnit XML report to PATH. Each diff entry is a test; regressions are <failure> elements. |
--baseline |
Treat HOST_A as the source of truth. Any non-improvement difference fails (exit 1) — even neutral changes. |
--json and --junit can be combined.
Exit codes
The exit-code contract is part of the public API:
| Code | Meaning |
|---|---|
0 |
No differences, or only improvements / neutrals (or, with --baseline, only improvements). |
1 |
At least one regression detected (or, with --baseline, any non-improvement difference). |
2 |
Scan failed (host unreachable, sslyze error). |
3 |
Usage error (missing argument, bad path). |
What the diff captures
- Protocols: TLS 1.0 / 1.1 / 1.2 / 1.3 support per host
- Ciphers: per protocol, added vs removed
- Certificate: subject CN, SANs, issuer, validity, key algorithm + size, signature algorithm, chain completeness and trust
- TLS features: OCSP stapling, session resumption (id and ticket), supported elliptic curves
- HTTP security headers: HSTS (max-age, includeSubDomains, preload), CSP presence, X-Frame-Options, X-Content-Type-Options, Referrer-Policy
- Compliance: which Mozilla SSL profile (
modern,intermediate,old) each host meets
CI integration
- name: TLS regression check
run: tlsninja diff prod.example.com staging.example.com --junit tls-diff.xml --baseline
- uses: actions/upload-artifact@v4
if: always()
with:
name: tls-diff
path: tls-diff.xml
The step fails the job if anything in staging.example.com is worse than (or merely different from) prod.example.com.
Development
git clone https://github.com/dumitory-dev/tlsninja
cd tlsninja
uv sync --all-groups
Run the full check matrix locally:
scripts/verify.bat # Windows
ruff check . && ruff format --check . && mypy --strict tlsninja tests && pytest -m "not network and not perf"
The network-marked integration test (tests/test_scanner.py::test_scan_both_real_hosts_completes_under_10s) and the perf benchmark (tests/test_perf.py) are skipped by default. Run them on demand with pytest -m "network or perf".
License
Apache-2.0. See LICENSE.
Metadata
Release files for tlsninja 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tlsninja-0.1.4.tar.gz | 78.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tlsninja-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 107.1 kB
Release files / tlsninja-0.1.4.tar.gz
| Download URL | tlsninja-0.1.4.tar.gz |
|---|---|
| Size | 78.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
147c2b0ef60328d972c83e3e476d4cd4f1ecaa192047c460fe956c12dac88922
|
|
BLAKE2b-256 checksum How to use checksums |
e177aa21a91b8da29a230c5a573ed620b632c787310698de65c0e211f8060eac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 1, 2026.
Transparency logRelease files / tlsninja-0.1.4-py3-none-any.whl
| Download URL | tlsninja-0.1.4-py3-none-any.whl |
|---|---|
| Size | 29.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89abc3c1fad96b780e254a1dab4629a25ec509575e630cdd2e0322e165e97096
|
|
BLAKE2b-256 checksum How to use checksums |
a46f08151a8c957f272096e391191883fd353fa0fff0ffabff790a9cc5f2a4a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 1, 2026.
Transparency log