NSURLErrorDomain Code=-1200 only from root context.

When running from a user context, nsurl connection succeeds. When running from the system context the error listed below is generated.

macOS 12+

Thanks for any help



Network error: Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={_kCFStreamErrorDomainKey=3, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorCodeKey=-9802, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made., NSErrorFailingURLKey=https://<host server>/st/console/privateapi/v3.0/agentsupport/registration/policies/bycookie?agentId=294f0fd5ebbd093df4f801c5ab020b976323e273&hostname=pch-imac&dnsDomain=eng.landesk.com&fqdn=pch-imac.eng.landesk.com&netBiosDomain=eng.landesk.com&authorizationCookie=<password>, NSErrorFailingURLStringKey=https://<host server>/st/console/privateapi/v3.0/agentsupport/registration/policies/bycookie?agentId=294f0fd5ebbd093df4f801c5ab020b976323e273&hostname=pch-imac&dnsDomain=eng.landesk.com&fqdn=pch-imac.eng.landesk.com&netBiosDomain=eng.landesk.com&authorizationCookie=<password>, NSErrorClientCertificateStateKey=0}

Error: Error Domain=com.ivanti.iAgent.Registration Code=100 "{

NSErrorClientCertificateStateKey = 0;

NSErrorFailingURLKey = "https://<host server>/st/console/privateapi/v3.0/agentsupport/registration/policies/bycookie?agentId=294f0fd5ebbd093df4f801c5ab020b976323e273&hostname=pch-imac&dnsDomain=eng.landesk.com&fqdn=pch-imac.eng.landesk.com&netBiosDomain=eng.landesk.com&authorizationCookie=<password>";

NSErrorFailingURLStringKey = "https://<host server>/st/console/privateapi/v3.0/agentsupport/registration/policies/bycookie?agentId=294f0fd5ebbd093df4f801c5ab020b976323e273&hostname=pch-imac&dnsDomain=eng.landesk.com&fqdn=pch-imac.eng.landesk.com&netBiosDomain=eng.landesk.com&authorizationCookie=<password>";

NSLocalizedDescription = "An SSL error has occurred and a secure connection to the server cannot be made.";

NSLocalizedRecoverySuggestion = "Would you like to connect to the server anyway?";

"_kCFStreamErrorCodeKey" = "-9802";

"_kCFStreamErrorDomainKey" = 3;

}" UserInfo={NSLocalizedDescription={

NSErrorClientCertificateStateKey = 0;

NSErrorFailingURLKey = "https://<host server>/st/console/privateapi/v3.0/agentsupport/registration/policies/bycookie?agentId=294f0fd5ebbd093df4f801c5ab020b976323e273&hostname=pch-imac&dnsDomain=eng.landesk.com&fqdn=pch-imac.eng.landesk.com&netBiosDomain=eng.landesk.com&authorizationCookie=<password>";

NSErrorFailingURLStringKey = "https://<host server>/st/console/privateapi/v3.0/agentsupport/registration/policies/bycookie?agentId=294f0fd5ebbd093df4f801c5ab020b976323e273&hostname=pch-imac&dnsDomain=eng.landesk.com&fqdn=pch-imac.eng.landesk.com&netBiosDomain=eng.landesk.com&authorizationCookie=<password>";

NSLocalizedDescription = "An SSL error has occurred and a secure connection to the server cannot be made.";

NSLocalizedRecoverySuggestion = "Would you like to connect to the server anyway?";

"_kCFStreamErrorCodeKey" = "-9802";

"_kCFStreamErrorDomainKey" = 3;

}}

The underlying error here, -9802, is

errSSLFatalAlert
. This typically means that the TLS client has received a fatal alert message from the server. You can learn more about this in Section 7.2 Alert Protocol of RFC 5246. There are, however, cases where this can be generated internally by the TLS client.

I can’t think of any direct reason why you’d get this when running the code as a different user. The most likely cause is that there’s an authentication error and the server is responding to that error by triggering a fatal alert. How does your server do authentication? Have you confirmed that the context in which your code is running has the necessary credentials?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
NSURLErrorDomain Code=-1200 only from root context.
 
 
Q