Add cert-sha256 pinning and ss:// helper #49
Closed
+230
−20
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.
Background / motivation
The Android plugin currently expects a PEM file path for certificate pinning. On Android 10+ with scoped storage, the Shadowsocks host process cannot read files from
/storage/emulated/0/Downloadwithout SAF. The result is a poor UX: users must push a PEM into a world-readable location (e.g./data/local/tmp) via adb. That breaks the “single ss:// import” workflow.To preserve the one-step import flow while keeping security equivalent to the current leaf-cert pin, this PR adds cert-sha256 pinning (SHA-256 of the leaf certificate DER). This allows compact, link-friendly pinning without file access.
What this changes
Client (core change):
--cert-sha256CLI option andcert-sha256SIP003 option.cert-sha256takes precedence overcertif both are present.Server (tooling):
--print-ss-pluginhelper to printcert-sha256and a URL-encodedplugin=value suitable for ss:// links.Docs:
cert-sha256and precedence rules.Example usage (redacted)
# On the server, print the cert hash + plugin param slipstream-server \ --cert /path/to/cert.pem \ --key /path/to/key.pem \ --domain example.com \ --print-ss-pluginOutput includes:
Then use the
plugin=value inside an ss:// link.Related
Testing
cargo fmtcargo test -p slipstream-dnscargo test