Open
Conversation
This Commit PR introduces TLS support for the grpc key provider.
Specifically, it allows for users to configure the RootCA to trust, the ServerName for the remote host and any client certificates to use when contacting the grpc key provider.
The configuration introduces an optinoal struct with key `grpc-tls` which when specified will load and use the configuration values
* `root-ca-file`: this is the PEM x509 rootCA which issued the grpc server certificate (default: system root CA bundle)
* `insecure-skip-verify`: this bypasses TLS validation of the remote grpc server's cert (default false)
* `server-name`: specifies the SNI value for the grpc server to use (default, the hostname specified in the `grpc` parameter)
* `cert-file`: client certificate x509 cert to use (PEM format)
* `key-file`: client certificate key to use (PEM format)
specifically, a sample ocicrypt could look like
```json
{
"key-providers": {
"grpc-keyprovider": {
"grpc": "your_grpc_keyprovider.domain.com:port",
"grpc-tls": {
"server-name": "your_grpc_keyprovider.domain.com",
"insecure-skip-verify": false,
"cert-file": "/path/to/client.crt",
"key-file":"/path/to/client.key",
"root-ca-file": "/path/to/root-ca.crt"
}
}
}
}
```
Signed-off-by: sal rashid <salrashid123@gmail.com>
Author
|
@stefanberger allright, i'll give it another try. hopefully there's no squash needed here |
Collaborator
|
LGTM. @lumjjb ? |
| var err error | ||
|
|
||
| if grpcTls != nil { | ||
| rootCAs := x509.NewCertPool() |
Collaborator
There was a problem hiding this comment.
This could be moved into the if branch because in the else branch you will overwrite rootCAs right away.
| // presented by the server and any host name in that certificate. | ||
| // In this mode, TLS is susceptible to man-in-the-middle attacks. | ||
| // This should be used only for testing. | ||
| InsecureSkipVerify bool `json:"insecure-skip-verify,omitempty"` |
Collaborator
There was a problem hiding this comment.
Does``omitempty` actually work on a boolean?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Commit PR introduces TLS support for the grpc key provider.
fixes #127
Specifically, it allows for users to configure the RootCA to trust, the ServerName for the remote host and any client certificates to use when contacting the grpc key provider.
The configuration introduces an optinoal struct with key
grpc-tlswhich when specified will load and use the configuration valuesroot-ca-file: this is the PEM x509 rootCA which issued the grpc server certificate (default: system root CA bundle)insecure-skip-verify: this bypasses TLS validation of the remote grpc server's cert (default false)server-name: specifies the SNI value for the grpc server to use (default, the hostname specified in thegrpcparameter)cert-file: client certificate x509 cert to use (PEM format)key-file: client certificate key to use (PEM format)specifically, a sample ocicrypt could look like
{ "key-providers": { "grpc-keyprovider": { "grpc": "your_grpc_keyprovider.domain.com:port", "grpc-tls": { "server-name": "your_grpc_keyprovider.domain.com", "insecure-skip-verify": false, "cert-file": "/path/to/client.crt", "key-file":"/path/to/client.key", "root-ca-file": "/path/to/root-ca.crt" } } } }