diff --git a/pkg/fab/base.go b/pkg/fab/base.go index 01bc1751..90abb05a 100644 --- a/pkg/fab/base.go +++ b/pkg/fab/base.go @@ -65,13 +65,18 @@ func (cfg *Base) Hydrate(preset cnc.Preset) error { if !slices.Contains(cfg.AuthorizedKeys, val) { cfg.AuthorizedKeys = append(cfg.AuthorizedKeys, val) } + if cfg.Dev && !slices.Contains(cfg.AuthorizedKeys, DEV_SSH_KEY) { + cfg.AuthorizedKeys = append(cfg.AuthorizedKeys, DEV_SSH_KEY) + } } if preset == PRESET_VLAB { cfg.Dev = true } - slog.Warn("Attention! Development mode enabled - this is not secure! Default users and keys will be created.") + if cfg.Dev { + slog.Warn("Attention! Development mode enabled - this is not secure! Default users and keys will be created.") + } return nil } diff --git a/pkg/fab/ctrl_os_butane.tmpl.yaml b/pkg/fab/ctrl_os_butane.tmpl.yaml index df49baa9..72b6a7b3 100644 --- a/pkg/fab/ctrl_os_butane.tmpl.yaml +++ b/pkg/fab/ctrl_os_butane.tmpl.yaml @@ -6,7 +6,7 @@ passwd: - name: {{ .username }} ssh_authorized_keys: {{ range .authorizedKeys}} - - {{ . }} + - "{{ . }}" {{ end }} groups: - wheel diff --git a/pkg/fab/fabric.go b/pkg/fab/fabric.go index 38067840..9a2948fe 100644 --- a/pkg/fab/fabric.go +++ b/pkg/fab/fabric.go @@ -122,7 +122,6 @@ func (cfg *Fabric) Build(basedir string, preset cnc.Preset, get cnc.GetComponent slog.Info("Adding dev users", "users", users) for idx := range users { users[idx].SSHKeys = append(users[idx].SSHKeys, BaseConfig(get).AuthorizedKeys...) - users[idx].SSHKeys = append(users[idx].SSHKeys, DEV_SSH_KEY) slog.Info("Adding dev ssh keys to user", "user", users[idx]) } }