Skip to content

Commit

Permalink
Use undeprecated method for insecure
Browse files Browse the repository at this point in the history
  • Loading branch information
kradalby committed Feb 12, 2022
1 parent 531298f commit c73b57e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions cmd/headscale/cli/utils.go
Expand Up @@ -19,6 +19,8 @@ import (
"github.com/rs/zerolog/log"
"github.com/spf13/viper"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/credentials/insecure"
"gopkg.in/yaml.v2"
"inet.af/netaddr"
"tailscale.com/tailcfg"
Expand Down Expand Up @@ -398,7 +400,7 @@ func getHeadscaleCLIClient() (context.Context, v1.HeadscaleServiceClient, *grpc.

grpcOptions = append(
grpcOptions,
grpc.WithInsecure(),
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithContextDialer(headscale.GrpcSocketDialer),
)
} else {
Expand All @@ -414,7 +416,13 @@ func getHeadscaleCLIClient() (context.Context, v1.HeadscaleServiceClient, *grpc.
)

if cfg.CLI.Insecure {
grpcOptions = append(grpcOptions, grpc.WithInsecure())
grpcOptions = append(grpcOptions,
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
} else {
grpcOptions = append(grpcOptions,
grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
)
}
}

Expand Down Expand Up @@ -492,7 +500,7 @@ func (t tokenAuth) GetRequestMetadata(
}

func (tokenAuth) RequireTransportSecurity() bool {
return true
return false
}

// loadOIDCMatchMap is a wrapper around viper to verifies that the keys in
Expand Down

0 comments on commit c73b57e

Please sign in to comment.