sslx: A fast, modern alternative to OpenSSL's CLI
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
sslx: A fast, modern alternative to OpenSSL’s CLI
sslx openssl, but you don’t have to google the flags. A single binary that handles certs, TLS connections, and all the stuff you normally need three different openssl invocations for. Built with Rust and rustls, no system OpenSSL required.
sslx 是 OpenSSL 的替代品,你再也不用去谷歌搜索那些复杂的参数了。它是一个单一的二进制文件,可以处理证书、TLS 连接以及通常需要三次不同的 openssl 调用才能完成的所有任务。它使用 Rust 和 rustls 构建,无需系统安装 OpenSSL。
Install cargo install sslx Prebuilt binaries on the releases page. Homebrew: brew install glincker/tap/sslx Or download directly: # macOS (Apple Silicon) curl -fsSL https://github.com/glincker/sslx/releases/latest/download/sslx-macos-aarch64 -o sslx && chmod +x sslx # Linux curl -fsSL https://github.com/glincker/sslx/releases/latest/download/sslx-linux-x86_64 -o sslx && chmod +x sslx
安装方式:使用 cargo install sslx。预编译的二进制文件可在发布页面找到。Homebrew 用户可使用 brew install glincker/tap/sslx。或者直接下载:# macOS (Apple Silicon) curl -fsSL https://github.com/glincker/sslx/releases/latest/download/sslx-macos-aarch64 -o sslx && chmod +x sslx # Linux curl -fsSL https://github.com/glincker/sslx/releases/latest/download/sslx-linux-x86_64 -o sslx && chmod +x sslx
TLS grade Rate the TLS setup of any host, like SSL Labs but from your terminal: $ sslx grade github.com ╭──────────────────────────────────────────╮ │ github.com:443 Grade: A+ │ ╰──────────────────────────────────────────╯ ✓ Protocol TLS 1.3 ✓ Cipher TLS13_AES_128_GCM_SHA256 (AEAD) ✓ Certificate Valid, 49 days remaining ✓ Key ECDSA P-256 (256 bit) ✓ Hostname github.com in SANs ✓ Chain Complete (3 certs) ✓ ALPN HTTP/2 supported Checks protocol version, cipher strength, cert validity, key type, hostname matching, chain completeness, and ALPN. Gives you a letter grade from A+ to F.
TLS 等级评估:像 SSL Labs 一样,直接从终端对任何主机的 TLS 设置进行评分:$ sslx grade github.com。它会检查协议版本、加密强度、证书有效性、密钥类型、主机名匹配、链完整性和 ALPN,并给出从 A+ 到 F 的等级评分。
Expiry check Check cert expiry on a bunch of hosts at once: $ sslx expiry google.com github.com cloudflare.com stripe.com Host Expires Days Status ──────────────────────────────────────────────────────────────── ✓ google.com:443 2026-06-15 61 OK ✓ github.com:443 2026-06-03 49 OK ✓ cloudflare.com:443 2026-06-10 56 OK ✓ stripe.com:443 2026-09-01 139 OK Exit code 1 if anything expires within 7 days. Useful in cron jobs or CI pipelines.
过期检查:一次性检查多个主机的证书过期时间:$ sslx expiry google.com github.com cloudflare.com stripe.com。如果任何证书在 7 天内过期,退出代码将为 1。这在 cron 任务或 CI 流水线中非常有用。
Inspect certificates Read a PEM or DER cert file with colored output: $ sslx inspect cert.pem ╭─ Certificate 1 of 1 ──────────────────────────────────╮ │ Subject: CN=*.example.com │ │ Issuer: CN=Let’s Encrypt Authority X3 │ │ Serial: 0A:1B:2C:3D… │ │ │ │ Valid: 2026-01-15 → 2026-04-15 │ │ Expires: ██░░░░░░░░ 12 days remaining [!] │ │ │ │ Key: ECDSA P-256 (256 bit) │ │ SANs: *.example.com, example.com │ │ SHA-256: AB:CD:EF:12:34… │ ╰──────────────────────────────────────────────────────────╯ Handles multi-cert bundles too. Auto-detects PEM vs DER.
检查证书:读取 PEM 或 DER 证书文件并以彩色输出:$ sslx inspect cert.pem。它同样支持多证书捆绑包,并能自动检测 PEM 或 DER 格式。
Connect to a host See the full TLS handshake details and cert chain for any host: $ sslx connect example.com Connection to example.com:443 TLS 1.3 · TLS13_AES_256_GCM_SHA384 ALPN: h2 Chain: ╭─ Certificate 1 of 3 ─────────────────────────╮ │ Subject: CN=*.example.com │ │ Valid: 61 days remaining ✓ │ │ Key: ECDSA P-256 (256 bit) │ ╰────────────────────────────────────────────────╯ ↓ signed by ╭─ Certificate 2 of 3 (CA) ────────────────────╮ │ … │ ╰────────────────────────────────────────────────╯
连接主机:查看任何主机的完整 TLS 握手详情和证书链:$ sslx connect example.com。
Generate certs Self-signed cert for local dev in one command: sslx generate —cn localhost —san “*.local,127.0.0.1” Creates cert.pem and key.pem with EC P-256 by default. Also supports ec384 and ed25519.
生成证书:一行命令为本地开发生成自签名证书:sslx generate --cn localhost --san "*.local,127.0.0.1"。默认创建使用 EC P-256 的 cert.pem 和 key.pem,同时也支持 ec384 和 ed25519。
Generate a CSR sslx csr —cn example.com —san “*.example.com,api.example.com” Creates csr.pem and key.pem. Submit the CSR to your CA.
生成 CSR:sslx csr --cn example.com --san "*.example.com,api.example.com"。这将创建 csr.pem 和 key.pem,你可以将此 CSR 提交给你的 CA。
Convert between formats sslx convert cert.pem —to der # PEM to DER sslx convert cert.der —to pem # DER to PEM sslx convert bundle.p12 —to pem # PKCS12 to PEM Auto-detects input format.
格式转换:sslx convert cert.pem --to der(PEM 转 DER)、sslx convert cert.der --to pem(DER 转 PEM)、sslx convert bundle.p12 --to pem(PKCS12 转 PEM)。它能自动检测输入格式。
Check cert+key match $ sslx match cert.pem key.pem ✓ Certificate and key match (ECDSA P-256 (256 bit)) No more comparing modulus hashes manually.
检查证书与密钥匹配:$ sslx match cert.pem key.pem。无需再手动比较模数哈希。
Extract from PKCS12 sslx extract bundle.p12 —password mypass —out ./certs Pulls out the leaf cert, intermediates, and key into separate PEM files.
从 PKCS12 提取:sslx extract bundle.p12 --password mypass --out ./certs。将叶子证书、中间证书和密钥提取到单独的 PEM 文件中。
Decode anything Throw a file or a JWT token at it and sslx figures out what it is: $ sslx decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9… ✓ Detected: JSON Web Token (JWT) Header: {“alg”:“HS256”,“typ”:“JWT”} Payload: {“sub”:“1234567890”,“name”:“John”,“iat”:1516239022} Expires: in 3 hours Also detects PEM certs, DER files, private keys, public keys, and CSRs.
解码任何内容:传入文件或 JWT 令牌,sslx 会自动识别其类型:$ sslx decode eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...。它还能检测 PEM 证书、DER 文件、私钥、公钥和 CSR。
Verify a chain sslx verify cert.pem —ca ca-bundle.pem ✓ Certificate is valid Chain: complete (3 certs) Expiry: 328 days remaining Tells you exactly what’s wrong if it fails, with hints on how to fix it.
验证证书链:sslx verify cert.pem --ca ca-bundle.pem。如果验证失败,它会准确告诉你哪里出了问题,并提供修复建议。
openssl vs sslx (Comparison table omitted for brevity)
openssl 与 sslx 对照(此处省略对照表)。
JSON output Every command supports —json for scripting and CI: # check days until expiry sslx connect example.com —json | jq ‘.chain.certificates[0].days_remaining’ # get the grade sslx grade example.com —json | jq ‘.grade’ # list all SANs sslx inspect cert.pem —json | jq ‘.certificates[0].sans’
JSON 输出:每个命令都支持 --json 参数,方便脚本编写和 CI 使用。
Exit codes Code Meaning 0 ok 1 cert expired or expiring 3 chain untrusted 4 connection failed 5 bad file
退出代码:0 表示正常,1 表示证书过期或即将过期,3 表示链不可信,4 表示连接失败,5 表示文件错误。
Benchmarks Median of 10 runs on macOS M2: sslx openssl inspect cert 2.1ms 9.4ms generate cert 1.7ms 4.5ms startup 1.3ms
基准测试:在 macOS M2 上运行 10 次的中位数对比:sslx 在检查证书和生成证书的速度上均优于 openssl。
Shell completions sslx completions bash > /etc/bash_completion.d/sslx sslx completions zsh > ~/.zsh/completions/_sslx sslx completions fish > ~/.config/fish/completions/sslx.fish
Shell 自动补全:支持 bash、zsh 和 fish 的自动补全配置。
Community Join the GLINR Discord to ask questions, share feedback, or talk to other users.
社区:加入 GLINR Discord 提问、分享反馈或与其他用户交流。