Skip to content

Commit 3f50591

Browse files
authored
Allow insecure transport to be configured by flag (#1786)
Signed-off-by: Aaron Lew <[email protected]>
1 parent 927ecad commit 3f50591

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cmd/prober/prober.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import (
4444
"github.com/sigstore/sigstore-go/pkg/tuf"
4545
"google.golang.org/grpc"
4646
"google.golang.org/grpc/credentials"
47-
"google.golang.org/grpc/credentials/insecure"
47+
insec "google.golang.org/grpc/credentials/insecure"
4848
"google.golang.org/grpc/status"
4949
"sigs.k8s.io/release-utils/version"
5050

@@ -129,6 +129,7 @@ var (
129129
logStyle string
130130
addr string
131131
grpcPort int
132+
insecure bool
132133

133134
retries uint
134135
oneTime bool
@@ -151,6 +152,7 @@ func init() {
151152
flag.StringVar(&logStyle, "logStyle", "prod", "Log style to use (dev or prod)")
152153
flag.StringVar(&addr, "addr", ":8080", "Port to expose prometheus to")
153154
flag.IntVar(&grpcPort, "grpc-port", 0, "Port for Fulcio gRPC endpoint")
155+
flag.BoolVar(&insecure, "insecure", false, "Whether to skip TLS verification for gRPC requests")
154156

155157
flag.UintVar(&retries, "retry", 4, "Maximum number of retries before marking HTTP request as failed")
156158
flag.BoolVar(&oneTime, "one-time", false, "Whether to run only one time and exit")
@@ -313,9 +315,8 @@ func NewFulcioGrpcClient(fulcioGrpcURL string) (fulciopb.CAClient, error) {
313315
}
314316
opts := []grpc.DialOption{grpc.WithUserAgent(options.UserAgent())}
315317

316-
// Use insecure transport for local testing
317-
if strings.HasPrefix(grpcHostname, "localhost") {
318-
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
318+
if insecure || strings.HasPrefix(grpcHostname, "localhost") {
319+
opts = append(opts, grpc.WithTransportCredentials(insec.NewCredentials()))
319320
} else {
320321
transportCreds := credentials.NewTLS(&tls.Config{MinVersion: tls.VersionTLS12, ServerName: grpcHostname})
321322
opts = append(opts, grpc.WithTransportCredentials(transportCreds))

0 commit comments

Comments
 (0)