Skip to content

fix: replace native-tls/OpenSSL with rustls for IMAP — eliminates OpenSSL dependency (fixes #97)#121

Open
whatnick wants to merge 2 commits intoRightNow-AI:mainfrom
whatnick:feature/openssl-rust-support
Open

fix: replace native-tls/OpenSSL with rustls for IMAP — eliminates OpenSSL dependency (fixes #97)#121
whatnick wants to merge 2 commits intoRightNow-AI:mainfrom
whatnick:feature/openssl-rust-support

Conversation

@whatnick
Copy link

@whatnick whatnick commented Mar 1, 2026

Summary

Fixes #97 — the v0.2.1 aarch64-linux binary required OpenSSL 1.0 (libssl.so.1.0.0), which is not available on Ubuntu 22.04+ (ships OpenSSL 3.x).

Root Cause

The imap crate's default tls feature pulls in native-tls, which on Linux dynamically links against the system's OpenSSL. The cross toolchain used for aarch64 builds shipped OpenSSL 1.0 headers, producing binaries linked against libssl.so.1.0.0 — absent on modern distros.

Fix

Replace native-tls with rustls (pure Rust TLS) for the IMAP email channel — the only remaining OpenSSL consumer. All other TLS users (reqwest, tokio-tungstenite, lettre) already used rustls.

Changes

File Change
Cargo.toml Add rustls, rustls-native-certs, rustls-pki-types workspace deps; set imap = { version = "2", default-features = false } to disable native-tls; remove native-tls dep
crates/openfang-channels/Cargo.toml Replace native-tls with rustls + rustls-native-certs + rustls-pki-types
crates/openfang-channels/src/email.rs Replace native_tls::TlsConnector with rustls::ClientConnection + rustls::StreamOwned using system-native root certs
Dockerfile Remove libssl-dev from builder stage
Cross.toml Remove OpenSSL cross-compile pre-build for aarch64
.github/workflows/release.yml Remove libssl-dev from Linux CI build deps

Result

  • Zero dynamic OpenSSL linkageldd openfang will no longer show libssl.so / libcrypto.so
  • Release binaries work on Ubuntu 22.04+, Debian 12+, Fedora 37+, etc. without installing legacy OpenSSL
  • Docker images are smaller (no libssl-dev in builder)
  • Cross-compilation is simpler (no OpenSSL cross-compile step)

TLS Protocol Support

The rustls configuration enables TLS 1.2 and TLS 1.3 using the ring crypto backend with system-native root certificates (rustls-native-certs). This covers all modern IMAP servers.

whatnick added 2 commits March 1, 2026 18:26
…AI#97)

The aarch64-linux release binary was dynamically linked against
libssl.so.1.0.0 / libcrypto.so.1.0.0 (OpenSSL 1.0) which is absent on
Ubuntu 22.04+ (ships OpenSSL 3.x).  The sole consumer of native-tls was
the IMAP email channel adapter.

Changes:
- Replace native_tls::TlsConnector with rustls::ClientConnection +
  rustls-native-certs for the IMAP client in email.rs
- Disable imap crate default 'tls' feature (which pulled in native-tls)
- Add rustls, rustls-native-certs, rustls-pki-types as workspace deps
- Remove native-tls from workspace dependencies entirely
- Remove libssl-dev from Dockerfile builder stage
- Remove OpenSSL cross-compile pre-build from Cross.toml
- Remove libssl-dev from CI release workflow Linux build step

All other TLS consumers (reqwest, tokio-tungstenite, lettre) already
used rustls.  The project now has zero dynamic OpenSSL linkage.

Closes RightNow-AI#97
@whatnick whatnick force-pushed the feature/openssl-rust-support branch from 6ee905d to 1cfea02 Compare March 1, 2026 08:18
@whatnick
Copy link
Author

whatnick commented Mar 1, 2026

This change has successfully been tested against email on raspberry pi 5.

@b4iterdev
Copy link

The current pre-built version of openfang for aarch64-unknown-linux-gnu also having the same OpenSSL deps issue on Debian trixie.

egargale pushed a commit to egargale/openfang that referenced this pull request Mar 5, 2026
@EliabLemus
Copy link

EliabLemus commented Mar 7, 2026

I tested this PR, and it worked, I'm using a raspberry pi 4 using trixie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v0.2.1 aarch64-linux binary requires OpenSSL 1.0, fails on Ubuntu 22.04+

3 participants