mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-10 23:24:32 +08:00
Merge pull request #1510 from gravitl/feature_v0.15.1_accesskeysisolation
Feature v0.15.1 accesskeysisolation
This commit is contained in:
commit
1f7a587d3e
2 changed files with 15 additions and 0 deletions
|
@ -304,6 +304,12 @@ func getNetworkNodes(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
for _, node := range nodes {
|
||||
if len(node.NetworkSettings.AccessKeys) > 0 {
|
||||
node.NetworkSettings.AccessKeys = []models.AccessKey{} // not to be sent back to client; client already knows how to join the network
|
||||
}
|
||||
}
|
||||
|
||||
//Returns all the nodes in JSON format
|
||||
logger.Log(2, r.Header.Get("user"), "fetched nodes on network", networkName)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
@ -380,6 +386,10 @@ func getNode(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if len(node.NetworkSettings.AccessKeys) > 0 {
|
||||
node.NetworkSettings.AccessKeys = []models.AccessKey{} // not to be sent back to client; client already knows how to join the network
|
||||
}
|
||||
|
||||
response := models.NodeGet{
|
||||
Node: node,
|
||||
Peers: peerUpdate.Peers,
|
||||
|
|
|
@ -85,6 +85,11 @@ func NodeUpdate(node *models.Node) error {
|
|||
return nil
|
||||
}
|
||||
logger.Log(3, "publishing node update to "+node.Name)
|
||||
|
||||
if len(node.NetworkSettings.AccessKeys) > 0 {
|
||||
node.NetworkSettings.AccessKeys = []models.AccessKey{} // not to be sent (don't need to spread access keys around the network; we need to know how to reach other nodes, not become them)
|
||||
}
|
||||
|
||||
data, err := json.Marshal(node)
|
||||
if err != nil {
|
||||
logger.Log(2, "error marshalling node update ", err.Error())
|
||||
|
|
Loading…
Add table
Reference in a new issue