Hi all,
I’ve been trying to learn how to do some of the (inter-)networking aspects of ma HA setup. I recently setup a reverse proxy (on my Synology NAS using the inbuilt nginx server) which now successfully serves my HA, plex, and web server using different subdomains via https (all on port 443). The issue I’ve now come in to is when trying to log on to my HA using the iOS app. If I go to https://ha.mydomain.com then I get to the HA logon page and log-on fine - it shows a valid and in date SSL cert. However, if I try to add the server on the iOS app using the same https://ha.mydomain.com is throws an NSURLErrorDomain -1202 (Failed to Connect - the certificate for this server is invalid).
The iOS log gives this:
2022-01-24 18:08:28.644 [Verbose] [main] [OnboardingManualURLViewController.swift:153] connectTapped(_:) > Connect button tapped
2022-01-24 18:08:28.648 [Info] [main] [OnboardingAuth.swift:80] performPreSteps(checkPoint:authDetails:sender:) > beforeAuth
2022-01-24 18:08:28.648 [Verbose] [main] [OnboardingAuthStepConnectivity.swift:20] perform(point:) >
2022-01-24 18:08:28.734 [Verbose] [main] [OnboardingAuthStepConnectivity.swift:28] perform(point:) > NSURLAuthenticationMethodServerTrust
2022-01-24 18:08:28.760 [Info] [main] [OnboardingAuthStepConnectivity.swift:53] perform(point:) > failure(Alamofire.AFError.sessionTaskFailed(error: Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “ha.mydomain.com”, which could put your confidential information at risk." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
"<cert(0x154029e00) s: *.mydomain.com i: R3>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https://ha.mydomain.com/auth/authorize?response_type=code&client_id=https://home-assistant.io/iOS&redirect_uri=homeassistant://auth-callback, NSErrorFailingURLStringKey=https://ha.mydomain.com/auth/authorize?response_type=code&client_id=https://home-assistant.io/iOS&redirect_uri=homeassistant://auth-callback, NSUnderlyingError=0x2820f7ba0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x281ef0aa0>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9814, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9814, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x154029e00) s: *.mydomain.com i: R3>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <F4ED8165-427B-494C-8EFD-3D373AC30015>.<1>"
), _kCFStreamErrorCodeKey=-9814, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F4ED8165-427B-494C-8EFD-3D373AC30015>.<1>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x281ef0aa0>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “ha.mydomain.com”, which could put your confidential information at risk.}))
2022-01-24 18:08:28.766 [Info] [main] [OnboardingAuth.swift:70] perform(checkPoint:checks:) > OnboardingAuthStepConnectivity: rejected(HomeAssistant.OnboardingAuthError(kind: HomeAssistant.OnboardingAuthError.ErrorKind.sslUntrusted(Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “ha.mydomain.com”, which could put your confidential information at risk." UserInfo={NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, NSErrorPeerCertificateChainKey=(
"<cert(0x154029e00) s: *.mydomain.com i: R3>"
), NSErrorClientCertificateStateKey=0, NSErrorFailingURLKey=https://ha.mydomain.com/auth/authorize?response_type=code&client_id=https://home-assistant.io/iOS&redirect_uri=homeassistant://auth-callback, NSErrorFailingURLStringKey=https://ha.mydomain.com/auth/authorize?response_type=code&client_id=https://home-assistant.io/iOS&redirect_uri=homeassistant://auth-callback, NSUnderlyingError=0x2820f7ba0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x281ef0aa0>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9814, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9814, kCFStreamPropertySSLPeerCertificates=(
"<cert(0x154029e00) s: *.mydomain.com i: R3>"
)}}, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDataTask <F4ED8165-427B-494C-8EFD-3D373AC30015>.<1>"
), _kCFStreamErrorCodeKey=-9814, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F4ED8165-427B-494C-8EFD-3D373AC30015>.<1>, NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x281ef0aa0>, NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “ha.mydomain.com”, which could put your confidential information at risk.}), data: nil))
2022-01-24 18:08:53.180 [Verbose] [main] [ServerManager.swift:287] serverInfoSetter(cache:keychain:identifier:encoder:notify:) > ignoring update to deleted server historic
Thanks for any help!