Repository navigation
fix(openssl): detect LibreSSL, auto-install brew openssl@3, loud die instead of silent exit (#341) - #342
Merged
Conversation
…d of silent exit (#341) Carl on a fresh Mac ran 'airc join' after the documented curl install and got 'No mesh found on your gh account → becoming the host.' followed by exit 1, no error, no diagnostic. The whole stack was working — gh authed, gist about to be created — except 'openssl genpkey -algorithm Ed25519' silently failed because /usr/bin/openssl on macOS is LibreSSL 3.3.6, and LibreSSL doesn't implement Ed25519. The 2>/dev/null on the openssl call swallowed the actual error; set -e killed the script with no trap. Two-part fix: airc binary: resolve openssl with Ed25519 capability at startup (_resolve_openssl), prefer brew openssl@3 / openssl over PATH default on Mac (so /usr/bin/openssl LibreSSL is bypassed when a working brew binary is present), expose as AIRC_OPENSSL. init_identity + sign_message gate on AIRC_OPENSSL non-empty; if empty, _die_no_ed25519_openssl prints a clear actionable error pointing the user at 'brew install openssl@3' or AIRC_OPENSSL=/path env override, plus the issue link. AIRC_OPENSSL env var is also the user override for non-standard layouts. install.sh: 'openssl --version' is not enough — LibreSSL passes that probe. Add a real 'openssl genpkey -algorithm Ed25519' probe after the existing prereq install loop. On Mac, if the probe fails AND brew is available AND brew openssl@3 isn't already keg-installed, auto-install it. Brew openssl@3 is keg-only (doesn't shadow /usr/bin/openssl) but airc's runtime resolver locates it at /opt/homebrew/opt/openssl@3/bin/. On Linux/Windows the probe failing is rare; emit a warning with manual fix guidance. Tested both paths on this Mac: * with only LibreSSL → loud actionable error, exit 1 * after 'brew install openssl@3' → 'airc join' succeeds, hosts #general Doesn't change the bigger question (raised by Joel: do we need shell openssl at all when the venv already has python-cryptography?). That's a follow-up — this PR just stops Carl from hitting a silent failure on every fresh Mac install. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
6 tasks
4 of 6 tasks
joelteply
added a commit
that referenced
this pull request
Apr 30, 2026
) Identity gen (genpkey) and message signing (pkeyutl -sign) used to shell out to system openssl. macOS LibreSSL doesn't implement Ed25519 via genpkey, which silently broke fresh-Mac installs (the 2>/dev/null ate the error — exactly the error-suppression antipattern that "Never swallow errors" exists to forbid). #342 made the failure loud and auto-installed brew openssl@3; this PR removes the dependency on system openssl entirely by routing both ops through the venv python-cryptography module that's already installed for envelope encryption. What changed: - lib/airc_core/crypto.py: add generate_ed25519_keypair_pem, load_ed25519_priv_pem, sign_ed25519_pem, save_ed25519_keypair_pem. PEM format (PKCS#8 priv, SPKI pub) matches openssl byte-for-byte — existing scopes that paired under shell-openssl load + verify cleanly here. Cross-checked: signing a Python-gen key via openssl pkeyutl -sign and signing the same message via the new path produces byte-identical base64 output. - lib/airc_core/identity.py: bootstrap_ed25519 + sign_ed25519 siblings to the existing X25519 functions, plus bootstrap-ed25519 and sign-ed25519 CLI subcommands so bash invokes via $AIRC_PYTHON -m airc_core.identity ... - airc top-level: sign_message and init_identity now route through the python CLI. Removed _resolve_openssl, AIRC_OPENSSL, _die_no_ed25519_openssl — all dead code post-migration. ssh-keygen remains (it's an OpenSSH client tool, not a libcrypto consumer, and ships working on every supported platform). - install.sh: drop openssl from the prereq list; drop the LibreSSL-detect + brew-install-openssl@3 dance (no longer needed since shell openssl isn't called). cryptography stays a hard dep via the existing venv pip-install step. - cmd_doctor.sh: replace the openssl probe with a cryptography import probe ("import cryptography.hazmat.primitives.asymmetric .ed25519"). Surfaces "re-run install.sh" if the venv didn't finish setting up. Backward compat: existing scopes' private.pem / public.pem files (generated by shell openssl in any prior version) continue to work unchanged. The PEM wrapping format is the same; load_pem_private_key parses both. No identity rotation triggered by upgrade. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the silent-
exit 1Carl-on-fresh-Mac bug from #341. Minimal-scope fix; the bigger change (drop shell openssl entirely in favor of the venvcryptographymodule) is being picked up separately by other-mac.What Carl saw before
No error. No log. No doctor pointer. /usr/bin/openssl on macOS is LibreSSL 3.3.6, which doesn't implement Ed25519; the
2>/dev/nullon the openssl call swallowed the actual error andset -ekilled the script.What Carl sees now
Path A — install.sh detects LibreSSL on Mac and auto-installs brew openssl@3 during install:
Path B — install.sh ran on a Mac without brew:
loud warning during install, AND if Carl skips it, the
airc joinfailure path now prints actionable guidance pointing atbrew install openssl@3(orAIRC_OPENSSL=/path/to/openssl), plus the issue link.Implementation
aircbinary:_resolve_openssl()runs at startup: probesAIRC_OPENSSLenv var →/opt/homebrew/opt/openssl@3→/opt/homebrew/opt/openssl→/usr/local/opt/openssl@3→/usr/local/opt/openssl→ PATH default. First candidate that successfully runsgenpkey -algorithm Ed25519 -out /dev/nullwins. On Mac this routes around/usr/bin/openssl(LibreSSL) when a working brew binary is present.AIRC_OPENSSLenv var is the result, exported for downstream use AND as the user override for non-standard layouts.init_identity()andsign_message()gate onAIRC_OPENSSLnon-empty; if empty,_die_no_ed25519_opensslprints a clear actionable error.2>/dev/nullstays on the actual openssl calls — it suppresses normal status noise on success. Failures now never reach those calls because the resolver pre-validated the binary at startup; if no capable openssl exists, we die early with a real message.install.sh:openssl genpkey -algorithm Ed25519 -out /dev/nullagainst the on-PATH openssl. If it fails on Mac, looks for an existing brew openssl@3 (keg-only,/opt/homebrew/opt/openssl@3/bin/openssl); if absent and brew is available, runsbrew install openssl@3. If neither, warns loudly with manual guidance./usr/bin/openssl(which would break system tools that depend on LibreSSL's behaviors). Theaircbinary's runtime resolver is what makes this work.Test results on this Mac
Out of scope (deliberately)
lib/airc_core/identity.pyusingpython-cryptography(already a venv dep). Other-mac picked this up — same issue, separate PR..airc/autoderive into\$PWD/.airc/for non-project dirs (Carl install woes — fresh-Macairc joinsilent exit 1 (LibreSSL can't do Ed25519) #341 sub-bullet) — separate fix, separate PR.Test plan
airc joinairc joinsucceeds, hosts #generalAIRC_OPENSSL=/custom/path airc join→ uses the override🤖 Generated with Claude Code