0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

grpc + ssl + azure instance でNo match found for server name: となるときのエラー回避備忘録

Last updated at Posted at 2021-02-01

概要

grpc クライアントとサーバの間でssl通信を行うとき、
ssl 鍵をopensslなどで生成し、各サーバに置く。

いざクライアント側から通信を実行しようとすると、

No match found for server name:

のようなエラーが出る。

サーバをクライアントとサーバの2台にわけずに、
一台でサーバ、クライアントを立て、docker-compose up などするときは、

openssl req -newkey rsa:2048 -nodes -keyout server.key -x509 -days 365 -out server.crt

等のコマンドを用い、

Generating a RSA private key
........................................................+++++
.....+++++
writing new private key to 'server.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:*******  
Email Address []:


Common Name のところに、サーバサイドのip(すなわちdocker-compose であればservice の名前で解決される) を書けばよかった。

解決策

単純ではあるのだが、grpc + sslをおこなうときに

ドメインのみを使うことが許されており、IPは使えない 

ということだった。

https://zhuanlan.zhihu.com/p/35507832
上のブログに助けられた。

したがって、サーバサイドのインスタンスにドメインを振った後、それを先程の
Common Nameに書いて鍵を生成、その後scpしてから通信を行うとうまくいった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?