-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
I've got a TLS enabled grpc server that won't let me connect to it and I get a bland error: io.grpc.StatusRuntimeException: UNAVAILABLE: Channel closed while performing protocol negotiation
https://github.com/nddipiazza/grpc-java/tree/Add-Tls-HelloWorld
Tested from OS
Linux mate 4.13.0-26-generic #29~16.04.2-Ubuntu SMP Tue Jan 9 22:00:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
gRPC version
Issue happens on master branch.
OpenSSL version
OpenSSL 1.0.2g 1 Mar 2016
Reproducer
I created a reproducer on https://github.com/nddipiazza/grpc-java/tree/Add-Tls-HelloWorld
I am using the server certs from grpc-java/testing/src/main/resources/certs
Steps to reproduce
-
git clone https://github.com/nddipiazza/grpc-java $GRPC_JAVA_DIR -
cd $GRPC_JAVA_DIR; git checkout Add-Tls-HelloWorld -
cd $GRPC_JAVA_DIR/examples; ../gradlew -PskipCodegen=true installDist -
In a new terminal open
$GRPC_JAVA_DIR/examples/build/install/examples/bin/hello-world-server-tls -
In a new terminal open
$GRPC_JAVA_DIR/examples/build/install/examples/bin/hello-world-client-tls -
Check the SSL configuration using:
openssl s_client -showcerts -connect localhost:50051
openssl s_client -showcerts -connect localhost:50051
CONNECTED(00000003)
depth=0 CN = localhost
verify error:num=18:self signed certificate
verify return:1
depth=0 CN = localhost
verify return:1
---
Certificate chain
0 s:/CN=localhost
i:/CN=localhost
-----BEGIN CERTIFICATE-----
MIIEnDCCAoQCAQEwDQYJKoZIhvcNAQELBQAwFDESMBAGA1UEAwwJbG9jYWxob3N0
MB4XDTE4MDEyMzE2MjkzN1oXDTE5MDEyMzE2MjkzN1owFDESMBAGA1UEAwwJbG9j
YWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA9dT0cLk2rwMy
lV54viVC7r3Thtc3S8ZRX4jUE6vQDbA9TzitXz3fh7/pSEDOji82MPxHk6tlk5KS
GRLGxIT3lHlebnk1yTC4ToQAaJ32xEtHRL50vvDyYS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PC3YFioTgBuiElYkFEJ7Np4jmWqBfqxsjrcveapYJmnKcGmh+ueLSB0gufu7
HQPHANersfMv49s7a5T9ns/Y9bZssAUhVsJoKjcBPGUDZn9ME1+eVcU0hwwW8jyY
U3AkSF+/jgokgrDy70cd90tDMe/L6L8M4uoU1VfH1c9LbRKstKKLIaVeosxq7kD1
EwuLwW1eny57q5WeSJq/s8R/Ai7OT3zgY5KK9uwwXes=
-----END CERTIFICATE-----
---
Server certificate
subject=/CN=localhost
issuer=/CN=localhost
---
No client certificate CA names sent
Peer signing digest: SHA256
Server Temp Key: ECDH, P-256, 256 bits
---
SSL handshake has read 1945 bytes and written 431 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 4096 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: 95D0BA5A02188E1E1AF518D6FF02941AAE1D3535C5256F3BBBAEED9C2DDDDEC6
Session-ID-ctx:
Master-Key: C3E1D2404AE3039E95689F31C0AC45D1711027BE7B19EB3802130BB374BD4941004E35D4602D857C3CF03A901C7EB6A9
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1516734011
Timeout : 300 (sec)
Verify return code: 18 (self signed certificate)
---
read:errno=0
Results
Client gets the error: io.grpc.StatusRuntimeException: UNAVAILABLE: Channel closed while performing protocol negotiation with no other error indication of what's wrong.
Server output:
./build/install/examples/bin/hello-world-server-tls
Jan 23, 2018 12:55:16 PM io.grpc.examples.helloworldtls.HelloWorldServerTls start
INFO: Server started, listening on 50051
Client output:
./build/install/examples/bin/hello-world-client-tls
Jan 23, 2018 12:55:56 PM io.grpc.examples.helloworldtls.HelloWorldClientTls greet
INFO: Will try to greet world ...
Jan 23, 2018 12:55:57 PM io.grpc.examples.helloworldtls.HelloWorldClientTls greet
WARNING: RPC failed: Status{code=UNAVAILABLE, description=Channel closed while performing protocol negotiation, cause=null}
Expected results
Client should connect successfully. Just like hello-world-server / hello-world-client