LoginSignup
0
0

Nitro Enclave + gRPC

Last updated at Posted at 2023-05-17

試したかったこと

エンクレーブの中から、外界のgRPC サーバにアクセスできるかやってみたかった。

結論

下ができず、
Screen Shot 2023-05-16 at 17.48.38.png

<_InactiveRpcError of RPC that terminated with:
	status = StatusCode.UNAVAILABLE
	details = "failed to connect to all addresses; last error: UNKNOWN: ipv4:43.206.93.133:5555: Network is unreachable"
	debug_error_string = "UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:43.206.93.133:5555: Network is unreachable {created_time:"2023-05-16T08:42:47.988354476+00:00", grpc_status:14}"
>

となり、envoy 経由で試した(HTTP1.1 と2の違いとバンさんから少し聞いたため)

Screen Shot 2023-05-16 at 17.48.51.png

が、同じエラーでできなかった。

再現方法

Docker Image  のビルド

sudo docker build -t test . --no-cache

eif ファイルのビルド

nitro-cli build-enclave --docker-uri test:latest --output-file secure-test.eif

vsock-proxy の立ち上げ

vsock-proxy.yml
allowlist:
- {address: your_grpc_host, port: your_grpc_port}
vsock-proxy 8001 your_grpc_host your_grpc_port --config vsock-proxy.yaml

待機状態になります。

エンクレーブの立ち上げ

nitro-cli run-enclave --cpu-count 2 --memory 3072 --eif-path secure-test.eif --debug-mode

以下のログが出力されます。

{
  "EnclaveName": "secure-channel-example",
  "EnclaveID": "i-07bdc1796ceb8d416-enc18823416037a232",
  "ProcessID": 4680,
  "EnclaveCID": 16,
  "NumberOfCPUs": 2,
  "CPUIDs": [
    1,
    3
  ],
  "MemoryMiB": 3072
}

debug モードでenclave の標準出力表示

nitro-cli console --enclave-id i-07bdc1796ceb8d416-enc18823416037a232

client

python3 client.py client 17 5005 "test"
<_InactiveRpcError of RPC that terminated with:
	status = StatusCode.UNAVAILABLE
	details = "failed to connect to all addresses; last error: UNKNOWN: ipv4:35.78.69.89:5555: Network is unreachable"
	debug_error_string = "UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:35.78.69.89:5555: Network is unreachable {created_time:"2023-05-16T06:48:20.697558034+00:00", grpc_status:14}"
>
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