diff --git a/central_auth_key_handling.go b/central_auth_key_handling.go index 44405d8..35bf033 100644 --- a/central_auth_key_handling.go +++ b/central_auth_key_handling.go @@ -147,7 +147,7 @@ func (c *centralAuth) addPublicKey(proc process, msg Message) { er := fmt.Errorf("info: new public key for node: %v. Key needs to be authorized by operator to be allowed into the system by using the keysAllow method", msg.FromNode) c.pki.errorKernel.infoSend(proc, msg, er) - c.pki.errorKernel.logDebug(er) + c.pki.errorKernel.logInfo(er) } // deletePublicKeys to the db if the node do not exist, or if it is a new value. diff --git a/message_readers.go b/message_readers.go index c50c557..f6380c1 100644 --- a/message_readers.go +++ b/message_readers.go @@ -2,7 +2,6 @@ package ctrl import ( "bytes" - "encoding/json" "fmt" "io" "log" @@ -106,11 +105,7 @@ func (s *server) readStartupFolder() { } - j, err := json.MarshalIndent(messages, "", " ") - if err != nil { - log.Printf("test error: %v\n", err) - } - er = fmt.Errorf("%v", string(j)) + er = fmt.Errorf("read from startup folder: %v", messages) s.errorKernel.errSend(s.processInitial, Message{}, er, logInfo) s.messageDeliverLocalCh <- messages diff --git a/processes.go b/processes.go index 9b96ed8..447cc1f 100644 --- a/processes.go +++ b/processes.go @@ -134,7 +134,7 @@ func (p *processes) Start(proc process) { if proc.configuration.StartProcesses.EnableKeyUpdates { // The key update on the client is only a proc func that publish requests. proc.startup.startProcess(proc, None, procFuncKeysRequestUpdate) - proc.startup.startProcess(proc, KeysDeliverUpdate, nil) + proc.startup.startProcess(proc, KeysUpdateReceive, nil) } if proc.configuration.StartProcesses.EnableAclUpdates { @@ -144,13 +144,13 @@ func (p *processes) Start(proc process) { } if proc.configuration.StartProcesses.IsCentralKey { - proc.startup.startProcess(proc, KeysRequestUpdate, nil) + proc.startup.startProcess(proc, KeysUpdateRequest, nil) proc.startup.startProcess(proc, KeysAllow, nil) proc.startup.startProcess(proc, KeysDelete, nil) } if proc.configuration.StartProcesses.IsCentralAcl { - proc.startup.startProcess(proc, KeysRequestUpdate, nil) + proc.startup.startProcess(proc, KeysUpdateRequest, nil) proc.startup.startProcess(proc, KeysAllow, nil) proc.startup.startProcess(proc, KeysDelete, nil) proc.startup.startProcess(proc, AclRequestUpdate, nil) diff --git a/requests.go b/requests.go index 0e8557f..85c25c4 100644 --- a/requests.go +++ b/requests.go @@ -124,11 +124,11 @@ const ( // REQPublicKey will get the public ed25519 key from a node. PublicKey Method = "publicKey" - // REQKeysRequestUpdate will receive all the messages of the current hash of all public keys + // KeysUpdateRequest will receive all the messages of the current hash of all public keys // a node have stored, and send out an update if needed.. - KeysRequestUpdate Method = "keysRequestUpdate" - // REQKeysDeliverUpdate will deliver the public from central to a node. - KeysDeliverUpdate Method = "keysDeliverUpdate" + KeysUpdateRequest Method = "keysUpdateRequest" + // KeysUpdateReceive,deliver the public key from central to a node. + KeysUpdateReceive Method = "keysUpdateReceive" // REQKeysAllow KeysAllow Method = "keysAllow" // REQKeysDelete @@ -199,8 +199,8 @@ func (m Method) GetMethodsAvailable() MethodsAvailable { TailFile: Handler(methodTailFile), PublicKey: Handler(methodPublicKey), - KeysRequestUpdate: Handler(methodKeysRequestUpdate), - KeysDeliverUpdate: Handler(methodKeysDeliverUpdate), + KeysUpdateRequest: Handler(methodKeysUpdateRequest), + KeysUpdateReceive: Handler(methodKeysUpdateReceive), KeysAllow: Handler(methodKeysAllow), KeysDelete: Handler(methodKeysDelete), diff --git a/requests_keys.go b/requests_keys.go index 0fa0677..cc8bf5a 100644 --- a/requests_keys.go +++ b/requests_keys.go @@ -50,7 +50,7 @@ func methodPublicKey(proc process, message Message, node string) ([]byte, error) // The nodes publish messages with the hash of all the public keys it currently // have stored. If the hash is different than the one we currently have on central // we send out an update with all the current keys to the node. -func methodKeysRequestUpdate(proc process, message Message, node string) ([]byte, error) { +func methodKeysUpdateRequest(proc process, message Message, node string) ([]byte, error) { // Get a context with the timeout specified in message.MethodTimeout. // TODO: @@ -144,8 +144,8 @@ func procFuncKeysRequestUpdate(ctx context.Context, proc process, procFuncCh cha ToNode: Node(proc.configuration.CentralNodeName), FromNode: Node(proc.node), Data: []byte(proc.nodeAuth.publicKeys.keysAndHash.Hash[:]), - Method: KeysRequestUpdate, - ReplyMethod: KeysDeliverUpdate, + Method: KeysUpdateRequest, + ReplyMethod: KeysUpdateReceive, ACKTimeout: proc.configuration.DefaultMessageTimeout, Retries: 1, } @@ -167,7 +167,7 @@ func procFuncKeysRequestUpdate(ctx context.Context, proc process, procFuncCh cha // ---- // Handler to receive the public keys from a central server. -func methodKeysDeliverUpdate(proc process, message Message, node string) ([]byte, error) { +func methodKeysUpdateReceive(proc process, message Message, node string) ([]byte, error) { // Get a context with the timeout specified in message.MethodTimeout. ctx, _ := getContextForMethodTimeout(proc.ctx, message) @@ -357,7 +357,7 @@ func pushKeys(proc process, message Message, nodes []Node) error { proc.errorKernel.logDebug(er) msg := Message{ ToNode: n, - Method: KeysDeliverUpdate, + Method: KeysUpdateReceive, ReplyMethod: None, ACKTimeout: 0, } @@ -396,7 +396,7 @@ func pushKeys(proc process, message Message, nodes []Node) error { proc.errorKernel.logDebug(er) msg := Message{ ToNode: n, - Method: KeysDeliverUpdate, + Method: KeysUpdateReceive, Data: b, ReplyMethod: None, ACKTimeout: 0,