Fix known_hosts file clogging and remote host id

By enabling UserKnownHostsFile=/dev/null, and CheckHostIP=no
options to the defaults we prevent the user from adding the host key
multiple times and from flakes that can raise Remote Host Id change.

Resolves: https://github.com/containers/podman/issues/23505

Signed-off-by: Nicola Sella <nsella@redhat.com>
This commit is contained in:
Nicola Sella 2024-08-14 15:46:11 +02:00
parent 6638337453
commit 6b1c7de3d5
1 changed files with 4 additions and 1 deletions

View File

@ -116,7 +116,10 @@ func commonNativeSSH(username, identityPath, name string, sshPort int, inputArgs
args := []string{"-i", identityPath, "-p", port, sshDestination,
"-o", "IdentitiesOnly=yes",
"-o", "StrictHostKeyChecking=no", "-o", "LogLevel=ERROR", "-o", "SetEnv=LC_ALL="}
"-o", "StrictHostKeyChecking=no",
"-o", "UserKnownHostsFile=" + os.DevNull,
"-o", "CheckHostIP=no",
"-o", "LogLevel=ERROR", "-o", "SetEnv=LC_ALL="}
if len(inputArgs) > 0 {
interactive = false
args = append(args, inputArgs...)