pkg/transport: fail on bad certificates (#1285)

This commit is contained in:
JT Olio 2019-02-11 04:02:49 -07:00 committed by Kaloyan Raev
parent 8156d911fa
commit ea28a9a581
3 changed files with 10 additions and 3 deletions

View File

@ -16,6 +16,7 @@ import (
"storj.io/storj/pkg/identity"
"storj.io/storj/pkg/peertls"
"storj.io/storj/pkg/pkcrypto"
)
func main() {
@ -57,7 +58,7 @@ func main() {
}
var keys bytes.Buffer
err = peertls.WriteKeyPEM(&keys, identity.Key)
err = pkcrypto.WritePrivateKeyPEM(&keys, identity.Key)
if err != nil {
panic(err)
}

View File

@ -69,7 +69,7 @@ func (transport *Transport) DialNode(ctx context.Context, node *pb.Node, opts ..
return nil, Error.Wrap(err)
}
options := append([]grpc.DialOption{dialOpt, grpc.WithBlock()}, opts...)
options := append([]grpc.DialOption{dialOpt, grpc.WithBlock(), grpc.FailOnNonTempDialError(true)}, opts...)
ctx, cf := context.WithTimeout(ctx, timeout)
defer cf()
@ -97,7 +97,7 @@ func (transport *Transport) DialAddress(ctx context.Context, address string, opt
return nil, Error.Wrap(err)
}
options := append([]grpc.DialOption{dialOpt, grpc.WithBlock()}, opts...)
options := append([]grpc.DialOption{dialOpt, grpc.WithBlock(), grpc.FailOnNonTempDialError(true)}, opts...)
conn, err = grpc.DialContext(ctx, address, options...)
if err == context.Canceled {
return nil, err

View File

@ -321,6 +321,12 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, config *Config) (*
0, peer.Log.Named("checker"),
config.Checker.Interval)
if config.Repairer.OverlayAddr == "" {
config.Repairer.OverlayAddr = peer.Addr()
}
if config.Repairer.PointerDBAddr == "" {
config.Repairer.PointerDBAddr = peer.Addr()
}
peer.Repair.Repairer = repairer.NewService(peer.DB.RepairQueue(), &config.Repairer, peer.Identity, config.Repairer.Interval, config.Repairer.MaxRepair)
}