fix: don't change authorized_keys if they are not defined

This commit is contained in:
Mikaël Cluseau 2018-07-08 16:19:53 +11:00
parent ad3ca0bdb5
commit 2ab852992f

View File

@ -14,14 +14,16 @@ import (
// Files writes the files from the given config
func Files(cfg *config.Config, log *dlog.Log) (err error) {
err = writeFile(
"/root/.ssh/authorized_keys",
[]byte(strings.Join(cfg.RootUser.AuthorizedKeys, "\n")),
0600, 0700, cfg, log,
)
if cfg.RootUser.AuthorizedKeys != nil {
err = writeFile(
"/root/.ssh/authorized_keys",
[]byte(strings.Join(cfg.RootUser.AuthorizedKeys, "\n")),
0600, 0700, cfg, log,
)
if err != nil {
return
if err != nil {
return
}
}
for _, file := range cfg.Files {