grpc-rs icon indicating copy to clipboard operation
grpc-rs copied to clipboard

Server identity validation with secure_connect and empty ChannelCredentials

Open zezic opened this issue 3 years ago • 3 comments

Is server identity validated when grpcio::ChannelBuilder::secure_connect() is used with empty credentials which are made by using just the grpcio::ChannelCredentialsBuilder::new().build() without any root certificates being explicitly provided? Does it use the system-wide certificates which are located automatically by some internal OpenSSL mechanisms?

zezic avatar Jun 29 '21 13:06 zezic

It depends. On linux, it will load the default system root pem, otherwise it will try to use root certificates that is installed with the grpc library, for example "/usr/share/grpc/roots.pem" on MacOS. Implement details on Linux can be checked here: https://github.com/grpc/grpc/blob/master/src/core/lib/security/security_connector/load_system_roots_linux.cc#L145-L167.

BusyJay avatar Jun 29 '21 14:06 BusyJay

Thanks for pointing! Currently I use it on CentOS Linux host and I have ca-certificates package installed. So, I can safely assume that if it connects to host and continue to work with it without any noticeable issues, then it successfully verified host's certificate, right?

zezic avatar Jun 29 '21 15:06 zezic

If you are using secure connections and use it correctly, then the answer is probably yes. If you worry about it, you can set a wrong name for verifying, which is expected to fail if system certificates are correctly detected.

BusyJay avatar Jun 29 '21 18:06 BusyJay