Skip to content
Snippets Groups Projects
Commit c0f0882d authored by Josh Brooks's avatar Josh Brooks
Browse files

Turn on auth for gateway to gateway connections

parent bce804ea
No related branches found
No related tags found
1 merge request!58Revert "Modify waiting lock"
...@@ -587,6 +587,10 @@ func (i *Instance) GetPermissioningId() *id.ID { ...@@ -587,6 +587,10 @@ func (i *Instance) GetPermissioningId() *id.ID {
} }
func (i *Instance) connectGatewayToGateway() {
}
// Update host helper // Update host helper
func (i *Instance) updateConns(def *ndf.NetworkDefinition, isGateway, isNode bool) error { func (i *Instance) updateConns(def *ndf.NetworkDefinition, isGateway, isNode bool) error {
if isGateway { if isGateway {
...@@ -608,8 +612,13 @@ func (i *Instance) updateConns(def *ndf.NetworkDefinition, isGateway, isNode boo ...@@ -608,8 +612,13 @@ func (i *Instance) updateConns(def *ndf.NetworkDefinition, isGateway, isNode boo
return errors.Errorf("Gateway ID invalid, collides with a "+ return errors.Errorf("Gateway ID invalid, collides with a "+
"hard coded ID. Invalid ID: %v", gwid.Marshal()) "hard coded ID. Invalid ID: %v", gwid.Marshal())
} }
// If this entity is a gateway, other gateway hosts
// should have auth enabled. Otherwise, disable auth
gwParams := connect.GetDefaultHostParams() gwParams := connect.GetDefaultHostParams()
if i.comm.Id.GetType() != id.Gateway {
gwParams.AuthEnabled = false gwParams.AuthEnabled = false
}
_, err := i.comm.AddHost(gwid, addr, []byte(gateway.TlsCertificate), gwParams) _, err := i.comm.AddHost(gwid, addr, []byte(gateway.TlsCertificate), gwParams)
if err != nil { if err != nil {
return errors.WithMessagef(err, "Could not add gateway host %s", gwid) return errors.WithMessagef(err, "Could not add gateway host %s", gwid)
......
...@@ -202,6 +202,7 @@ func setupComm(t *testing.T) (*Instance, *mixmessages.NDF) { ...@@ -202,6 +202,7 @@ func setupComm(t *testing.T) (*Instance, *mixmessages.NDF) {
err = signature.Sign(f, privKey) err = signature.Sign(f, privKey)
testManager := connect.NewManagerTesting(t) testManager := connect.NewManagerTesting(t)
pc := &connect.ProtoComms{ pc := &connect.ProtoComms{
Id:id.NewIdFromString("User", id.User, t),
Manager: testManager, Manager: testManager,
} }
i, err := NewInstance(pc, baseNDF, baseNDF, nil) i, err := NewInstance(pc, baseNDF, baseNDF, nil)
...@@ -363,6 +364,7 @@ func TestInstance_UpdateGatewayConnections(t *testing.T) { ...@@ -363,6 +364,7 @@ func TestInstance_UpdateGatewayConnections(t *testing.T) {
secured, _ := NewSecuredNdf(testutils.NDF) secured, _ := NewSecuredNdf(testutils.NDF)
testManager := connect.NewManagerTesting(t) testManager := connect.NewManagerTesting(t)
pc := &connect.ProtoComms{ pc := &connect.ProtoComms{
Id:id.NewIdFromString("User", id.User, t),
Manager: testManager, Manager: testManager,
} }
i := Instance{ i := Instance{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment