diff --git a/gossip/integration/integration.go b/gossip/integration/integration.go index 8346ec0f961..79f0b742f34 100644 --- a/gossip/integration/integration.go +++ b/gossip/integration/integration.go @@ -21,9 +21,12 @@ import ( "strings" "time" + "github.com/hyperledger/fabric/gossip/api" + "github.com/hyperledger/fabric/gossip/common" "github.com/hyperledger/fabric/gossip/gossip" "github.com/hyperledger/fabric/peer/gossip/mcs" "github.com/hyperledger/fabric/peer/gossip/sa" + "github.com/spf13/viper" "google.golang.org/grpc" ) @@ -58,5 +61,43 @@ func NewGossipComponent(identity []byte, endpoint string, s *grpc.Server, dialOp conf := newConfig(endpoint, bootPeers...) cryptSvc := mcs.NewMessageCryptoService() secAdv := sa.NewSecurityAdvisor() + if viper.GetBool("peer.gossip.ignoresecurity") { + sec := &secImpl{[]byte(endpoint)} + cryptSvc = sec + secAdv = sec + identity = []byte(endpoint) + } return gossip.NewGossipService(conf, s, secAdv, cryptSvc, identity, dialOpts...) } + +type secImpl struct { + identity []byte +} + +func (*secImpl) OrgByPeerIdentity(api.PeerIdentityType) api.OrgIdentityType { + return api.OrgIdentityType("DEFAULT") +} + +func (s *secImpl) GetPKIidOfCert(peerIdentity api.PeerIdentityType) common.PKIidType { + return common.PKIidType(peerIdentity) +} + +func (s *secImpl) VerifyBlock(chainID common.ChainID, signedBlock api.SignedBlock) error { + return nil +} + +func (s *secImpl) Sign(msg []byte) ([]byte, error) { + return msg, nil +} + +func (s *secImpl) Verify(peerIdentity api.PeerIdentityType, signature, message []byte) error { + return nil +} + +func (s *secImpl) VerifyByChannel(chainID common.ChainID, peerIdentity api.PeerIdentityType, signature, message []byte) error { + return nil +} + +func (s *secImpl) ValidateIdentity(peerIdentity api.PeerIdentityType) error { + return nil +} diff --git a/peer/common/anchors.go b/peer/common/anchors.go index d64b6e7cfe6..cb500624ada 100644 --- a/peer/common/anchors.go +++ b/peer/common/anchors.go @@ -27,6 +27,7 @@ import ( "github.com/hyperledger/fabric/msp" "github.com/hyperledger/fabric/protos/peer" + "github.com/spf13/viper" ) type AnchorPeerParser struct { @@ -126,6 +127,11 @@ func anchorPeerFromFile(filename string) (*peer.AnchorPeer, error) { Port: int32(port), Cert: identity, } + + if viper.GetBool("peer.gossip.ignoresecurity") { + ap.Cert = []byte(fmt.Sprintf("%s:%d", ap.Host, ap.Port)) + } + return ap, nil }