Skip to content

mTLS support - allow client certificate validation - #1403

Open
t00 wants to merge 2 commits into
simulot:developfrom
t00:feature/mtls
Open

t00 wants to merge 2 commits into
simulot:developfrom
t00:feature/mtls

Conversation

@t00

@t00 t00 commented Jul 28, 2026

Copy link
Copy Markdown

Add mutual TLS (mTLS) support for Immich server connections. immich supports client certificate in the app and web, it secures the installation considerably without a need for VPN (assuming sharing pfx with immich instance users).

Originally I implemented a hackish way to hook into original node immich-cli but immich-go is so much lighter and easier to use, why not here as well.

Adds three client options and their matching CLI flags so immich-go can authenticate to servers that require a client certificate:

--client-cert PEM client certificate
--client-key PEM private key matching the certificate
--ca-cert PEM CA bundle used to verify the server certificate

OptionClientCertificate loads the pair with tls.LoadX509KeyPair and appends it to the transport's TLS config; supplying only one of the two is rejected up front. OptionCACertificate extends a copy of the system cert pool, so a private CA can be added without losing public trust roots. Both are no-ops when their flags are unset, leaving the default TLS behaviour unchanged.

The flags are registered on Client.RegisterFlags, so they are picked up by every command that opens a server connection (upload, stack) and are configurable via config file and IMMICH_GO_* environment variables like any other client setting.

Covered by immich/mtls_test.go: a client cert is accepted, a connection without one is refused, and a mismatched cert/key pair errors.

Documentation is in a separate commit.

@t00
t00 requested a review from simulot as a code owner July 28, 2026 00:46

This branch has not been deployed

No deployments
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.

1 participant