-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Python : error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED. #17685
Copy link
Copy link
Closed
Closed
Copy link
Labels
Description
What version of gRPC and what language are you using?
1.17.1
What operating system (Linux, Windows, …) and version?
Linux (Debian Buster)
What runtime / compiler are you using (e.g. python version or version of gcc)
Python 3.7.2
What did you do?
I am trying to write Grpc client in python for a Grpc server written in go. My client code looks like
with open('server.crt', 'rb') as f: trusted_certs = f.read()
credentials = grpc.ssl_channel_credentials(trusted_certs)
ops = [('grpc.ssl_target_name_override', 'secure.app')]
channel = grpc.secure_channel('localhost:443', credentials, ops)
stub = SomeStub(channel)
stub.SomeMethod(Request())but for some reasons it's unable to connect to the server, giving me CERTIFICATE_VERIFY_FAILED error.
What did you expect to see?
I expected client to connect to the server, because my go client works perfectly well but python client isn't working well. Here's my what my go client looks like
var opts []grpc.DialOption
caFile := testdata.Path(crtPath)
creds, _ := credentials.NewClientTLSFromFile(caFile, "secure.app")
opts = append(opts, grpc.WithTransportCredentials(creds))
conn, _ := grpc.Dial("localhost:443", opts...)
defer conn.Close()
client := grpc_api.SomeClient(conn)
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
res, _ := client.SomeMethod(ctx, &grpc_api.Request{})What did you see instead?
Instead I saw following error
E0110 19:17:10.922064705 23315 ssl_transport_security.cc:1229] Handshake failed with fatal error SSL_ERROR_SSL: error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED.
Reactions are currently unavailable