Repository navigation
[feature/mtls-client-certificates] TLS client certificate (mTLS) support - #180
Open
bunducdragos wants to merge 1 commit into
Open
bunducdragos wants to merge 1 commit into
bunducdragos wants to merge 1 commit into
Conversation
- OCClientIdentityStore: new store for client identities imported from PKCS#12 files, one per server host. Kept in the shared keychain access group (after first unlock, this device only, not synchronizable) so app extensions can use them. Identities are only presented to the exact host they were imported for. Lookups re-read the keychain so changes made in the app take effect in running extensions; decoded credentials are cached while the stored data is unchanged. - OCHTTPPipeline: answer NSURLAuthenticationMethodClientCertificate challenges with the identity stored for the challenge's host (previously default handling, which failed the TLS handshake). - OCAuthenticationMethodOAuth2: add mutualTLSBrowserSessionClass, used instead of ASWebAuthenticationSession when a client identity is stored for the authorization URL's host, since ASWebAuthenticationSession can't present app-provided client certificates. - ClientIdentityStoreTests + client-identity.p12 test fixture. Fixes owncloud#11 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Description
Adds support for TLS client certificates (mutual TLS), for servers, or reverse proxies in front of them, that require clients to present a certificate.
OCClientIdentityStore(new,Security/): stores client identities imported from PKCS#12 (.p12/.pfx) files, one per server host.OCKeychain), so app extensions such as the File Provider can use it. It iskSecAttrAccessibleAfterFirstUnlockThisDeviceOnlyand not synchronizable.NSURLCredentialis cached for as long as the stored data is unchanged.OCHTTPPipeline:NSURLAuthenticationMethodClientCertificatechallenges are answered with the identity stored for the challenge's host. Before this change, every challenge other than server trust gotPerformDefaultHandling, so the TLS handshake with such servers failed.OCAuthenticationMethodOAuth2: new class propertymutualTLSBrowserSessionClass.ASWebAuthenticationSessioncan't present client certificates provided by the app. If this property is set and an identity is stored for the authorization URL's host (and no browser session class is configured via class settings), thisOCAuthenticationBrowserSessionsubclass is used instead. The app provides aWKWebView-based implementation, see the ios-app PR.Related Issue
Fixes #11
App side (UI, in-app login session, web views): owncloud/ios-app#1607
Motivation and Context
Self-hosted instances are often put behind a reverse proxy with
ssl_verify_client on(nginx) /SSLVerifyClient require(Apache). This is what #11 asked for, and the desktop client has supported it since 2.3.How Has This Been Tested?
ClientIdentityStoreTests: import, lookup, host scoping, challenge-method filtering, removal, a wrong password keeping the previous identity, and invalid input. They use a self-signed test identity (client-identity.p12). All pass on an iOS 26.3 simulator (Xcode 27.2).ownCloudSDKTestssuites that don't need a live server (ClientIdentityStore, Bookmark, DataSource, Extension, Lock, KeyValueStore, PasswordPolicy, Database, Settings, SQL, Certificate, Misc) on an iOS 26.3 simulator: 84/86 pass. The 2 failures (CertificateTests testCertificateMetaDataParsingFromWeb,SettingsTests testMetadataAvailability) fail the same way on a cleanmaster.demo.owncloud.orgno longer resolves, andocis.ocis-wopi.latest.owncloud.worksserves a certificate for a different hostname.Note: the
Oceantest host doesn't launch on an iOS 27 simulator when built with Xcode 27.2 ("UIScene life cycle is required for apps built with this SDK"). That is unrelated to this change, so the tests were run on iOS 26.3.Types of changes
Checklist:
🤖 Generated with Claude Code