Skip to content

Commit

Permalink
Merge pull request #496 from NikitaSkrynnik/tls12
Browse files Browse the repository at this point in the history
Set minumum TLS version to 1.2
  • Loading branch information
denis-tingaikin authored May 29, 2022
2 parents a8d1ea6 + d411c1e commit 6cc785c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package main

import (
"context"
"crypto/tls"
"net"
"net/url"
"os"
Expand Down Expand Up @@ -120,7 +121,12 @@ func main() {
}
logrus.Infof("SVID: %q", svid.ID)

tlsCreds := credentials.NewTLS(tlsconfig.MTLSServerConfig(source, source, tlsconfig.AuthorizeAny()))
tlsClientConfig := tlsconfig.MTLSClientConfig(source, source, tlsconfig.AuthorizeAny())
tlsClientConfig.MinVersion = tls.VersionTLS12
tlsServerConfig := tlsconfig.MTLSServerConfig(source, source, tlsconfig.AuthorizeAny())
tlsServerConfig.MinVersion = tls.VersionTLS12

tlsCreds := credentials.NewTLS(tlsServerConfig)
// Create GRPC Server and register services
server := grpc.NewServer(append(tracing.WithTracing(), grpc.Creds(tlsCreds))...)

Expand All @@ -131,7 +137,7 @@ func main() {
grpc.WithTransportCredentials(
grpcfd.TransportCredentials(
credentials.NewTLS(
tlsconfig.MTLSClientConfig(source, source, tlsconfig.AuthorizeAny()),
tlsClientConfig,
),
),
),
Expand Down
4 changes: 3 additions & 1 deletion pkg/imports/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
//
// Copyright (c) 2021 Doc.ai and/or its affiliates.
//
// Copyright (c) 2022 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,5 +21,5 @@
package imports

//go:generate bash -c "rm -rf imports*.go"
//go:generate bash -c "cd $(mktemp -d) && GO111MODULE=on go get github.com/edwarnicke/imports-gen@v1.1.0"
//go:generate bash -c "cd $(mktemp -d) && GO111MODULE=on go install github.com/edwarnicke/imports-gen@v1.1.0"
//go:generate bash -c "GOOS=linux ${GOPATH}/bin/imports-gen"
1 change: 1 addition & 0 deletions pkg/imports/imports_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package imports

import (
_ "context"
_ "crypto/tls"
_ "fmt"
_ "github.com/antonfisher/nested-logrus-formatter"
_ "github.com/edwarnicke/exechelper"
Expand Down

0 comments on commit 6cc785c

Please sign in to comment.