<!-- Generated by website/scripts/sync-docs.mjs from README.md. Edit that file, not this one. -->

# Overview

> Every page of this site: https://dyokto.github.io/y509/docs/llms.txt

<img src="https://raw.githubusercontent.com/dyokto/.github/main/assets/projects/y509.png" width="96" alt="y509">

# y509


A TUI for X.509 certificate chains. It checks whether a chain verifies, and separately whether it was *served* correctly: missing intermediates, redundant roots, wrong order. That second check explains "works in the browser, breaks in `curl`".

Built on the [Charm](https://charm.sh) v2 stack: [Bubble Tea](https://charm.land/bubbletea/v2), [Lip Gloss](https://charm.land/lipgloss/v2), [Bubbles](https://charm.land/bubbles/v2), [huh](https://charm.land/huh/v2).

<img src="https://github.com/dyokto/y509/raw/main/demo.gif?v=2" alt="y509 Demo">

Docs: <https://dyokto.github.io/y509/docs/>. The [quick start](https://dyokto.github.io/y509/docs/quickstart/) runs `y509 validate` on a chain with a missing intermediate, one sent in the wrong order, and a correct one, offline.

## Install

```bash
# Homebrew (macOS)
brew install kanywst/tap/y509

# FreeBSD
pkg install y509

# Go 1.27+
go install github.com/dyokto/y509/cmd/y509@latest
```

```powershell
# Windows
scoop bucket add kanywst https://github.com/kanywst/scoop-bucket
scoop install kanywst/y509
```

[docs/guide/install.md](https://dyokto.github.io/y509/docs/install/) covers the module path change from `kanywst/y509`, release binaries and packages, Windows and FreeBSD.

## Usage

```bash
y509 cert-chain.pem                       # a file (PEM, DER or PKCS#7)
y509 example.com:443                      # a live server
y509 smtp.example.com:587 --starttls smtp # ...behind STARTTLS
cat chain.pem | y509                      # stdin
kubectl get secret tls -o json | y509     # a Kubernetes TLS secret
```

PKCS#7, PKCS#12 and Kubernetes TLS secrets are detected by content. [docs/guide/usage.md](https://dyokto.github.io/y509/docs/usage/) has every input, STARTTLS, `diff` and `inventory`.

### Live servers

An existing file path is read as a file; anything else is an address. The TUI handshake verifies nothing, so a broken chain can still be inspected, in the order the server sent it. See [live servers](https://dyokto.github.io/y509/docs/usage/#live-servers).

### Comparing two chains

`y509 diff` matches certificates by SHA-256 of their DER and exits 1 when the chains differ. See [comparing two chains](https://dyokto.github.io/y509/docs/usage/#comparing-two-chains).

### Validating from a script

`y509 validate` exits 0 for a chain that verifies against the trust store (or `--roots`) and 1 for one that is self-anchored or broken. `--policy fips|pqc` and `--check-crl` add checks. See [docs/guide/validate.md](https://dyokto.github.io/y509/docs/validate/).

### How the chain was served

A chain can verify and still break `curl`, Go and Java: a missing intermediate, a redundant root, wrong order. y509 reports that from what was actually sent. See [how the chain was served](https://dyokto.github.io/y509/docs/validate/#how-the-chain-was-served).

### Will it validate on that client?

`y509 paths` builds every path from the leaf to the roots of dated trust store snapshots bundled in the binary (curl, certifi, Debian, OpenJDK, Chrome Root Store) and says per store whether the chain validates as sent. See [checking other clients' trust stores](https://dyokto.github.io/y509/docs/paths/).

### Machine-readable output

`validate --json` prints the full result to stdout and nothing else; errors go to stderr. `presentation`, `conformance`, `revocation` and `policy` each carry their own `ok`. See [docs/guide/json.md](https://dyokto.github.io/y509/docs/json/).

### Taking an inventory

`y509 inventory` lists key, signature and expiry per certificate, as a table, CSV or JSON, without verifying anything. See [taking an inventory](https://dyokto.github.io/y509/docs/usage/#taking-an-inventory).

### GitHub Actions

```yaml
- uses: dyokto/y509@v1
  with:
    target: example.com:443
    fail-on: untrusted,mis-served,expiring
```

Inputs, outputs and a scheduled monitor: [docs/guide/github-action.md](https://dyokto.github.io/y509/docs/github-action/).

## Keybindings

`?` in the TUI shows them all. The table is in [docs/guide/tui.md](https://dyokto.github.io/y509/docs/tui/#keybindings).

## Configuration

`~/.y509.yaml` sets the expiry warning window and the colours (Catppuccin Mocha by default). See [docs/guide/tui.md](https://dyokto.github.io/y509/docs/tui/#configuration).

## Development

```bash
make build       # Build with version info
make test        # Run tests
make lint        # Run golangci-lint
make vulncheck   # Run govulncheck
```

See [ROADMAP.md](https://dyokto.github.io/y509/docs/roadmap/) for plans and non-goals, and [CONTRIBUTING.md](https://dyokto.github.io/y509/docs/contributing/) before sending a patch.

## Verifying releases

Releases include a Sigstore-signed `checksums.txt`, an SPDX SBOM per archive and SLSA build provenance. The `cosign` and `gh attestation` commands, for releases before and after the move to `dyokto`, are in [docs/guide/verify-releases.md](https://dyokto.github.io/y509/docs/verify-releases/).

## License

Apache License 2.0
