Skip to content

Commit

Permalink
Merge pull request #968 from ipfs/fix/libp2p-api-with-crdt
Browse files Browse the repository at this point in the history
Fix: disable default libp2p API endpoint with CRDT consensus
  • Loading branch information
hsanjuan committed Dec 5, 2019
2 parents 30fd5ee + 578ee29 commit 418587a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cmd/ipfs-cluster-service/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,19 @@ func createCluster(

var apis []ipfscluster.API
if cfgMgr.IsLoadedFromJSON(config.API, cfgs.Restapi.ConfigKey()) {
rest, err := rest.NewAPIWithHost(ctx, cfgs.Restapi, host)
var api *rest.API
// Do NOT enable default Libp2p API endpoint on CRDT
// clusters. Collaborative clusters are likely to share the
// secret with untrusted peers, thus the API would be open for
// anyone.
if cfgHelper.GetConsensus() == cfgs.Raft.ConfigKey() {
api, err = rest.NewAPIWithHost(ctx, cfgs.Restapi, host)
} else {
api, err = rest.NewAPI(ctx, cfgs.Restapi)
}
checkErr("creating REST API component", err)
apis = append(apis, rest)
apis = append(apis, api)

}

if cfgMgr.IsLoadedFromJSON(config.API, cfgs.Ipfsproxy.ConfigKey()) {
Expand Down

0 comments on commit 418587a

Please sign in to comment.