Override server name when validating TLS cert

Sometimes a trusted cert's hostname cannot be identical to the DNS
label. This flag enables to override the hostname on validation, such
that one is not forced to use --insecure.
This commit is contained in:
Johannes Kohnen 2018-03-20 13:12:58 +00:00
parent 585cd1bae8
commit fd99880b0f
1 changed files with 4 additions and 0 deletions

View File

@ -76,6 +76,7 @@ var (
`When describing messages, show a JSON template for the message type.`)
verbose = flag.Bool("v", false,
`Enable verbose output.`)
serverName = flag.String("servername", "", "Override servername when validating TLS certificate.")
)
func init() {
@ -233,6 +234,9 @@ func main() {
if err != nil {
fail(err, "Failed to configure transport credentials")
}
if *serverName != "" {
creds.OverrideServerName(*serverName)
}
}
cc, err := grpcurl.BlockingDial(ctx, target, creds, opts...)
if err != nil {