From 56f25c4855d456ec44d17c31a412de2cc2d8fbc3 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 23 Jan 2024 03:21:05 -0500 Subject: [PATCH] fix: ensure the known_hosts file exists before attempting to ssh onto a server --- plugins/common/ssh.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/common/ssh.go b/plugins/common/ssh.go index 4d0c08e7f..0c405d448 100644 --- a/plugins/common/ssh.go +++ b/plugins/common/ssh.go @@ -254,6 +254,10 @@ func (task SshTask) Execute(ctx context.Context) (SshResult, error) { return SshResult{}, fmt.Errorf("failed to load known hosts: %w", err) } + if err := TouchFile(filepath.Join(os.Getenv("DOKKU_ROOT"), ".ssh", "known_hosts")); err != nil { + return SshResult{}, fmt.Errorf("failed to touch known_hosts file: %w", err) + } + if task.AllowUknownHosts { callback = ssh.InsecureIgnoreHostKey() }