From d1fff21045488d14f837aae812d3a713b345d57e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 30 Aug 2013 15:03:29 -0700 Subject: [PATCH] builder/amazon: chmod debug key so it is ssh-ready --- builder/amazon/common/step_key_pair.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builder/amazon/common/step_key_pair.go b/builder/amazon/common/step_key_pair.go index 2682f0e44..25f9de041 100644 --- a/builder/amazon/common/step_key_pair.go +++ b/builder/amazon/common/step_key_pair.go @@ -49,10 +49,17 @@ func (s *StepKeyPair) Run(state map[string]interface{}) multistep.StepAction { } defer f.Close() + // Write the key out if _, err := f.Write([]byte(keyResp.KeyMaterial)); err != nil { state["error"] = fmt.Errorf("Error saving debug key: %s", err) return multistep.ActionHalt } + + // Chmod it so that it is SSH ready + if err := f.Chmod(0600); err != nil { + state["error"] = fmt.Errorf("Error setting permissions of debug key: %s", err) + return multistep.ActionHalt + } } return multistep.ActionContinue