A CLI tool that diffs the TLS configuration between two hosts.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tlsninja-0.1.3.tar.gz.
File metadata
- Download URL: tlsninja-0.1.3.tar.gz
- Upload date:
- Size: 78.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5b74d0e95026597b4f996c05e31ceeb93d25fc82d2681e72a737d68ff238a41
|
|
| MD5 |
bf25fbbdd5b470aa2682e3a2b4d17869
|
|
| BLAKE2b-256 |
6b74346e69ccbb9ed1b1363f9436d2a0e3e2c007f8ba7e197db007c20055fd3b
|
Provenance
The following attestation bundles were made for tlsninja-0.1.3.tar.gz:
Publisher:
release.yml on dumitory-dev/tlsninja
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tlsninja-0.1.3.tar.gz -
Subject digest:
f5b74d0e95026597b4f996c05e31ceeb93d25fc82d2681e72a737d68ff238a41 - Sigstore transparency entry: 1413362545
- Sigstore integration time:
-
Permalink:
dumitory-dev/tlsninja@b590d45933af8ea50b6229efe50cceac1ecf238f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/dumitory-dev
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b590d45933af8ea50b6229efe50cceac1ecf238f -
Trigger Event:
push
-
Statement type:
File details
Details for the file tlsninja-0.1.3-py3-none-any.whl.
File metadata
- Download URL: tlsninja-0.1.3-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fa2d595b92f9a5eb0eb1a78075e7ab82b62635dbeec3959278333e1e52acab1
|
|
| MD5 |
49a345590c8156c0dd25bd9f7ae1e81d
|
|
| BLAKE2b-256 |
c5126126f74b90cf1122f3568901ff7a99cf43099321bc05021c0770a6822dee
|
Provenance
The following attestation bundles were made for tlsninja-0.1.3-py3-none-any.whl:
Publisher:
release.yml on dumitory-dev/tlsninja
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tlsninja-0.1.3-py3-none-any.whl -
Subject digest:
6fa2d595b92f9a5eb0eb1a78075e7ab82b62635dbeec3959278333e1e52acab1 - Sigstore transparency entry: 1413362711
- Sigstore integration time:
-
Permalink:
dumitory-dev/tlsninja@b590d45933af8ea50b6229efe50cceac1ecf238f -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/dumitory-dev
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b590d45933af8ea50b6229efe50cceac1ecf238f -
Trigger Event:
push
-
Statement type: