google / gnxi

gNXI Tools - gRPC Network Management/Operations Interface Tools
Apache License 2.0
258 stars 116 forks source link

Refactor certificate usage for the binaries. #108

Closed samribeiro closed 4 years ago

samribeiro commented 4 years ago

Short (oversimplified) summary for how certificates are used to authenticate the client and the target in gRPC

Before Authentication

During Authentication

After Authentication

Current certificate usage for the binaries

The following binaries receive ca.crt, client.crt/target.crt, client.key/target.key: gnmi_get gnmi_set gnmi_target gnoi_reset

However, gnoi_cert, receives ca.crt and ca.key. This is usefull because this client needs to sign and install certificates in the target. In addition, gnoi_cert uses this ca.crt and key to dynamically create a client.crt to connect to the target.

Proposed certificate usage for all binaries

Have all binaries accept one of the two options: 1) ca.crt, client.crt/target.crt, client.key/target.key; or 2) ca.key, ca.crt;

Package these two options in a library under utils where it can be used by all other binaries.

ericm commented 4 years ago

Do we want a flag to represent switching between the 2 options or just use the first one if the cert flag is set

samribeiro commented 4 years ago

if ca.crt, client.crt/target.crt, client.key/target.key are provided, use option 1. if only ca.key and ca.crt are provided, use option 2 (what gnoi cert does). print usage message otherwise.