fix: ignore stale SSH host keys for ephemeral homelab VMs #130
@@ -110,7 +110,9 @@ class Controller:
|
|||||||
"-o",
|
"-o",
|
||||||
"IdentitiesOnly=yes",
|
"IdentitiesOnly=yes",
|
||||||
"-o",
|
"-o",
|
||||||
"StrictHostKeyChecking=accept-new",
|
"StrictHostKeyChecking=no",
|
||||||
|
"-o",
|
||||||
|
"UserKnownHostsFile=/dev/null",
|
||||||
"-i",
|
"-i",
|
||||||
self.ssh_key,
|
self.ssh_key,
|
||||||
]
|
]
|
||||||
@@ -172,14 +174,7 @@ class Controller:
|
|||||||
return last
|
return last
|
||||||
|
|
||||||
def prepare_known_hosts(self):
|
def prepare_known_hosts(self):
|
||||||
ssh_dir = Path.home() / ".ssh"
|
pass
|
||||||
ssh_dir.mkdir(parents=True, exist_ok=True)
|
|
||||||
(ssh_dir / "known_hosts").touch()
|
|
||||||
run_local(["chmod", "700", str(ssh_dir)])
|
|
||||||
run_local(["chmod", "600", str(ssh_dir / "known_hosts")])
|
|
||||||
for ip in self.node_ips.values():
|
|
||||||
run_local(["ssh-keygen", "-R", ip], check=False)
|
|
||||||
run_local(f"ssh-keyscan -H {shlex.quote(ip)} >> {shlex.quote(str(ssh_dir / 'known_hosts'))}", check=False)
|
|
||||||
|
|
||||||
def prepare_remote_nix(self, ip):
|
def prepare_remote_nix(self, ip):
|
||||||
self.remote(ip, "sudo mkdir -p /etc/nix")
|
self.remote(ip, "sudo mkdir -p /etc/nix")
|
||||||
|
|||||||
Reference in New Issue
Block a user