Extract common server encryption logic (#65)

* refactor: extract common message encryption logic
* refactor: move letsencrypt logic to common
* refactor: rename common package to encryption
* test: add encryption tests
This commit is contained in:
Mikhail Bragin
2021-07-22 15:23:24 +02:00
committed by GitHub
parent c98be683bf
commit 2172d6f1b9
16 changed files with 343 additions and 141 deletions

View File

@@ -5,9 +5,11 @@ import (
"fmt"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/wiretrustee/wiretrustee/encryption"
sig "github.com/wiretrustee/wiretrustee/signal"
sigProto "github.com/wiretrustee/wiretrustee/signal/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
"net"
"os"
@@ -45,8 +47,8 @@ var (
}
var opts []grpc.ServerOption
if mgmtLetsencryptDomain != "" {
transportCredentials := enableLetsEncrypt(signalDataDir, signalLetsencryptDomain)
if signalLetsencryptDomain != "" {
transportCredentials := credentials.NewTLS(encryption.EnableLetsEncrypt(signalDataDir, signalLetsencryptDomain))
opts = append(opts, grpc.Creds(transportCredentials))
}