Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS High Sierra and SSL Problems #96

Closed
writeameer opened this issue Feb 21, 2018 · 2 comments
Closed

macOS High Sierra and SSL Problems #96

writeameer opened this issue Feb 21, 2018 · 2 comments

Comments

@writeameer
Copy link

Hi there Everyone,

I'm on OSX targeting netcoreapp2.0 and trying to make any API call:

    class Program {
        static void Main(string[] args)
        {
            var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
            var client = new Kubernetes(config);
            
            foreach (var item in client.ListPodForAllNamespaces().Items) {
                Console.WriteLine(item.Metadata.Name);
            }
        }
    }

Generates this error:

System.PlatformNotSupportedException: The handler does not support custom handling of certificates with this combination of libcurl (7.54.0) and its SSL backend ("LibreSSL/2.0.20").

It looks like it might get sorted in .NET Core 2.1 according to this. In the meantime, I ended up creating a custom DelegatingHandler and passing it in while instantiating a new Kubernetes object:

    class Program {
        static void Main(string[] args)
        {
            var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
            var client = new Kubernetes(config, new InSecureHandler());
            
            foreach (var item in client.ListPodForAllNamespaces().Items) {
                Console.WriteLine(item.Metadata.Name);
            }
        }
    }

    class InSecureHandler : DelegatingHandler {
        protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) {
            var handler = new HttpClientHandler {
                ServerCertificateCustomValidationCallback =
                    HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
            };
            
            InnerHandler = handler;
            return await base.SendAsync(request, cancellationToken);
        }
    }

...and that works for me:

nginx-4217019353-5g8b7
heapster-2574232661-5xsbr
kube-dns-v20-2253765213-fpr2b
kube-dns-v20-2253765213-t4d95
kube-proxy-611c4
kube-svc-redirect-nkp5g
kubernetes-dashboard-2898242510-qr2bp
tunnelfront-2213086069-w59fx

Just thought I'd share in case others were running into similar issues. Anyone aware of other ways of managing this problem for local development use cases ?

@tg123
Copy link
Member

tg123 commented Feb 21, 2018

maybe you can use non https proxy instead

@writeameer
Copy link
Author

Thank you @tg123 for responding and appreciate the help !

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

No branches or pull requests

2 participants