Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Trillian TLS configuration #2202

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"

"github.com/google/trillian"
"github.com/redis/go-redis/v9"
Expand All @@ -49,6 +50,11 @@ import (
)

func dial(rpcServer string) (*grpc.ClientConn, error) {
// Extract the hostname without the port
hostname := rpcServer
if idx := strings.Index(rpcServer, ":"); idx != -1 {
hostname = rpcServer[:idx]
}
// Set up and test connection to rpc server
var creds credentials.TransportCredentials
tlsCACertFile := viper.GetString("trillian_log_server.tls_ca_cert")
Expand All @@ -57,7 +63,7 @@ func dial(rpcServer string) (*grpc.ClientConn, error) {
switch {
case useSystemTrustStore:
creds = credentials.NewTLS(&tls.Config{
ServerName: rpcServer,
ServerName: hostname,
MinVersion: tls.VersionTLS12,
})
case tlsCACertFile != "":
Expand All @@ -70,7 +76,7 @@ func dial(rpcServer string) (*grpc.ClientConn, error) {
return nil, fmt.Errorf("failed to append CA certificate to pool")
}
creds = credentials.NewTLS(&tls.Config{
ServerName: rpcServer,
ServerName: hostname,
RootCAs: certPool,
MinVersion: tls.VersionTLS12,
})
Expand Down
Loading